forked from David-Haim/concurrencpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
113 lines (92 loc) · 4.03 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
109
110
111
112
113
cmake_minimum_required(VERSION 3.16)
project(concurrencpp
VERSION 0.0.8
LANGUAGES CXX)
include(cmake/coroutineOptions.cmake)
# ---- Warning guard ----
# Protect dependents from this project's warnings if the guard isn't disabled
set(concurrencpp_warning_guard "SYSTEM")
if(concurrencpp_INCLUDE_WITHOUT_SYSTEM)
set(concurrencpp_warning_guard "")
endif()
# ---- Declare library ----
set(concurrencpp_sources
source/executors/executor.cpp
source/executors/manual_executor.cpp
source/executors/thread_executor.cpp
source/executors/thread_pool_executor.cpp
source/executors/worker_thread_executor.cpp
source/results/promises.cpp
source/results/result_core.cpp
source/runtime/runtime.cpp
source/threads/thread.cpp
source/timers/timer.cpp
source/timers/timer_queue.cpp)
set(concurrencpp_headers
include/concurrencpp/concurrencpp.h
include/concurrencpp/errors.h
include/concurrencpp/forward_declerations.h
include/concurrencpp/platform_defs.h
include/concurrencpp/executors/constants.h
include/concurrencpp/executors/derivable_executor.h
include/concurrencpp/executors/executor.h
include/concurrencpp/executors/executor_all.h
include/concurrencpp/executors/inline_executor.h
include/concurrencpp/executors/manual_executor.h
include/concurrencpp/executors/thread_executor.h
include/concurrencpp/executors/thread_pool_executor.h
include/concurrencpp/executors/worker_thread_executor.h
include/concurrencpp/results/constants.h
include/concurrencpp/results/executor_exception.h
include/concurrencpp/results/make_result.h
include/concurrencpp/results/promises.h
include/concurrencpp/results/result.h
include/concurrencpp/results/result_awaitable.h
include/concurrencpp/results/result_core.h
include/concurrencpp/results/result_fwd_declerations.h
include/concurrencpp/results/when_result.h
include/concurrencpp/runtime/constants.h
include/concurrencpp/runtime/runtime.h
include/concurrencpp/threads/thread.h
include/concurrencpp/timers/constants.h
include/concurrencpp/timers/timer.h
include/concurrencpp/timers/timer_queue.h
include/concurrencpp/utils/bind.h)
add_library(concurrencpp STATIC ${concurrencpp_headers} ${concurrencpp_sources})
add_library(concurrencpp::concurrencpp ALIAS concurrencpp)
target_include_directories(concurrencpp
${concurrencpp_warning_guard}
PUBLIC
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>")
target_compile_features(concurrencpp PUBLIC cxx_std_20)
target_coroutine_options(concurrencpp)
find_library(LIBRT NAMES rt DOC "Path to the Real Time shared library")
target_link_libraries(concurrencpp PUBLIC "$<$<BOOL:${LIBRT}>:${LIBRT}>")
# ---- Install ----
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
set(concurrencpp_directory "concurrencpp-${PROJECT_VERSION}")
set(concurrencpp_include_directory "${CMAKE_INSTALL_INCLUDEDIR}/${concurrencpp_directory}")
install(TARGETS concurrencpp
EXPORT concurrencppTargets
ARCHIVE #
DESTINATION "${CMAKE_INSTALL_LIBDIR}"
COMPONENT concurrencpp_Development
INCLUDES #
DESTINATION "${concurrencpp_include_directory}")
set(concurrencpp_install_cmakedir
"${CMAKE_INSTALL_LIBDIR}/cmake/${concurrencpp_directory}")
write_basic_package_version_file(
concurrencppConfigVersion.cmake
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMinorVersion
ARCH_INDEPENDENT)
install(EXPORT concurrencppTargets
NAMESPACE concurrencpp::
DESTINATION "${concurrencpp_install_cmakedir}")
install(FILES
"${PROJECT_SOURCE_DIR}/cmake/concurrencppConfig.cmake"
"${PROJECT_BINARY_DIR}/concurrencppConfigVersion.cmake"
DESTINATION "${concurrencpp_install_cmakedir}")
install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/"
DESTINATION "${concurrencpp_include_directory}")