-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
54 lines (42 loc) · 1.3 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.11)
project(stare VERSION 0.0.1 LANGUAGES CXX)
set(STARE_IS_MASTER_PROJECT OFF)
if (${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
set(STARE_IS_MASTER_PROJECT ON)
endif ()
option(STARE_TESTS "Build stare's unit tests" ${STARE_IS_MASTER_PROJECT})
if (STARE_TESTS)
enable_testing()
add_subdirectory(tests)
endif ()
include(CMakePackageConfigHelpers)
add_library(stare INTERFACE)
add_library(stare::stare ALIAS stare)
target_include_directories(
stare
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
target_compile_features(stare INTERFACE cxx_std_20)
# gcc9 requires -fconcepts to enable concepts
target_compile_options(stare INTERFACE
$<$<CXX_COMPILER_ID:GNU>:
$<$<VERSION_LESS:$<CXX_COMPILER_VERSION>,10.0.0>:
-fconcepts>>)
write_basic_package_version_file(
stareConfigVersion.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion)
install(
TARGETS stare
EXPORT stareConfig)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/stareConfigVersion.cmake
DESTINATION lib/cmake/stare)
install(
EXPORT stareConfig
NAMESPACE stare::
DESTINATION lib/cmake/stare)
install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include
DESTINATION .)