mirror of
https://github.com/RPCS3/llvm.git
synced 2024-11-27 21:50:29 +00:00
[cmake] Don't build Native llvm-config when cross compiling if passed by user.
Summary: Rename LLVM_CONFIG_EXE to LLVM_CONFIG_PATH, and avoid building it if passed in by user. This is the same way CLANG_TABLEGEN and LLVM_TABLEGEN are handled, e.g., when -DLLVM_OPTIMIZED_TABLEGEN=ON is passed. Differential Revision: https://reviews.llvm.org/D41806 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323053 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2d05f76ffa
commit
18789ab5c4
@ -141,7 +141,7 @@ function(llvm_ExternalProject_Add name source_dir)
|
||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
-DCMAKE_AR=${CMAKE_AR}
|
||||
-DCMAKE_RANLIB=${CMAKE_RANLIB})
|
||||
set(llvm_config_path "${LLVM_NATIVE_BUILD}/bin/llvm-config")
|
||||
set(llvm_config_path ${LLVM_CONFIG_PATH})
|
||||
else()
|
||||
set(llvm_config_path "$<TARGET_FILE:llvm-config>")
|
||||
endif()
|
||||
|
@ -64,18 +64,17 @@ endif()
|
||||
# Add the dependency on the generation step.
|
||||
add_file_dependencies(${CMAKE_CURRENT_SOURCE_DIR}/llvm-config.cpp ${BUILDVARIABLES_OBJPATH})
|
||||
|
||||
if(CMAKE_CROSSCOMPILING)
|
||||
set(${project}_LLVM_CONFIG_EXE "${LLVM_NATIVE_BUILD}/bin/llvm-config")
|
||||
set(${project}_LLVM_CONFIG_EXE ${${project}_LLVM_CONFIG_EXE} PARENT_SCOPE)
|
||||
if(CMAKE_CROSSCOMPILING AND NOT LLVM_CONFIG_PATH)
|
||||
set(LLVM_CONFIG_PATH "${LLVM_NATIVE_BUILD}/bin/llvm-config" CACHE STRING "")
|
||||
|
||||
add_custom_command(OUTPUT "${${project}_LLVM_CONFIG_EXE}"
|
||||
add_custom_command(OUTPUT "${LLVM_CONFIG_PATH}"
|
||||
COMMAND ${CMAKE_COMMAND} --build . --target llvm-config --config $<CONFIGURATION>
|
||||
DEPENDS ${LLVM_NATIVE_BUILD}/CMakeCache.txt
|
||||
WORKING_DIRECTORY ${LLVM_NATIVE_BUILD}
|
||||
COMMENT "Building native llvm-config..."
|
||||
USES_TERMINAL)
|
||||
add_custom_target(${project}NativeLLVMConfig DEPENDS ${${project}_LLVM_CONFIG_EXE})
|
||||
add_dependencies(${project}NativeLLVMConfig CONFIGURE_LLVM_NATIVE)
|
||||
add_custom_target(NativeLLVMConfig DEPENDS ${LLVM_CONFIG_PATH})
|
||||
add_dependencies(NativeLLVMConfig CONFIGURE_LLVM_NATIVE)
|
||||
|
||||
add_dependencies(llvm-config ${project}NativeLLVMConfig)
|
||||
endif(CMAKE_CROSSCOMPILING)
|
||||
add_dependencies(llvm-config NativeLLVMConfig)
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user