-
Notifications
You must be signed in to change notification settings - Fork 8
/
CMakeLists.txt
54 lines (39 loc) · 1.15 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
cmake_minimum_required(VERSION 3.10)
project(absent LANGUAGES CXX)
# Definition
option(BUILD_TESTS "Build test executable" OFF)
add_library(${PROJECT_NAME} INTERFACE)
add_library(rvarago::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
target_include_directories(${PROJECT_NAME}
INTERFACE
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)
target_compile_features(${PROJECT_NAME}
INTERFACE
cxx_std_17
)
# Installation
include(GNUInstallDirs)
# Generate the config file with the target
install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}Config
)
install(DIRECTORY include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
# Make the target be importable from the installation directory
install(EXPORT ${PROJECT_NAME}Config
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
NAMESPACE rvarago::
)
# Make the target be importable from the build directory via package registry
export(EXPORT ${PROJECT_NAME}Config
NAMESPACE rvarago::
)
export(PACKAGE ${PROJECT_NAME})
# Tests
if(BUILD_TESTS)
include(CTest)
add_subdirectory(tests)
endif()