[llvm] Prevent CMake CMP0004 error (PR #132852)

via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 24 18:08:28 PDT 2025


https://github.com/peter23 created https://github.com/llvm/llvm-project/pull/132852

When `delayload_flags` is empty before this `set` then `delayload_flags` become equal to " ${WL}-INCLUDE:malloc" (with whitespace). And then it causes CMake error CMP0004 when used in `add_llvm_component_library(LLVMSupport ...`.

>From e3a431c7c942474d91673605177c6526f2e71ba3 Mon Sep 17 00:00:00 2001
From: peter23 <i at peter23.com>
Date: Tue, 25 Mar 2025 03:04:04 +0200
Subject: [PATCH] Prevent CMake CMP0004 error

---
 llvm/lib/Support/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Support/CMakeLists.txt b/llvm/lib/Support/CMakeLists.txt
index 2754c97fce6c1..f767826282002 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")
+    set(delayload_flags ${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