[llvm] r334136 - [CMake] Pass additional CMake tools to external projects
Petr Hosek via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 6 14:43:37 PDT 2018
Author: phosek
Date: Wed Jun 6 14:43:37 2018
New Revision: 334136
URL: http://llvm.org/viewvc/llvm-project?rev=334136&view=rev
Log:
[CMake] Pass additional CMake tools to external projects
This is needed when the external projects try to use other tools
besides just the compiler and the linker.
Differential Revision: https://reviews.llvm.org/D47833
Modified:
llvm/trunk/cmake/modules/LLVMExternalProjectUtils.cmake
llvm/trunk/runtimes/CMakeLists.txt
Modified: llvm/trunk/cmake/modules/LLVMExternalProjectUtils.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/LLVMExternalProjectUtils.cmake?rev=334136&r1=334135&r2=334136&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/LLVMExternalProjectUtils.cmake (original)
+++ llvm/trunk/cmake/modules/LLVMExternalProjectUtils.cmake Wed Jun 6 14:43:37 2018
@@ -46,7 +46,7 @@ function(llvm_ExternalProject_Add name s
if(NOT ARG_TOOLCHAIN_TOOLS)
set(ARG_TOOLCHAIN_TOOLS clang lld)
if(NOT APPLE AND NOT WIN32)
- list(APPEND ARG_TOOLCHAIN_TOOLS llvm-ar llvm-ranlib)
+ list(APPEND ARG_TOOLCHAIN_TOOLS llvm-ar llvm-ranlib llvm-nm llvm-objcopy llvm-objdump llvm-strip)
endif()
endif()
foreach(tool ${ARG_TOOLCHAIN_TOOLS})
@@ -107,12 +107,27 @@ function(llvm_ExternalProject_Add name s
set(compiler_args -DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang
-DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++)
endif()
+ if(lld IN_LIST TOOLCHAIN_TOOLS)
+ list(APPEND compiler_args -DCMAKE_LINKER=${LLVM_RUNTIME_OUTPUT_INTDIR}/ld.lld)
+ endif()
if(llvm-ar IN_LIST TOOLCHAIN_TOOLS)
list(APPEND compiler_args -DCMAKE_AR=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ar)
endif()
if(llvm-ranlib IN_LIST TOOLCHAIN_TOOLS)
list(APPEND compiler_args -DCMAKE_RANLIB=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ranlib)
endif()
+ if(llvm-nm IN_LIST TOOLCHAIN_TOOLS)
+ list(APPEND compiler_args -DCMAKE_NM=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-nm)
+ endif()
+ if(llvm-objdump IN_LIST TOOLCHAIN_TOOLS)
+ list(APPEND compiler_args -DCMAKE_OBJDUMP=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-objdump)
+ endif()
+ if(llvm-objcopy IN_LIST TOOLCHAIN_TOOLS)
+ list(APPEND compiler_args -DCMAKE_OBJCOPY=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-objcopy)
+ endif()
+ if(llvm-strip IN_LIST TOOLCHAIN_TOOLS)
+ list(APPEND compiler_args -DCMAKE_STRIP=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-strip)
+ endif()
list(APPEND ARG_DEPENDS ${TOOLCHAIN_TOOLS})
endif()
@@ -139,8 +154,13 @@ function(llvm_ExternalProject_Add name s
if(CMAKE_CROSSCOMPILING)
set(compiler_args -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
+ -DCMAKE_LINKER=${CMAKE_LINKER}
-DCMAKE_AR=${CMAKE_AR}
- -DCMAKE_RANLIB=${CMAKE_RANLIB})
+ -DCMAKE_RANLIB=${CMAKE_RANLIB}
+ -DCMAKE_NM=${CMAKE_NM}
+ -DCMAKE_OBJCOPY=${CMAKE_OBJCOPY}
+ -DCMAKE_OBJDUMP=${CMAKE_OBJDUMP}
+ -DCMAKE_STRIP=${CMAKE_STRIP})
set(llvm_config_path ${LLVM_CONFIG_PATH})
else()
set(llvm_config_path "$<TARGET_FILE:llvm-config>")
Modified: llvm/trunk/runtimes/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/runtimes/CMakeLists.txt?rev=334136&r1=334135&r2=334136&view=diff
==============================================================================
--- llvm/trunk/runtimes/CMakeLists.txt (original)
+++ llvm/trunk/runtimes/CMakeLists.txt Wed Jun 6 14:43:37 2018
@@ -285,7 +285,7 @@ else() # if this is included from LLVM's
-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON
${${target}_extra_args}
PASSTHROUGH_PREFIXES CLANG_DEFAULT
- TOOLCHAIN_TOOLS clang lld llvm-ar llvm-ranlib
+ TOOLCHAIN_TOOLS clang lld llvm-ar llvm-ranlib llvm-nm llvm-objcopy llvm-objdump llvm-strip
USE_TOOLCHAIN
${EXTRA_ARGS})
endfunction()
@@ -463,7 +463,7 @@ else() # if this is included from LLVM's
${${name}_extra_args}
PASSTHROUGH_PREFIXES LLVM_ENABLE_RUNTIMES
CLANG_DEFAULT
- TOOLCHAIN_TOOLS clang lld llvm-ar llvm-ranlib
+ TOOLCHAIN_TOOLS clang lld llvm-ar llvm-ranlib llvm-nm llvm-objcopy llvm-objdump llvm-strip
EXTRA_TARGETS ${${name}_extra_targets}
${${name}_test_targets}
USE_TOOLCHAIN
More information about the llvm-commits
mailing list