-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
62 lines (47 loc) · 1.54 KB
/
CMakeLists.txt
File metadata and controls
62 lines (47 loc) · 1.54 KB
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
cmake_minimum_required(VERSION 3.10)
project(pcg-cpp VERSION 1.0 LANGUAGES CXX)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
# Header-only library
add_library(pcg-cpp INTERFACE)
add_library(pcg_cpp::pcg_cpp ALIAS pcg-cpp)
target_include_directories(pcg-cpp INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
target_compile_features(pcg-cpp INTERFACE cxx_std_11)
# Options
option(PCG_CPP_BUILD_SAMPLES "Build samples" ON)
option(PCG_CPP_BUILD_TESTS "Build tests" ON)
if(PCG_CPP_BUILD_TESTS)
enable_testing()
endif()
if(PCG_CPP_BUILD_SAMPLES)
add_subdirectory(sample)
endif()
if(PCG_CPP_BUILD_TESTS)
add_subdirectory(test-high)
endif()
# Installation
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(TARGETS pcg-cpp EXPORT pcg-cppTargets)
install(EXPORT pcg-cppTargets
FILE pcg-cppTargets.cmake
NAMESPACE pcg_cpp::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pcg-cpp
)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/pcg-cppConfigVersion.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion
)
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/pcg-cppConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/pcg-cppConfig.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pcg-cpp
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/pcg-cppConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/pcg-cppConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pcg-cpp
)