Pārlūkot izejas kodu

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.
Daniel Bertalan 3 gadi atpakaļ
vecāks
revīzija
36bd230ffa
1 mainītis faili ar 9 papildinājumiem un 4 dzēšanām
  1. 9 4
      Toolchain/CMake/LLVMRuntimesConfig.cmake

+ 9 - 4
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 "${SERENITY_TOOLCHAIN_ROOT}/bin/clang" CACHE PATH "")
 set(CMAKE_ASM_COMPILER_WORKS ON CACHE BOOL "")
 set(CMAKE_ASM_COMPILER_WORKS ON CACHE BOOL "")
 set(CMAKE_LINKER "${SERENITY_TOOLCHAIN_ROOT}/bin/ld.lld" CACHE PATH "")
 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_C_COMPILER_TARGET ${target_triple} CACHE STRING "")
 set(CMAKE_CXX_COMPILER_TARGET ${target_triple} CACHE STRING "")
 set(CMAKE_CXX_COMPILER_TARGET ${target_triple} CACHE STRING "")