[llvm] cmake: do not force building with the install name dir (PR #65656)

Ben Boeckel via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 7 11:57:20 PDT 2023


https://github.com/mathstuf created https://github.com/llvm/llvm-project/pull/65656:

When custom install names and rpaths setups are being used, they may not work in the build tree as-is (namely when using absolute paths for install names in order to avoid rpath juggling in downstream projects).

Use an undocumented flag to control this as it is fairly advanced.

See: https://reviews.llvm.org/D42463

---
I can add docs and a cache entry for this if wanted.

>From b1e4133df2d5c6eb910ec9e5f3b53da672d475d8 Mon Sep 17 00:00:00 2001
From: Ben Boeckel <ben.boeckel at kitware.com>
Date: Thu, 7 Sep 2023 14:49:58 -0400
Subject: [PATCH] cmake: do not force building with the install name dir

When custom install names and rpaths setups are being used, they may not
work in the build tree as-is (namely when using absolute paths for
install names in order to avoid rpath juggling in downstream projects).

Use an undocumented flag to control this as it is fairly advanced.

See: https://reviews.llvm.org/D42463
---
 llvm/CMakeLists.txt | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index 1103172d8bc6fe..9fbd5b3a129274 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -6,7 +6,12 @@ set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
 include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake
   NO_POLICY_SCOPE)
 
-set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON)
+# Builds with custom install names and installation rpath setups may not work
+# in the build tree. Allow these cases to use CMake's default build tree
+# behavior by setting `LLVM_USE_INSTALL_NAME_DIR_IN_BUILD_TREE` to do this.
+if (NOT LLVM_USE_INSTALL_NAME_DIR_IN_BUILD_TREE)
+  set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON)
+endif ()
 
 if(NOT DEFINED LLVM_VERSION_MAJOR)
   set(LLVM_VERSION_MAJOR 18)



More information about the llvm-commits mailing list