[llvm] f956bfe - [llvm][cmake] Use $<CONFIG> instead of ${CMAKE_CFG_INTDIR} for llvm-config (#75417)

via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 14 14:03:23 PST 2023


Author: Michael Spencer
Date: 2023-12-14T14:03:19-08:00
New Revision: f956bfe169c7debd72acd22b124e5ae78174b3a0

URL: https://github.com/llvm/llvm-project/commit/f956bfe169c7debd72acd22b124e5ae78174b3a0
DIFF: https://github.com/llvm/llvm-project/commit/f956bfe169c7debd72acd22b124e5ae78174b3a0.diff

LOG: [llvm][cmake] Use $<CONFIG> instead of ${CMAKE_CFG_INTDIR} for llvm-config (#75417)

${CMAKE_CFG_INTDIR} does not work correctly for llvm-config when
building with the Ninja Multi-Config generator. It tries to find files
in the ${CONFIGURATION} directory. Using the $<CONFIG> generator
expression instead fixes this.

Really this needs to be done everywhere as ${CMAKE_CFG_INTDIR} is
deprecated as of 3.21 (LLVM's current min version is 3.20), but this is
sufficient to get `check-llvm` to pass.

See https://cmake.org/cmake/help/latest/variable/CMAKE_CFG_INTDIR.html

Added: 
    

Modified: 
    llvm/tools/llvm-config/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-config/CMakeLists.txt b/llvm/tools/llvm-config/CMakeLists.txt
index 35b8b215605d89..e02bda1ead50c0 100644
--- a/llvm/tools/llvm-config/CMakeLists.txt
+++ b/llvm/tools/llvm-config/CMakeLists.txt
@@ -80,7 +80,7 @@ llvm_expand_pseudo_components(LLVM_DYLIB_COMPONENTS_expanded "${LLVM_DYLIB_COMPO
 configure_file(${BUILDVARIABLES_SRCPATH} ${BUILDVARIABLES_OBJPATH} @ONLY)
 
 # Set build-time environment(s).
-add_compile_definitions(CMAKE_CFG_INTDIR="${CMAKE_CFG_INTDIR}")
+add_compile_definitions(CMAKE_CFG_INTDIR="$<CONFIG>")
 
 if(LLVM_ENABLE_MODULES)
   target_compile_options(llvm-config PUBLIC


        


More information about the llvm-commits mailing list