[llvm] [compiler-rt] Pass the CMake binary dir directly (PR #102493)

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 8 08:47:41 PDT 2024


https://github.com/jhuber6 created https://github.com/llvm/llvm-project/pull/102493

Summary:
The usage of `LLVM_CMAKE_DIR` is confusing in CMake, because in LLVM it
refers to `llvm/cmake/modules/` while compiler-rt wants the `build/` dir
for finding LLVM. THis passes it manually.


>From fc4093c325c1a595c5c5315918c2260adaa2a7bb Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Thu, 8 Aug 2024 10:35:52 -0500
Subject: [PATCH] [compiler-rt] Pass the CMake binary dir directly

Summary:
The usage of `LLVM_CMAKE_DIR` is confusing in CMake, because in LLVM it
refers to `llvm/cmake/modules/` while compiler-rt wants the `build/` dir
for finding LLVM. THis passes it manually.
---
 llvm/runtimes/CMakeLists.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt
index 42b1b86ebaadf0..5a4435bc96e0c8 100644
--- a/llvm/runtimes/CMakeLists.txt
+++ b/llvm/runtimes/CMakeLists.txt
@@ -89,6 +89,7 @@ function(builtin_default_target compiler_rt_path)
                                       -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
                                       -DLLVM_DEFAULT_TARGET_TRIPLE=${LLVM_TARGET_TRIPLE}
                                       -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=${LLVM_ENABLE_PER_TARGET_RUNTIME_DIR}
+                                      -DLLVM_CMAKE_DIR=${CMAKE_BINARY_DIR}
                                       -DCMAKE_C_COMPILER_WORKS=ON
                                       -DCMAKE_ASM_COMPILER_WORKS=ON
                                       ${COMMON_CMAKE_ARGS}
@@ -128,6 +129,7 @@ function(builtin_register_target compiler_rt_path name)
                            CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR}
                                       -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR}
                                       -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON
+                                      -DLLVM_CMAKE_DIR=${CMAKE_BINARY_DIR}
                                       -DCMAKE_C_COMPILER_WORKS=ON
                                       -DCMAKE_ASM_COMPILER_WORKS=ON
                                       -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON



More information about the llvm-commits mailing list