-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
24 lines (18 loc) · 1 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
cmake_minimum_required(VERSION 3.16)
project(ptr-tidy VERSION 1.0 LANGUAGES CXX)
# Disable in-source builds
if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message(FATAL_ERROR "FATAL: In-source builds are not allowed.")
endif ()
# So that GitHub build or with multiple LLVM installs, we find the latest installed version of libs
SET(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC)
SET(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL)
find_package(Clang REQUIRED)
add_executable(ptr-tidy src/main.cpp src/Callback.cpp src/IrHandler.cpp src/CaptureTracking.cpp src/PtrRewriter.cpp)
add_subdirectory(test)
foreach (target IN ITEMS ptr-tidy runTests)
set_target_properties("${target}" PROPERTIES CXX_STANDARD 20 CXX_STANDARD_REQUIRED True CXX_EXTENSIONS False INTERPROCEDURAL_OPTIMIZATION True)
target_compile_options("${target}" PRIVATE "-Wall" "-Wextra" "-pedantic")
target_include_directories("${target}" PUBLIC "${CLANG_INCLUDE_DIRS}")
target_link_libraries("${target}" PUBLIC clang-cpp LLVM)
endforeach ()