[llvm] Fixed cmake config in case of LLVM_ENABLE_RPMALLOC=ON and non MSVC compiler (PR #139770)
via llvm-commits
llvm-commits at lists.llvm.org
Tue May 13 10:46:41 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-support
Author: Dmitry Vasilyev (slydiman)
<details>
<summary>Changes</summary>
This patch fixes the following error in case of LLVM_ENABLE_RPMALLOC=ON and clang or other non MSVC compiler:
```
CMake Error at cmake/modules/AddLLVM.cmake:644 (add_library):
Target "LLVMSupport" links to item " -INCLUDE:malloc" which has leading or
trailing whitespace. This is now an error according to policy CMP0004.
Call Stack (most recent call first):
cmake/modules/AddLLVM.cmake:944 (llvm_add_library)
cmake/modules/AddLLVM.cmake:917 (add_llvm_library)
lib/Support/CMakeLists.txt:139 (add_llvm_component_library)
```
Note `delayload_flags` is empty before this line is case of non MSVC compiler.
The behavior is the same with CMake 3.25.3 and 4.0.2.
---
Full diff: https://github.com/llvm/llvm-project/pull/139770.diff
1 Files Affected:
- (modified) llvm/lib/Support/CMakeLists.txt (+1)
``````````diff
diff --git a/llvm/lib/Support/CMakeLists.txt b/llvm/lib/Support/CMakeLists.txt
index df1e65f3a588c..a4c6dde6a57ff 100644
--- a/llvm/lib/Support/CMakeLists.txt
+++ b/llvm/lib/Support/CMakeLists.txt
@@ -113,6 +113,7 @@ if(LLVM_INTEGRATED_CRT_ALLOC)
add_compile_definitions(ENABLE_OVERRIDE ENABLE_PRELOAD)
set(ALLOCATOR_FILES "${LLVM_INTEGRATED_CRT_ALLOC}/rpmalloc/rpmalloc.c")
set(delayload_flags "${delayload_flags} ${WL}-INCLUDE:malloc")
+ string(STRIP ${delayload_flags} delayload_flags)
elseif(LLVM_INTEGRATED_CRT_ALLOC MATCHES "snmalloc$")
set(ALLOCATOR_FILES "${LLVM_INTEGRATED_CRT_ALLOC}/src/snmalloc/override/new.cc")
set(system_libs ${system_libs} "mincore.lib" "${WL}-INCLUDE:malloc")
``````````
</details>
https://github.com/llvm/llvm-project/pull/139770
More information about the llvm-commits
mailing list