Skip to content

Commit abb9563

Browse files
committed
[CMake] Enable LLVM_ENABLE_PER_TARGET_RUNTIME_DIR by default on Linux
This makes the default build closer to a -DLLVM_ENABLE_RUNTIMES=all build. The layout is arguably superior because different libraries of target triples are in different directories, similar to GCC/Debian multiarch. When LLVM_DEFAULT_TARGET_TRIPLE is x86_64-unknown-linux-gnu, `lib/clang/14.0.0/lib/libclang_rt.asan-x86_64.a` becomes `lib/clang/14.0.0/lib/x86_64-unknown-linux-gnu/libclang_rt.asan.a`. Clang has been detecting both paths since 2018 (D50547). --- Note: Darwin needs to be disabled. The hierarchy needs to be sorted out. The current -DLLVM_DEFAULT_TARGET_TRIPLE=off state is like: ``` lib/clang/14.0.0/lib/darwin/libclang_rt.profile_ios.a lib/clang/14.0.0/lib/darwin/libclang_rt.profile_iossim.a lib/clang/14.0.0/lib/darwin/libclang_rt.profile_osx.a ``` Windows needs to be disabled: https://reviews.llvm.org/D107799?id=368557#2963311 Differential Revision: https://reviews.llvm.org/D107799
1 parent 30c2884 commit abb9563

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

llvm/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,12 @@ endif()
671671
set(LLVM_TARGET_TRIPLE_ENV CACHE STRING "The name of environment variable to override default target. Disabled by blank.")
672672
mark_as_advanced(LLVM_TARGET_TRIPLE_ENV)
673673

674-
set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF CACHE BOOL
674+
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
675+
set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default ON)
676+
else()
677+
set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default OFF)
678+
endif()
679+
set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR ${LLVM_ENABLE_PER_TARGET_RUNTIME_DIR_default} CACHE BOOL
675680
"Enable per-target runtimes directory")
676681

677682
set(LLVM_PROFDATA_FILE "" CACHE FILEPATH

0 commit comments

Comments
 (0)