-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathCMakeLists.txt
83 lines (63 loc) · 1.65 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
cmake_minimum_required(VERSION 3.10)
# Project name
project(Quadtree VERSION 1.0 LANGUAGES CXX)
# Build type
set(CMAKE_BUILD_TYPE Release)
# Export compile commands (useful for editors)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Create library
add_library(quadtree INTERFACE)
target_include_directories(quadtree INTERFACE
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
# Set warnings
function(setWarnings target)
target_compile_options(${target} PRIVATE
-Wall
-Wextra
-Wshadow
-Wnon-virtual-dtor
-Wold-style-cast
-Wcast-align
-Wunused
-Woverloaded-virtual
-Wpedantic
-Wconversion
-Wsign-conversion
-Wmisleading-indentation
-Wduplicated-cond
-Wduplicated-branches
-Wlogical-op
-Wnull-dereference
-Wuseless-cast
-Wdouble-promotion)
endfunction()
# Set standard
function(setStandard target)
target_compile_features(${target} PRIVATE cxx_std_17)
endfunction()
# Benchmarks
option (BUILD_BENCHMARKS "Build the benchmarks." OFF)
if (BUILD_BENCHMARKS)
add_subdirectory(benchmarks)
endif()
# Examples
option (BUILD_EXAMPLES "Build the examples." ON)
if (BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
# Code coverage
option(CODE_COVERAGE "Enable coverage reporting" OFF)
if(CODE_COVERAGE)
target_compile_options(quadtree INTERFACE
-O0
-g
--coverage)
target_link_libraries(quadtree INTERFACE --coverage)
endif()
# Tests
option(BUILD_TESTING "Build the testing tree." OFF)
if (BUILD_TESTING)
enable_testing()
add_subdirectory(tests)
endif()