-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
67 lines (51 loc) · 1.63 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
cmake_minimum_required(VERSION 3.12)
project(flatbush VERSION 1.0.0 LANGUAGES CXX)
set(FLATBUSH_TARGET ${PROJECT_NAME})
option(WITH_SPAN "Use custom span if not available in the C++ standard" ON)
option(WITH_TESTS "Build unit tests" OFF)
option(WITH_BENCHMARKS "Build benchmarks" OFF)
include(GNUInstallDirs)
add_library(${FLATBUSH_TARGET} INTERFACE)
target_include_directories(${FLATBUSH_TARGET} INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>"
"$<INSTALL_INTERFACE:include>"
)
if(WITH_SPAN)
add_compile_options(-DFLATBUSH_SPAN)
endif()
if(WITH_BENCHMARKS)
set(bench_target bench)
add_executable(${bench_target} "bench.cpp")
endif()
if(WITH_TESTS)
set(test_target unit_test)
add_executable(${test_target} "test.cpp")
enable_testing()
add_test(NAME ${test_target} COMMAND ${test_target})
endif()
configure_file(
"cmake/configVersion.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
@ONLY
)
configure_file(
"cmake/config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
@ONLY
)
install(FILES flatbush.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(TARGETS ${PROJECT_NAME}
DESTINATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}"
EXPORT "${FLATBUSH_TARGET}Targets"
)
install(EXPORT "${FLATBUSH_TARGET}Targets"
NAMESPACE ${PROJECT_NAME}::
DESTINATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}"
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}"
)