[llvm] c1ce21b - cmake: allow disabling building with the install name directory
via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 1 06:15:20 PDT 2023
Author: Ben Boeckel
Date: 2023-10-01T16:15:15+03:00
New Revision: c1ce21b450fd9607c3b44acd520f4e449c6a9a89
URL: https://github.com/llvm/llvm-project/commit/c1ce21b450fd9607c3b44acd520f4e449c6a9a89
DIFF: https://github.com/llvm/llvm-project/commit/c1ce21b450fd9607c3b44acd520f4e449c6a9a89.diff
LOG: cmake: allow disabling building with the install name directory
When custom install names and rpaths setups are 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).
Add a flag for opting out of this behaviour.
See: https://reviews.llvm.org/D42463
Added:
Modified:
llvm/CMakeLists.txt
llvm/docs/CMake.rst
Removed:
################################################################################
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index 7b49ec161c3f3bf..6b10af40d202f72 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -6,7 +6,14 @@ 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_NO_INSTALL_NAME_DIR_FOR_BUILD_TREE` to do this.
+option(LLVM_NO_INSTALL_NAME_DIR_FOR_BUILD_TREE "If set, use CMake's default build tree install name directory logic (Darwin only)" OFF)
+mark_as_advanced(LLVM_NO_INSTALL_NAME_DIR_FOR_BUILD_TREE)
+if(NOT LLVM_NO_INSTALL_NAME_DIR_FOR_BUILD_TREE)
+ set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON)
+endif()
if(NOT DEFINED LLVM_VERSION_MAJOR)
set(LLVM_VERSION_MAJOR 18)
diff --git a/llvm/docs/CMake.rst b/llvm/docs/CMake.rst
index 668c5e7092e1c34..c70b6b8206c2f92 100644
--- a/llvm/docs/CMake.rst
+++ b/llvm/docs/CMake.rst
@@ -733,6 +733,13 @@ enabled sub-projects. Nearly all of these variable names begin with
directory contains executables with the expected names, no separate
native versions of those executables will be built.
+**LLVM_NO_INSTALL_NAME_DIR_FOR_BUILD_TREE**:BOOL
+ Defaults to ``OFF``. If set to ``ON``, CMake's default logic for library IDs
+ on Darwin in the build tree will be used. Otherwise the install-time library
+ IDs will be used in the build tree as well. Mainly useful when other CMake
+ library ID control variables (e.g., ``CMAKE_INSTALL_NAME_DIR``) are being
+ set to non-standard values.
+
**LLVM_OPTIMIZED_TABLEGEN**:BOOL
If enabled and building a debug or asserts build the CMake build system will
generate a Release build tree to build a fully optimized tablegen for use
More information about the llvm-commits
mailing list