-
Notifications
You must be signed in to change notification settings - Fork 5
/
CMakeLists.txt
50 lines (39 loc) · 1.37 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
cmake_minimum_required(VERSION 3.18.0)
project(redGrapesExamplesAndTests VERSION 0.1.0)
########################################################
# Examples & Tests
########################################################
option(redGrapes_BUILD_EXAMPLES "Build the examples" ON)
option(BUILD_TESTING "Build the tests" OFF)
if(redGrapes_BUILD_EXAMPLES)
add_subdirectory("examples/")
endif()
if(BUILD_TESTING)
add_subdirectory("test/")
endif()
#########################################################
# Installation
#########################################################
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"
)
# 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}
)