-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
92 lines (65 loc) · 2.51 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
88
89
90
91
92
cmake_minimum_required(VERSION 3.15.0)
set(_7BIT_DI_LIBRARY 7bitDI)
set(_7BIT_DI_VERSION_MAJOR 3)
set(_7BIT_DI_VERSION_MINOR 4)
set(_7BIT_DI_VERSION_PATCH 0)
set(_7BIT_DI_VERSION ${_7BIT_DI_VERSION_MAJOR}.${_7BIT_DI_VERSION_MINOR}.${_7BIT_DI_VERSION_PATCH})
project(${_7BIT_DI_LIBRARY} LANGUAGES CXX VERSION ${_7BIT_DI_VERSION})
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/Cmake")
if (NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif ()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(Setup)
include(CMakeDependentOption)
include(GNUInstallDirs)
include_directories(${_7BIT_DI_INCLUDE_DIR})
add_subdirectory(Source)
if (_7BIT_DI_BUILD_UNIT_TESTS OR _7BIT_DI_BUILD_INTEGRATION_TESTS OR _7BIT_DI_BUILD_E2E_TESTS)
enable_testing()
add_subdirectory(Tests)
endif ()
if (_7BIT_DI_BUILD_DOCS)
add_subdirectory(Docs)
endif ()
if (_7BIT_DI_BUILD_EXAMPLES)
add_subdirectory(Examples)
endif ()
if (_7BIT_DI_BUILD_BENCHMARKS)
add_subdirectory(Benchmarks)
endif ()
if (_7BIT_DI_BUILD_SINGLE_HEADER)
add_subdirectory(SingleHeader)
endif ()
if (_7BIT_DI_INSTALL)
set(PROJECT_CONFIG_IN ${CMAKE_CURRENT_SOURCE_DIR}/Cmake/7bitDIConfig.cmake.in)
set(PROJECT_CONFIG_OUT ${CMAKE_CURRENT_BINARY_DIR}/7bitDIConfig.cmake)
set(CONFIG_TARGETS_FILE 7bitDIConfigTargets.cmake)
set(VERSIONS_CONFIG_FILE ${CMAKE_CURRENT_BINARY_DIR}/7bitDIConfigVersion.cmake)
set(EXPORT_DEST_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/7bitDI)
install(DIRECTORY ${_7BIT_DI_INCLUDE_DIR}/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(
TARGETS 7bitDI
EXPORT 7bitDI
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
export(
TARGETS 7bitDI
NAMESPACE 7bitDI::
FILE ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_TARGETS_FILE})
install(
EXPORT 7bitDI
EXPORT 7bitDI
DESTINATION ${EXPORT_DEST_DIR}
NAMESPACE 7bitDI::
NAMESPACE 7bitDI::
FILE ${CONFIG_TARGETS_FILE})
include(CMakePackageConfigHelpers)
configure_package_config_file(${PROJECT_CONFIG_IN} ${PROJECT_CONFIG_OUT}
INSTALL_DESTINATION ${EXPORT_DEST_DIR})
write_basic_package_version_file(${VERSIONS_CONFIG_FILE} COMPATIBILITY SameMajorVersion)
install(FILES ${PROJECT_CONFIG_OUT} ${VERSIONS_CONFIG_FILE} DESTINATION ${EXPORT_DEST_DIR})
export(PACKAGE 7bitDI)
include(CPack)
endif ()