-
Notifications
You must be signed in to change notification settings - Fork 33
/
CMakeLists.txt
87 lines (74 loc) · 1.77 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#
# strong_type C++14/17/20 strong typedef library
#
# Copyright (C) Björn Fahller
#
# Use, modification and distribution is subject to the
# Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
# Project home: https://github.com/rollbear/strong_type
#
cmake_minimum_required(VERSION 3.14)
project(strong_type)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
option(STRONG_TYPE_UNIT_TEST off "Decide whether to build unit tests or not")
set(STRONG_TYPE_VERSION 15)
set(INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
set(MASTER_PROJECT OFF)
if (${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
set(MASTER_PROJECT ON)
endif()
if (${STRONG_TYPE_UNIT_TEST})
add_subdirectory(test)
endif()
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/strong_type/strong_type-config-version.cmake"
VERSION ${STRONG_TYPE_VERSION}
COMPATIBILITY AnyNewerVersion
ARCH_INDEPENDENT)
add_library(strong_type INTERFACE)
add_library(strong_type::strong_type ALIAS strong_type)
target_include_directories(
strong_type
INTERFACE
$<BUILD_INTERFACE:${INCLUDE_DIR}>
)
target_include_directories(
strong_type
INTERFACE
$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>
)
install(
TARGETS
strong_type
EXPORT
strong_type-targets
INCLUDES DESTINATION
include
)
install(
EXPORT
strong_type-targets
NAMESPACE
strong_type::
DESTINATION
lib/cmake/strong_type
)
install(
FILES
strong_type-config.cmake
"${CMAKE_CURRENT_BINARY_DIR}/strong_type/strong_type-config-version.cmake"
DESTINATION
lib/cmake/strong_type
COMPONENT
Devel
)
install(
DIRECTORY
"include/strong_type/"
DESTINATION
"${CMAKE_INSTALL_INCLUDEDIR}/strong_type"
)