1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
find_package(Clang QUIET)
if (NOT Clang_FOUND)
message(STATUS "Clang was not found, not building strings_tool")
return()
endif()
add_executable(strings_tool EXCLUDE_FROM_ALL strings_tool.cpp)
set_target_properties(strings_tool
PROPERTIES
FOLDER "Tools"
)
target_link_libraries(strings_tool
PRIVATE
clangTooling
clangBasic
clangASTMatchers
clangAST
clangFrontend
LLVM
platform
compiler
)
# AddressSanitizer causes problems in LibTooling classes
string(REGEX REPLACE "-fsanitize=[a-zA-Z0-9,]+" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REGEX REPLACE "-fsanitize=[a-zA-Z0-9,]+" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
find_package(Boost COMPONENTS regex)
if (Boost_FOUND)
# Prefer to use boost::regex since the GCC implementation of std::regex is still buggy in version 7
target_compile_definitions(strings_tool PRIVATE USE_BOOST_REGEX)
target_link_libraries(strings_tool PRIVATE Boost::regex)
endif()
|