-
Notifications
You must be signed in to change notification settings - Fork 7
/
CMakeLists.txt
108 lines (87 loc) · 4.46 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
cmake_minimum_required(VERSION 3.8)
project(NotEnoughStandards VERSION 1.0.2)
option(BUILD_EXAMPLES "Build Not Enough Standards' examples" OFF)
option(BUILD_TESTING "Build Not Enough Standards' tests" OFF)
add_library(NotEnoughStandards INTERFACE)
set_target_properties(NotEnoughStandards PROPERTIES CXX_STANDARD 20)
target_include_directories(NotEnoughStandards INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_sources(NotEnoughStandards INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/nes/shared_library.hpp>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/nes/shared_memory.hpp>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/nes/named_mutex.hpp>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/nes/semaphore.hpp>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/nes/named_semaphore.hpp>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/nes/pipe.hpp>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/nes/process.hpp>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/nes/hash.hpp>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include/nes/thread_pool.hpp>
)
if(UNIX)
target_link_libraries(NotEnoughStandards INTERFACE dl)
if(NOT CMAKE_SYSTEM_NAME STREQUAL ANDROID)
target_link_libraries(NotEnoughStandards INTERFACE pthread rt)
endif()
endif()
if(BUILD_EXAMPLES)
add_executable(NotEnoughStandardsExample main.cpp)
set_target_properties(NotEnoughStandardsExample PROPERTIES CXX_STANDARD 20)
set_target_properties(NotEnoughStandardsExample PROPERTIES CXX_STANDARD_REQUIRED ON)
target_link_libraries(NotEnoughStandardsExample NotEnoughStandards)
if(UNIX)
target_link_libraries(NotEnoughStandardsExample -rdynamic)
endif()
add_executable(NotEnoughStandardsExampleOther other.cpp)
set_target_properties(NotEnoughStandardsExampleOther PROPERTIES CXX_STANDARD 20)
set_target_properties(NotEnoughStandardsExampleOther PROPERTIES CXX_STANDARD_REQUIRED ON)
target_link_libraries(NotEnoughStandardsExampleOther NotEnoughStandards)
endif()
if(BUILD_TESTING)
add_executable(NotEnoughStandardsTest tests/common.hpp tests/process.cpp)
set_target_properties(NotEnoughStandardsTest PROPERTIES CXX_STANDARD 20)
set_target_properties(NotEnoughStandardsTest PROPERTIES CXX_STANDARD_REQUIRED ON)
target_link_libraries(NotEnoughStandardsTest NotEnoughStandards)
add_executable(NotEnoughStandardsTestOther tests/common.hpp tests/process_other.cpp)
set_target_properties(NotEnoughStandardsTestOther PROPERTIES CXX_STANDARD 20)
set_target_properties(NotEnoughStandardsTestOther PROPERTIES CXX_STANDARD_REQUIRED ON)
target_link_libraries(NotEnoughStandardsTestOther NotEnoughStandards)
add_library(NotEnoughStandardsTestLib SHARED tests/common.hpp tests/library.cpp)
set_target_properties(NotEnoughStandardsTestLib PROPERTIES PREFIX "")
set_target_properties(NotEnoughStandardsTestLib PROPERTIES CXX_STANDARD 20)
set_target_properties(NotEnoughStandardsTestLib PROPERTIES CXX_STANDARD_REQUIRED ON)
target_link_libraries(NotEnoughStandardsTestLib NotEnoughStandards)
enable_testing()
add_test(NAME NotEnoughStandardsTest COMMAND NotEnoughStandardsTest)
get_property(multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(multi_config)
set_tests_properties(NotEnoughStandardsTest PROPERTIES WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>)
endif()
endif()
include(CMakePackageConfigHelpers)
configure_package_config_file(
${PROJECT_SOURCE_DIR}/cmake/NotEnoughStandards.cmake.in
${PROJECT_BINARY_DIR}/NotEnoughStandardsConfig.cmake
INSTALL_DESTINATION lib/cmake/NotEnoughStandards
)
write_basic_package_version_file(
${PROJECT_BINARY_DIR}/NotEnoughStandardsConfigVersion.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion
)
install(TARGETS NotEnoughStandards
EXPORT NotEnoughStandardsTargets
PUBLIC_HEADER DESTINATION include COMPONENT Development
)
install(EXPORT NotEnoughStandardsTargets
DESTINATION lib/cmake/NotEnoughStandards
NAMESPACE NotEnoughStandards::
)
install(FILES ${PROJECT_BINARY_DIR}/NotEnoughStandardsConfigVersion.cmake
${PROJECT_BINARY_DIR}/NotEnoughStandardsConfig.cmake
DESTINATION lib/cmake/NotEnoughStandards
)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/
DESTINATION include
)