-
Notifications
You must be signed in to change notification settings - Fork 7
/
CMakeLists.txt
48 lines (36 loc) · 1.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
cmake_minimum_required(VERSION 3.10)
project(dear LANGUAGES CXX VERSION 0.0.1)
# require C++17
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
find_package(reactor-cpp REQUIRED)
find_package(Threads REQUIRED)
set(DEFAULT_BUILD_TYPE "Release")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${DEFAULT_BUILD_TYPE}' as none was specified.")
set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}" CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
include(GNUInstallDirs)
set(SOURCE_FILES
lib/time_context.cc
)
add_library(dear SHARED ${SOURCE_FILES})
target_include_directories(dear PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE lib)
target_compile_options(dear PRIVATE -Wall -Wextra -pedantic -Werror)
target_link_libraries(dear reactor-cpp ${CMAKE_THREAD_LIBS_INIT})
set_target_properties(dear PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION 1)
install(TARGETS dear EXPORT dearConfig
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(EXPORT dearConfig DESTINATION share/dear/cmake)
export(TARGETS ${PROJECT_NAME} FILE dearConfig.cmake)
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})