forked from OSchip/llvm-project
[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 llvm-svn: 334136
This commit is contained in:
parent
08d1640535
commit
0acc024d7a
|
@ -46,7 +46,7 @@ function(llvm_ExternalProject_Add name source_dir)
|
|||
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 source_dir)
|
|||
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 source_dir)
|
|||
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>")
|
||||
|
|
|
@ -285,7 +285,7 @@ else() # if this is included from LLVM's CMake
|
|||
-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 CMake
|
|||
${${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
|
||||
|
|
Loading…
Reference in New Issue