Author: Nhat Nguyen Date: 2023-01-13T20:32:59+01:00 New Revision: eb4aa6c7a5f22583e319aaaae3f6ee73cbc5464a
URL: https://github.com/llvm/llvm-project/commit/eb4aa6c7a5f22583e319aaaae3f6ee73cbc5464a DIFF: https://github.com/llvm/llvm-project/commit/eb4aa6c7a5f22583e319aaaae3f6ee73cbc5464a.diff LOG: [cmake] Fix path to LLVMConfig.cmake for multi-config builds D139623 replaces CMAKE_CFG_INTDIR with '.' for multi-config builds. However, this change has not been reflected in mlir, flang, polly, lld, and clang. The patch updates the path to LLVMConfig.cmake for those projects. Reviewed By: sebastian-ne Differential Revision: https://reviews.llvm.org/D141538 Added: Modified: clang/cmake/modules/CMakeLists.txt flang/cmake/modules/CMakeLists.txt lld/cmake/modules/CMakeLists.txt llvm/cmake/modules/AddLLVM.cmake llvm/cmake/modules/CMakeLists.txt mlir/cmake/modules/CMakeLists.txt polly/cmake/CMakeLists.txt Removed: ################################################################################ diff --git a/clang/cmake/modules/CMakeLists.txt b/clang/cmake/modules/CMakeLists.txt index 749ef672c34f7..d2d68121371bf 100644 --- a/clang/cmake/modules/CMakeLists.txt +++ b/clang/cmake/modules/CMakeLists.txt @@ -15,7 +15,8 @@ set(clang_cmake_builddir "${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/cla set(LLVM_INSTALL_PACKAGE_DIR "${CMAKE_INSTALL_PACKAGEDIR}/llvm" CACHE STRING "Path for CMake subdirectory for LLVM (defaults to '${CMAKE_INSTALL_PACKAGEDIR}/llvm')") # CMAKE_INSTALL_PACKAGEDIR might be absolute, so don't reuse below. -set(llvm_cmake_builddir "${LLVM_LIBRARY_DIR}/cmake/llvm") +string(REPLACE "${CMAKE_CFG_INTDIR}" "." llvm_cmake_builddir "${LLVM_LIBRARY_DIR}") +set(llvm_cmake_builddir "${llvm_cmake_builddir}/cmake/llvm") get_property(CLANG_EXPORTS GLOBAL PROPERTY CLANG_EXPORTS) export(TARGETS ${CLANG_EXPORTS} FILE ${clang_cmake_builddir}/ClangTargets.cmake) diff --git a/flang/cmake/modules/CMakeLists.txt b/flang/cmake/modules/CMakeLists.txt index 78cb1bc9cf995..4c0f9ab19cd82 100644 --- a/flang/cmake/modules/CMakeLists.txt +++ b/flang/cmake/modules/CMakeLists.txt @@ -14,7 +14,8 @@ set(flang_cmake_builddir "${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/fla set(LLVM_INSTALL_PACKAGE_DIR "${CMAKE_INSTALL_PACKAGEDIR}/llvm" CACHE STRING "Path for CMake subdirectory for LLVM (defaults to '${CMAKE_INSTALL_PACKAGEDIR}/llvm')") # CMAKE_INSTALL_PACKAGEDIR might be absolute, so don't reuse below. -set(llvm_cmake_builddir "${LLVM_LIBRARY_DIR}/cmake/llvm") +string(REPLACE "${CMAKE_CFG_INTDIR}" "." llvm_cmake_builddir "${LLVM_LIBRARY_DIR}") +set(llvm_cmake_builddir "${llvm_cmake_builddir}/cmake/llvm") get_property(FLANG_EXPORTS GLOBAL PROPERTY FLANG_EXPORTS) export(TARGETS ${FLANG_EXPORTS} FILE ${flang_cmake_builddir}/FlangTargets.cmake) diff --git a/lld/cmake/modules/CMakeLists.txt b/lld/cmake/modules/CMakeLists.txt index e0578d7156a1c..66db0354da65c 100644 --- a/lld/cmake/modules/CMakeLists.txt +++ b/lld/cmake/modules/CMakeLists.txt @@ -14,7 +14,8 @@ set(lld_cmake_builddir "${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/lld") set(LLVM_INSTALL_PACKAGE_DIR "${CMAKE_INSTALL_PACKAGEDIR}/llvm" CACHE STRING "Path for CMake subdirectory for LLVM (defaults to '${CMAKE_INSTALL_PACKAGEDIR}/llvm')") # CMAKE_INSTALL_PACKAGEDIR might be absolute, so don't reuse below. -set(llvm_cmake_builddir "${LLVM_LIBRARY_DIR}/cmake/llvm") +string(REPLACE "${CMAKE_CFG_INTDIR}" "." llvm_cmake_builddir "${LLVM_LIBRARY_DIR}") +set(llvm_cmake_builddir "${llvm_cmake_builddir}/cmake/llvm") get_property(LLD_EXPORTS GLOBAL PROPERTY LLD_EXPORTS) export(TARGETS ${LLD_EXPORTS} FILE ${lld_cmake_builddir}/LLDTargets.cmake) diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake index 50e4d5d0681de..368f0d1c2a32c 100644 --- a/llvm/cmake/modules/AddLLVM.cmake +++ b/llvm/cmake/modules/AddLLVM.cmake @@ -1126,7 +1126,7 @@ function(process_llvm_pass_plugins) message(FATAL_ERROR "LLVM_INSTALL_PACKAGE_DIR must be defined and writable. GEN_CONFIG should only be passe when building LLVM proper.") endif() # LLVM_INSTALL_PACKAGE_DIR might be absolute, so don't reuse below. - string(REPLACE "${CMAKE_CFG_INTDIR}" "." llvm_cmake_builddir "${LLVM_LIBRARY_DIR}") + string(REPLACE "${CMAKE_CFG_INTDIR}" "." llvm_cmake_builddir "${LLVM_LIBRARY_DIR}") set(llvm_cmake_builddir "${llvm_cmake_builddir}/cmake/llvm") file(WRITE "${llvm_cmake_builddir}/LLVMConfigExtensions.cmake" diff --git a/llvm/cmake/modules/CMakeLists.txt b/llvm/cmake/modules/CMakeLists.txt index d2997a4706e18..d99af79aa38e0 100644 --- a/llvm/cmake/modules/CMakeLists.txt +++ b/llvm/cmake/modules/CMakeLists.txt @@ -3,7 +3,7 @@ include(LLVMDistributionSupport) include(FindPrefixFromConfig) # CMAKE_INSTALL_PACKAGEDIR might be absolute, so don't reuse below. -string(REPLACE "${CMAKE_CFG_INTDIR}" "." llvm_cmake_builddir "${LLVM_LIBRARY_DIR}") +string(REPLACE "${CMAKE_CFG_INTDIR}" "." llvm_cmake_builddir "${LLVM_LIBRARY_DIR}") set(llvm_cmake_builddir "${llvm_cmake_builddir}/cmake/llvm") # First for users who use an installed LLVM, create the LLVMExports.cmake file. diff --git a/mlir/cmake/modules/CMakeLists.txt b/mlir/cmake/modules/CMakeLists.txt index 3f15c2d5cd0b3..254cfb6e05ca3 100644 --- a/mlir/cmake/modules/CMakeLists.txt +++ b/mlir/cmake/modules/CMakeLists.txt @@ -15,7 +15,8 @@ set(mlir_cmake_builddir "${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/mlir set(LLVM_INSTALL_PACKAGE_DIR "${CMAKE_INSTALL_PACKAGEDIR}/llvm" CACHE STRING "Path for CMake subdirectory for LLVM (defaults to '${CMAKE_INSTALL_PACKAGEDIR}/llvm')") # CMAKE_INSTALL_PACKAGEDIR might be absolute, so don't reuse below. -set(llvm_cmake_builddir "${LLVM_LIBRARY_DIR}/cmake/llvm") +string(REPLACE "${CMAKE_CFG_INTDIR}" "." llvm_cmake_builddir "${LLVM_LIBRARY_DIR}") +set(llvm_cmake_builddir "${llvm_cmake_builddir}/cmake/llvm") get_property(MLIR_EXPORTS GLOBAL PROPERTY MLIR_EXPORTS) export(TARGETS ${MLIR_EXPORTS} FILE ${mlir_cmake_builddir}/MLIRTargets.cmake) diff --git a/polly/cmake/CMakeLists.txt b/polly/cmake/CMakeLists.txt index d7b3fa1f29d82..b6181fbe4cc55 100644 --- a/polly/cmake/CMakeLists.txt +++ b/polly/cmake/CMakeLists.txt @@ -12,7 +12,8 @@ set(polly_cmake_builddir "${POLLY_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/pol set(LLVM_INSTALL_PACKAGE_DIR "${CMAKE_INSTALL_PACKAGEDIR}/llvm" CACHE STRING "Path for CMake subdirectory for LLVM (defaults to '${CMAKE_INSTALL_PACKAGEDIR}/llvm')") # CMAKE_INSTALL_PACKAGEDIR might be absolute, so don't reuse below. -set(llvm_cmake_builddir "${LLVM_LIBRARY_DIR}/cmake/llvm") +string(REPLACE "${CMAKE_CFG_INTDIR}" "." llvm_cmake_builddir "${LLVM_LIBRARY_DIR}") +set(llvm_cmake_builddir "${llvm_cmake_builddir}/cmake/llvm") if (CMAKE_CONFIGURATION_TYPES) set(POLLY_EXPORTS_FILE_NAME "PollyExports-$<LOWER_CASE:$<CONFIG>>.cmake") _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits