-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
34 lines (30 loc) · 1001 Bytes
/
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
25
26
27
28
29
30
31
32
33
34
# project config
cmake_minimum_required(VERSION 3.5)
project(dropgrowth VERSION 0.1.0 LANGUAGES CXX)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/externals/sanitizers-cmake/cmake" ${CMAKE_MODULE_PATH})
set(SRC src/Droplet.cpp src/main.cpp)
find_package(Sanitizers)
# executable
add_executable(dropgrowth ${SRC})
target_compile_features(dropgrowth PRIVATE cxx_std_11)
set_target_properties(dropgrowth PROPERTIES POSITION_INDEPENDENT_CODE ON)
add_sanitizers(dropgrowth)
# OpenCV
find_package(OpenCV QUIET)
if(OpenCV_FOUND)
message("Build with OpenCV")
target_compile_definitions(dropgrowth PUBLIC USE_OPENCV)
target_link_libraries(dropgrowth "opencv_core" "opencv_videoio" "opencv_highgui")
else(OpenCV_FOUND)
message("Build without OpenCV")
endif(OpenCV_FOUND)
# clang format
file(GLOB_RECURSE ALL_SOURCE_FILES src/*.cpp src/*.h)
add_custom_target(
format
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND clang-format
-style=file
-i
${ALL_SOURCE_FILES}
)