[llvm] 4a4f0ff - Fixed cmake config in case of LLVM_ENABLE_RPMALLOC=ON and non MSVC compiler (#139770)

via llvm-commits llvm-commits at lists.llvm.org
Fri May 16 13:41:28 PDT 2025


Author: Dmitry Vasilyev
Date: 2025-05-17T00:41:25+04:00
New Revision: 4a4f0ffb5ba62428559f9d8d6f788505d350834f

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

LOG: Fixed cmake config in case of LLVM_ENABLE_RPMALLOC=ON and non MSVC compiler (#139770)

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.

Added: 
    

Modified: 
    llvm/lib/Support/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/CMakeLists.txt b/llvm/lib/Support/CMakeLists.txt
index df1e65f3a588c..241f3ebc95395 100644
--- a/llvm/lib/Support/CMakeLists.txt
+++ b/llvm/lib/Support/CMakeLists.txt
@@ -112,7 +112,7 @@ if(LLVM_INTEGRATED_CRT_ALLOC)
   if((LLVM_INTEGRATED_CRT_ALLOC MATCHES "rpmalloc$") OR LLVM_ENABLE_RPMALLOC)
     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")
+    list(APPEND delayload_flags "${WL}-INCLUDE:malloc")
   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")


        


More information about the llvm-commits mailing list