Ericson2314 updated this revision to Diff 401304. Ericson2314 added a comment.
Avoid warning Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D117419/new/ https://reviews.llvm.org/D117419 Files: clang/CMakeLists.txt clang/cmake/modules/AddClang.cmake clang/cmake/modules/CMakeLists.txt clang/tools/c-index-test/CMakeLists.txt clang/tools/clang-format/CMakeLists.txt clang/tools/clang-nvlink-wrapper/CMakeLists.txt clang/tools/clang-rename/CMakeLists.txt clang/tools/libclang/CMakeLists.txt clang/tools/scan-build-py/CMakeLists.txt clang/tools/scan-build/CMakeLists.txt clang/tools/scan-view/CMakeLists.txt clang/utils/hmaptool/CMakeLists.txt llvm/cmake/modules/LLVMInstallSymlink.cmake
Index: llvm/cmake/modules/LLVMInstallSymlink.cmake =================================================================== --- llvm/cmake/modules/LLVMInstallSymlink.cmake +++ llvm/cmake/modules/LLVMInstallSymlink.cmake @@ -6,7 +6,8 @@ function(install_symlink name target outdir) set(DESTDIR $ENV{DESTDIR}) - set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}") + GNUInstallDirs_get_absolute_install_dir(bindir "${outdir}" BINDIR) + set(bindir "${DESTDIR}${bindir}") message(STATUS "Creating ${name}") Index: clang/utils/hmaptool/CMakeLists.txt =================================================================== --- clang/utils/hmaptool/CMakeLists.txt +++ clang/utils/hmaptool/CMakeLists.txt @@ -10,7 +10,7 @@ list(APPEND Depends ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/${CLANG_HMAPTOOL}) install(PROGRAMS ${CLANG_HMAPTOOL} - DESTINATION bin + DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT hmaptool) add_custom_target(hmaptool ALL DEPENDS ${Depends}) Index: clang/tools/scan-view/CMakeLists.txt =================================================================== --- clang/tools/scan-view/CMakeLists.txt +++ clang/tools/scan-view/CMakeLists.txt @@ -20,7 +20,7 @@ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile}) list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile}) install(PROGRAMS bin/${BinFile} - DESTINATION bin + DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT scan-view) endforeach() @@ -34,7 +34,7 @@ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/${ShareFile}) list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-view/${ShareFile}) install(FILES share/${ShareFile} - DESTINATION share/scan-view + DESTINATION "${CMAKE_INSTALL_DATADIR}/scan-view" COMPONENT scan-view) endforeach() Index: clang/tools/scan-build/CMakeLists.txt =================================================================== --- clang/tools/scan-build/CMakeLists.txt +++ clang/tools/scan-build/CMakeLists.txt @@ -47,7 +47,7 @@ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile}) list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile}) install(PROGRAMS bin/${BinFile} - DESTINATION bin + DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT scan-build) endforeach() @@ -61,7 +61,7 @@ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libexec/${LibexecFile}) list(APPEND Depends ${CMAKE_BINARY_DIR}/libexec/${LibexecFile}) install(PROGRAMS libexec/${LibexecFile} - DESTINATION libexec + DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}" COMPONENT scan-build) endforeach() @@ -89,7 +89,7 @@ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/scan-build/${ShareFile}) list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-build/${ShareFile}) install(FILES share/scan-build/${ShareFile} - DESTINATION share/scan-build + DESTINATION "${CMAKE_INSTALL_DATADIR}/scan-build" COMPONENT scan-build) endforeach() Index: clang/tools/scan-build-py/CMakeLists.txt =================================================================== --- clang/tools/scan-build-py/CMakeLists.txt +++ clang/tools/scan-build-py/CMakeLists.txt @@ -43,7 +43,7 @@ ${CMAKE_BINARY_DIR}/bin/scan-build-py DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/scan-build) install (PROGRAMS "bin/scan-build" - DESTINATION bin + DESTINATION "${CMAKE_INSTALL_BINDIR}" RENAME scan-build-py COMPONENT scan-build-py) list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/scan-build-py) @@ -56,7 +56,7 @@ ${CMAKE_BINARY_DIR}/bin/ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile}) install(PROGRAMS bin/${BinFile} - DESTINATION bin + DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT scan-build-py) list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile}) endif() @@ -72,7 +72,7 @@ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libexec/${lib}) list(APPEND Depends ${CMAKE_BINARY_DIR}/libexec/${lib}) install(PROGRAMS libexec/${lib} - DESTINATION libexec + DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}" COMPONENT scan-build-py) endforeach() Index: clang/tools/libclang/CMakeLists.txt =================================================================== --- clang/tools/libclang/CMakeLists.txt +++ clang/tools/libclang/CMakeLists.txt @@ -186,7 +186,7 @@ if(INTERNAL_INSTALL_PREFIX) set(LIBCLANG_HEADERS_INSTALL_DESTINATION "${INTERNAL_INSTALL_PREFIX}/include") else() - set(LIBCLANG_HEADERS_INSTALL_DESTINATION include) + set(LIBCLANG_HEADERS_INSTALL_DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") endif() install(DIRECTORY ../../include/clang-c Index: clang/tools/clang-rename/CMakeLists.txt =================================================================== --- clang/tools/clang-rename/CMakeLists.txt +++ clang/tools/clang-rename/CMakeLists.txt @@ -19,8 +19,8 @@ ) install(PROGRAMS clang-rename.py - DESTINATION share/clang + DESTINATION "${CMAKE_INSTALL_DATADIR}/clang" COMPONENT clang-rename) install(PROGRAMS clang-rename.el - DESTINATION share/clang + DESTINATION "${CMAKE_INSTALL_DATADIR}/clang" COMPONENT clang-rename) Index: clang/tools/clang-nvlink-wrapper/CMakeLists.txt =================================================================== --- clang/tools/clang-nvlink-wrapper/CMakeLists.txt +++ clang/tools/clang-nvlink-wrapper/CMakeLists.txt @@ -22,4 +22,4 @@ ${CLANG_NVLINK_WRAPPER_LIB_DEPS} ) -install(TARGETS clang-nvlink-wrapper RUNTIME DESTINATION bin) +install(TARGETS clang-nvlink-wrapper RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") Index: clang/tools/clang-format/CMakeLists.txt =================================================================== --- clang/tools/clang-format/CMakeLists.txt +++ clang/tools/clang-format/CMakeLists.txt @@ -21,20 +21,20 @@ endif() install(PROGRAMS clang-format-bbedit.applescript - DESTINATION share/clang + DESTINATION "${CMAKE_INSTALL_DATADIR}/clang" COMPONENT clang-format) install(PROGRAMS clang-format-diff.py - DESTINATION share/clang + DESTINATION "${CMAKE_INSTALL_DATADIR}/clang" COMPONENT clang-format) install(PROGRAMS clang-format-sublime.py - DESTINATION share/clang + DESTINATION "${CMAKE_INSTALL_DATADIR}/clang" COMPONENT clang-format) install(PROGRAMS clang-format.el - DESTINATION share/clang + DESTINATION "${CMAKE_INSTALL_DATADIR}/clang" COMPONENT clang-format) install(PROGRAMS clang-format.py - DESTINATION share/clang + DESTINATION "${CMAKE_INSTALL_DATADIR}/clang" COMPONENT clang-format) install(PROGRAMS git-clang-format - DESTINATION bin + DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT clang-format) Index: clang/tools/c-index-test/CMakeLists.txt =================================================================== --- clang/tools/c-index-test/CMakeLists.txt +++ clang/tools/c-index-test/CMakeLists.txt @@ -49,7 +49,7 @@ set_property(TARGET c-index-test APPEND PROPERTY INSTALL_RPATH "@executable_path/../../lib") else() - set(INSTALL_DESTINATION bin) + set(INSTALL_DESTINATION "${CMAKE_INSTALL_BINDIR}") endif() install(TARGETS c-index-test Index: clang/cmake/modules/CMakeLists.txt =================================================================== --- clang/cmake/modules/CMakeLists.txt +++ clang/cmake/modules/CMakeLists.txt @@ -1,3 +1,4 @@ +include(ExtendPath) include(LLVMDistributionSupport) include(FindPrefixFromConfig) @@ -42,8 +43,9 @@ set(CLANG_CONFIG_CMAKE_DIR "\${CLANG_INSTALL_PREFIX}/${CLANG_INSTALL_PACKAGE_DIR}") set(CLANG_CONFIG_LLVM_CMAKE_DIR "\${CLANG_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}") get_config_exports_includes(Clang CLANG_CONFIG_INCLUDE_EXPORTS) +extend_path(base_includedir "\${CLANG_INSTALL_PREFIX}" "${CMAKE_INSTALL_INCLUDEDIR}") set(CLANG_CONFIG_INCLUDE_DIRS - "\${CLANG_INSTALL_PREFIX}/include" + "${base_includedir}" ) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/ClangConfig.cmake.in Index: clang/cmake/modules/AddClang.cmake =================================================================== --- clang/cmake/modules/AddClang.cmake +++ clang/cmake/modules/AddClang.cmake @@ -1,3 +1,4 @@ +include(GNUInstallDirs) include(LLVMDistributionSupport) function(clang_tablegen) @@ -120,7 +121,7 @@ ${export_to_clangtargets} LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} - RUNTIME DESTINATION bin) + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") if (NOT LLVM_ENABLE_IDE) add_llvm_install_targets(install-${lib} @@ -159,7 +160,7 @@ get_target_export_arg(${name} Clang export_to_clangtargets) install(TARGETS ${name} ${export_to_clangtargets} - RUNTIME DESTINATION bin + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT ${name}) if(NOT LLVM_ENABLE_IDE) Index: clang/CMakeLists.txt =================================================================== --- clang/CMakeLists.txt +++ clang/CMakeLists.txt @@ -4,7 +4,13 @@ # standalone project, using LLVM as an external library: if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) project(Clang) + set(CLANG_BUILT_STANDALONE TRUE) +endif() + +# Must go below project(..) +include(GNUInstallDirs) +if(CLANG_BUILT_STANDALONE) set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to") set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) @@ -185,8 +191,6 @@ endif() endif() - set(CLANG_BUILT_STANDALONE TRUE) - set(BACKEND_PACKAGE_STRING "LLVM ${LLVM_PACKAGE_VERSION}") else() set(BACKEND_PACKAGE_STRING "${PACKAGE_STRING}") @@ -424,7 +428,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) install(DIRECTORY include/clang include/clang-c - DESTINATION include + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" COMPONENT clang-headers FILES_MATCHING PATTERN "*.def" @@ -433,7 +437,7 @@ ) install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/clang - DESTINATION include + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" COMPONENT clang-headers FILES_MATCHING PATTERN "CMakeFiles" EXCLUDE @@ -453,7 +457,7 @@ add_custom_target(bash-autocomplete DEPENDS utils/bash-autocomplete.sh) install(PROGRAMS utils/bash-autocomplete.sh - DESTINATION share/clang + DESTINATION "${CMAKE_INSTALL_DATADIR}/clang" COMPONENT bash-autocomplete) if(NOT LLVM_ENABLE_IDE) add_llvm_install_targets(install-bash-autocomplete
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits