diff options
-rw-r--r-- | CMakeLists.txt | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 859b017..72507d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,11 @@ cmake_minimum_required(VERSION 3.14.5) project(cgrep VERSION 1.1) -set(CMAKE_CXX_COMPILER clang++) +# set(CMAKE_CXX_COMPILER clang++-10 CACHE STRING "set the actual name of clang++, i.e. clang++-10" FORCE) +# set(CMAKE_CXX_COMPILER clang++-10) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED True) -set(LLVM_CONF llvm-config) +set(LLVM_CONF llvm-config-10 CACHE STRING "set the actual name of llvm-config, i.e. llvm-config-10") function(CleanMessage) execute_process(COMMAND ${CMAKE_COMMAND} -E echo "${ARGN}") @@ -18,6 +19,8 @@ string(REGEX REPLACE "\n$" "" LLVM_CXX_FLAGS "${LLVM_CXX_FLAGS}") # string(REGEX REPLACE "\n$" "" LLVM_SRC_ROOT "${LLVM_SRC_ROOT}") # execute_process(COMMAND ${LLVM_CONF} --obj-root OUTPUT_VARIABLE LLVM_OBJ_ROOT) # string(REGEX REPLACE "\n$" "" LLVM_OBJ_ROOT "${LLVM_OBJ_ROOT}") +execute_process(COMMAND ${LLVM_CONF} --libdir OUTPUT_VARIABLE LLVM_LIB_DIR) +string(REGEX REPLACE "\n" "" LLVM_LIB_DIR "${LLVM_LIB_DIR}") execute_process(COMMAND ${LLVM_CONF} --ldflags OUTPUT_VARIABLE LLVM_LD_FLAGS) string(REGEX REPLACE "\n" "" LLVM_LD_FLAGS "${LLVM_LD_FLAGS}") execute_process(COMMAND ${LLVM_CONF} --libs OUTPUT_VARIABLE LLVM_LIBS) @@ -28,7 +31,7 @@ string(REGEX REPLACE "\n$" "" LLVM_SYS_LIBS "${LLVM_SYS_LIBS}") string(REGEX REPLACE "^-l" "" LLVM_SYS_LIBS "${LLVM_SYS_LIBS}") add_compile_options(${LLVM_CXX_FLAGS}) -add_compile_options(-I"${LLVM_INC_DIR}") +add_compile_options(-I${LLVM_INC_DIR}) # add_compile_options(-I"${LLVM_SRC_ROOT}/tools/clang/include") # add_compile_options(-I"${LLVM_OBJ_ROOT}/tools/clang/include") @@ -37,11 +40,12 @@ set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}) set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}) add_link_options(${LLVM_LD_FLAGS}) +add_link_options(-L${LLVM_LIB_DIR}) add_executable(cgrep cgrep.cpp ${CMAKE_SOURCE_DIR}/cfe-extra/cfe_extra.cpp) option(USE_MONOLITH_LIBTOOLING "use libtooling built into a single library" OFF) if (USE_MONOLITH_LIBTOOLING) - target_link_libraries(cgrep libclang-cpp) + target_link_libraries(cgrep clang-cpp) else() target_link_libraries(cgrep -Wl,--start-group clangAST clangAnalysis clangBasic clangDriver clangEdit clangFrontend clangFrontendTool clangLex clangParse clangSema clangEdit clangASTMatchers clangRewrite clangRewriteFrontend clangStaticAnalyzerFrontend clangStaticAnalyzerCheckers clangStaticAnalyzerCore clangSerialization clangToolingCore clangTooling stdc++ LLVMRuntimeDyld m -Wl,--end-group) endif() |