[llvm] [cmake] Pass -resource-dir to external projects as CMAKE_<LANG>_FLAGS_INIT instead of as a force override (PR #87330)
Raul Tambre via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 2 03:48:18 PDT 2024
https://github.com/tambry created https://github.com/llvm/llvm-project/pull/87330
It's useful to use toolchain files for configuring runtimes builds. Setting CMAKE_<LANG>_FLAGS is however forceful and precludes initialization from the _INIT variant meant to be set by toolchains. The toolchain file still needs to append instead of just setting and be idempotent (`include_guard()`), but this way at least a special toolchain to account for LLVM's won't be required.
>From d863807bdcaad5ba3a663b694ea9a75ed0cdade0 Mon Sep 17 00:00:00 2001
From: Raul Tambre <raul.tambre at clevon.com>
Date: Tue, 2 Apr 2024 13:10:26 +0300
Subject: [PATCH] [cmake] Pass -resource-dir to external projects as
CMAKE_<LANG>_FLAGS_INIT instead of as a force override
It's useful to use toolchain files for configuring runtimes builds.
Setting CMAKE_<LANG>_FLAGS is however forceful and precludes initialization from the _INIT variant meant to be set by toolchains.
The toolchain file still needs to append instead of just setting and be idempotent (`include_guard()`), but this way at least a special toolchain to account for LLVM's won't be required.
---
llvm/cmake/modules/LLVMExternalProjectUtils.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/cmake/modules/LLVMExternalProjectUtils.cmake b/llvm/cmake/modules/LLVMExternalProjectUtils.cmake
index 2672f90f579bd9..114bfa38df4304 100644
--- a/llvm/cmake/modules/LLVMExternalProjectUtils.cmake
+++ b/llvm/cmake/modules/LLVMExternalProjectUtils.cmake
@@ -287,7 +287,7 @@ function(llvm_ExternalProject_Add name source_dir)
endif()
set(flag_types ASM C CXX MODULE_LINKER SHARED_LINKER EXE_LINKER)
foreach(type ${flag_types})
- set(${type}_flag -DCMAKE_${type}_FLAGS=-resource-dir=${resource_dir})
+ set(${type}_flag -DCMAKE_${type}_FLAGS_INIT=-resource-dir=${resource_dir})
endforeach()
string(REPLACE ";" "|" flag_string "${flag_types}")
foreach(arg ${ARG_CMAKE_ARGS})
More information about the llvm-commits
mailing list