mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-29 08:31:13 +00:00
Out of tree build support: Set TARGET_TRIPLE from the result of "llvm-config --host-target"
instead of loading the "LLVMConfig.cmake" which is only installed when llvm configured by cmake. llvm-svn: 153503
This commit is contained in:
parent
1fcf5bcae1
commit
b7c07f3c2e
@ -20,8 +20,23 @@ if (NOT DEFINED LLVM_MAIN_SRC_DIR)
|
||||
# Add the llvm header path.
|
||||
include_directories(${LLVM_INSTALL_ROOT}/include/)
|
||||
|
||||
# Load the configuration of the installed llvm.
|
||||
include(${LLVM_INSTALL_ROOT}/share/llvm/cmake/LLVMConfig.cmake)
|
||||
# Get the system librarys that will link into LLVM.
|
||||
function(get_system_libs return_var)
|
||||
# Returns in `return_var' a list of system libraries used by LLVM.
|
||||
if( NOT MSVC )
|
||||
if( MINGW )
|
||||
set(system_libs ${system_libs} imagehlp psapi)
|
||||
elseif( CMAKE_HOST_UNIX )
|
||||
if( HAVE_LIBDL )
|
||||
set(system_libs ${system_libs} ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
if( LLVM_ENABLE_THREADS AND HAVE_LIBPTHREAD )
|
||||
set(system_libs ${system_libs} pthread)
|
||||
endif()
|
||||
endif( MINGW )
|
||||
endif( NOT MSVC )
|
||||
set(${return_var} ${system_libs} PARENT_SCOPE)
|
||||
endfunction(get_system_libs)
|
||||
|
||||
# Now set the header paths.
|
||||
execute_process(COMMAND "${LLVM_INSTALL_ROOT}/bin/llvm-config" --includedir
|
||||
@ -29,6 +44,11 @@ if (NOT DEFINED LLVM_MAIN_SRC_DIR)
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
include_directories( ${LLVM_INCLUDE_DIR} )
|
||||
|
||||
# Get the TARGET_TRIPLE
|
||||
execute_process(COMMAND "${LLVM_INSTALL_ROOT}/bin/llvm-config" --host-target
|
||||
OUTPUT_VARIABLE TARGET_TRIPLE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
# And then set the cxx flags.
|
||||
execute_process(COMMAND "${LLVM_INSTALL_ROOT}/bin/llvm-config" --cxxflags
|
||||
OUTPUT_VARIABLE LLVM_CXX_FLAGS
|
||||
|
Loading…
Reference in New Issue
Block a user