-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
124 lines (100 loc) · 3.64 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
114
115
116
117
118
119
120
121
122
123
124
cmake_minimum_required(VERSION 3.16)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "cmake build type")
project(
coke
VERSION 0.4.0
LANGUAGES CXX
)
set(COKE_ENABLE_TEST FALSE CACHE BOOL "Whether to build and run tests, default FALSE")
set(COKE_ENABLE_BENCHMARK FALSE CACHE BOOL "Whether to build benchmarks, default FALSE")
set(COKE_ENABLE_EXAMPLE FALSE CACHE BOOL "Whether to build examples, default FALSE")
set(COKE_BUILD_STATIC TRUE CACHE BOOL "Whether to build coke static library, default TRUE")
set(COKE_BUILD_SHARED FALSE CACHE BOOL "Whether to build coke shared library, default FALSE")
set(COKE_LIBRARY ${PROJECT_NAME})
set(COKE_LIBRARY_DIR ${PROJECT_BINARY_DIR}/lib)
set(COKE_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include)
set(COKE_INSTALL_CMAKE_FILE ${PROJECT_BINARY_DIR}/${COKE_LIBRARY}-config.install.cmake)
set(COKE_LIBRARY_TARGETS ${COKE_LIBRARY}Targets)
set(COKE_STATIC_LIBRARY ${COKE_LIBRARY}-static)
set(COKE_SHARED_LIBRARY ${COKE_LIBRARY}-shared)
if (NOT "${CMAKE_CXX_STANDARD}")
set(CMAKE_CXX_STANDARD 20)
endif ()
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${COKE_LIBRARY_DIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${COKE_LIBRARY_DIR})
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter -Wno-interference-size")
elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter")
endif ()
if (NOT WORKFLOW_INCLUDE_DIR)
find_package(Workflow REQUIRED)
endif ()
find_package(OpenSSL REQUIRED)
find_package(Threads REQUIRED)
add_subdirectory(src)
if (COKE_ENABLE_EXAMPLE)
add_subdirectory(example)
endif ()
if (COKE_ENABLE_BENCHMARK)
add_subdirectory(benchmark)
endif()
if (COKE_ENABLE_TEST)
enable_testing()
add_subdirectory(test)
endif()
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
set(LIBRARY_NAME ${COKE_LIBRARY})
set(INCLUDE_DIR ${COKE_INCLUDE_DIR})
set(LIBRARY_DIR ${COKE_LIBRARY_DIR})
configure_package_config_file(
cmake/${COKE_LIBRARY}-config.cmake.in
${PROJECT_BINARY_DIR}/${COKE_LIBRARY}-config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${COKE_LIBRARY}
PATH_VARS INCLUDE_DIR LIBRARY_DIR LIBRARY_NAME
)
set(INCLUDE_DIR ${CMAKE_INSTALL_INCLUDEDIR})
set(LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR})
configure_package_config_file(
cmake/${COKE_LIBRARY}-config.install.cmake.in
${COKE_INSTALL_CMAKE_FILE}
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${COKE_LIBRARY}
PATH_VARS INCLUDE_DIR LIBRARY_DIR LIBRARY_NAME
)
if (COKE_BUILD_STATIC)
install(TARGETS
${COKE_STATIC_LIBRARY}
EXPORT ${COKE_LIBRARY_TARGETS}
LIBRARY DESTINATION lib
)
endif ()
if (COKE_BUILD_SHARED)
install(TARGETS
${COKE_SHARED_LIBRARY}
EXPORT ${COKE_LIBRARY_TARGETS}
LIBRARY DESTINATION lib
)
endif ()
install(EXPORT ${COKE_LIBRARY_TARGETS} FILE ${COKE_LIBRARY}-targets.cmake
NAMESPACE coke:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${COKE_LIBRARY}
)
install(DIRECTORY
${COKE_INCLUDE_DIR}/coke
DESTINATION include
)
install(FILES ${COKE_INSTALL_CMAKE_FILE}
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${COKE_LIBRARY}
RENAME ${COKE_LIBRARY}-config.cmake
)
set(CPACK_GENERATOR "RPM")
set(CPACK_PACKAGE_NAME "coke")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "coke: Coroutine Workflow based on C++ 20")
set(CPACK_PACKAGE_VENDOR "kedixa")
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
set(CPACK_RPM_PACKAGE_URL "https://github.com/kedixa/coke/")
set(CPACK_RPM_PACKAGE_LICENSE "Apache 2.0")
set(CPACK_RPM_FILE_NAME RPM-DEFAULT)
set(CPACK_RPM_PACKAGE_RELEASE_DIST ON)
set(CPACK_RPM_PACKAGE_RELEASE "0")
include(CPack)