forked from ComputationalRadiationPhysics/redGrapes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
56 lines (45 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
cmake_minimum_required(VERSION 3.18.0)
project(redGrapesExamplesAndTests VERSION 0.1.0)
########################################################
# Examples & Tests
########################################################
option(redGrapes_BUILD_EXAMPLES "Build the examples" ON)
if(redGrapes_BUILD_EXAMPLES)
add_subdirectory("examples/")
endif()
if(BUILD_TESTING)
add_subdirectory("test/")
endif()
#########################################################
# Installation
#########################################################
option(redGrapes_USE_INTERNAL_OPTIONAL "use akrzemi's optional library for c++14" ON)
include(GNUInstallDirs)
set(CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/redGrapes"
CACHE PATH "CMake config package location for installed targets")
if(WIN32)
set_property(CACHE CMAKE_INSTALL_CMAKEDIR PROPERTY VALUE "cmake")
endif()
install(DIRECTORY "${redGrapes_SOURCE_DIR}/redGrapes"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN "*.hpp"
)
# install third-party libraries
if(redGrapes_USE_INTERNAL_OPTIONAL)
install(DIRECTORY "${redGrapes_SOURCE_DIR}/share/thirdParty/akrzemi/optional/include/akrzemi"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
endif()
# Version file
include(CMakePackageConfigHelpers)
write_basic_package_version_file("redGrapesConfigVersion.cmake"
VERSION ${redGrapes_VERSION}
COMPATIBILITY SameMajorVersion
)
# CMake package file for find_package() in depending projects
install(
FILES
${redGrapes_SOURCE_DIR}/redGrapesConfig.cmake
${redGrapes_BINARY_DIR}/redGrapesConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_CMAKEDIR}
)