summaryrefslogtreecommitdiff
path: root/Toolchain/CMake/LLVMRuntimesConfig.cmake
diff options
context:
space:
mode:
authorDaniel Bertalan <dani@danielbertalan.dev>2021-11-21 22:38:33 +0100
committerBrian Gianforcaro <b.gianfo@gmail.com>2021-11-28 09:38:57 -0800
commit36bd230ffa246ef45260e6f8b28379380f4e2da9 (patch)
tree60f122ec8fdde577fdb6e17440715dfb89c19d6e /Toolchain/CMake/LLVMRuntimesConfig.cmake
parente88ca09609017f5a8c5d3185376aa21172fab2e5 (diff)
downloadserenity-36bd230ffa246ef45260e6f8b28379380f4e2da9.zip
Toolchain/Clang: Fix CMake using utilities from the LLVM port
If we have the LLVM port installed, CMake might pick up some of the tools installed as part of it (`llvm-ar`, `llvm-strip`, etc.) instead of the ones belonging to the host toolchain. These, of course, can't be run on the host platform, so builds would eventually fail. This made it impossible to rebuild the LLVM toolchain. We now set these variables explicitly when compiling the LLVM runtime libraries in order to avoid this issue.
Diffstat (limited to 'Toolchain/CMake/LLVMRuntimesConfig.cmake')
-rw-r--r--Toolchain/CMake/LLVMRuntimesConfig.cmake13
1 files changed, 9 insertions, 4 deletions
diff --git a/Toolchain/CMake/LLVMRuntimesConfig.cmake b/Toolchain/CMake/LLVMRuntimesConfig.cmake
index cca7fc4949..6112fae2be 100644
--- a/Toolchain/CMake/LLVMRuntimesConfig.cmake
+++ b/Toolchain/CMake/LLVMRuntimesConfig.cmake
@@ -29,10 +29,15 @@ set(CMAKE_CXX_COMPILER_WORKS ON CACHE BOOL "")
set(CMAKE_ASM_COMPILER "${SERENITY_TOOLCHAIN_ROOT}/bin/clang" CACHE PATH "")
set(CMAKE_ASM_COMPILER_WORKS ON CACHE BOOL "")
set(CMAKE_LINKER "${SERENITY_TOOLCHAIN_ROOT}/bin/ld.lld" CACHE PATH "")
-foreach(tool ranlib;nm;objdump;objcopy;strip)
- string(TOUPPER tool Tool)
- set(CMAKE_${Tool} "${SERENITY_TOOLCHAIN_ROOT}/bin/llvm-${tool}" CACHE PATH "")
-endforeach()
+
+set(CMAKE_ADDR2LINE "${SERENITY_TOOLCHAIN_ROOT}/bin/llvm-addr2line" CACHE PATH "")
+set(CMAKE_AR "${SERENITY_TOOLCHAIN_ROOT}/bin/llvm-ar" CACHE PATH "")
+set(CMAKE_NM "${SERENITY_TOOLCHAIN_ROOT}/bin/llvm-nm" CACHE PATH "")
+set(CMAKE_OBJCOPY "${SERENITY_TOOLCHAIN_ROOT}/bin/llvm-objcopy" CACHE PATH "")
+set(CMAKE_OBJDUMP "${SERENITY_TOOLCHAIN_ROOT}/bin/llvm-objdump" CACHE PATH "")
+set(CMAKE_RANLIB "${SERENITY_TOOLCHAIN_ROOT}/bin/llvm-ranlib" CACHE PATH "")
+set(CMAKE_READELF "${SERENITY_TOOLCHAIN_ROOT}/bin/llvm-readelf" CACHE PATH "")
+set(CMAKE_STRIP "${SERENITY_TOOLCHAIN_ROOT}/bin/llvm-strip" CACHE PATH "")
set(CMAKE_C_COMPILER_TARGET ${target_triple} CACHE STRING "")
set(CMAKE_CXX_COMPILER_TARGET ${target_triple} CACHE STRING "")