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

Michael Spencer via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 13 17:45:06 PST 2023


https://github.com/Bigcheese created https://github.com/llvm/llvm-project/pull/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

>From 72e170e964209dfef01c8216e278c4728b779721 Mon Sep 17 00:00:00 2001
From: Michael Spencer <bigcheesegs at gmail.com>
Date: Wed, 13 Dec 2023 17:42:55 -0800
Subject: [PATCH] [llvm][cmake] Use $<CONFIG> instead of ${CMAKE_CFG_INTDIR}
 for llvm-config

${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
---
 llvm/tools/llvm-config/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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