Skip to content

Commit

Permalink
update CMakeList to allow pass a relative path for llvm-config
Browse files Browse the repository at this point in the history
  • Loading branch information
drcut committed Aug 6, 2024
1 parent 40b5ad1 commit 70168ce
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,24 @@ set(CMAKE_PROJECT_DESCRIPTION "Executing CUDA on non-NVIDIA architecture.")
set(CMAKE_CXX_STANDARD "14")

if(DEFINED LLVM_CONFIG_PATH)
if(IS_ABSOLUTE "${LLVM_CONFIG_PATH}")
if(EXISTS "${LLVM_CONFIG_PATH}")
set(LLVM_CONFIG "${LLVM_CONFIG_PATH}")
else()
message(FATAL_ERROR "llvm-config is not found in ${LLVM_CONFIG_PATH}")
endif()
message(STATUS "Using llvm-config: ${LLVM_CONFIG}")
execute_process(
COMMAND "${LLVM_CONFIG}" "--cxxflags"
OUTPUT_VARIABLE LLVM_CXX_FLAG
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
COMMAND "${LLVM_CONFIG}" "--libdir"
OUTPUT_VARIABLE LLVM_LIB_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
COMMAND "${LLVM_CONFIG}" "--libs"
OUTPUT_VARIABLE LLVM_LINK_FLAG
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(EXISTS "${LLVM_CONFIG_PATH}")
set(LLVM_CONFIG "${LLVM_CONFIG_PATH}")
else()
message(FATAL_ERROR "llvm-config is not found in ${LLVM_CONFIG_PATH}")
endif()
message(STATUS "Using llvm-config: ${LLVM_CONFIG}")
execute_process(
COMMAND "${LLVM_CONFIG}" "--cxxflags"
OUTPUT_VARIABLE LLVM_CXX_FLAG
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
COMMAND "${LLVM_CONFIG}" "--libdir"
OUTPUT_VARIABLE LLVM_LIB_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
COMMAND "${LLVM_CONFIG}" "--libs"
OUTPUT_VARIABLE LLVM_LINK_FLAG
OUTPUT_STRIP_TRAILING_WHITESPACE)
else()
message(FATAL_ERROR "llvm-config is required")
endif()
Expand Down

0 comments on commit 70168ce

Please sign in to comment.