-
-
Notifications
You must be signed in to change notification settings - Fork 84
/
CMakeLists.txt
73 lines (59 loc) · 2.11 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
cmake_minimum_required(VERSION 3.12)
project(cannelloni)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
# Options
option(SCTP_SUPPORT "SCTP_SUPPORT" ON)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
if(SCTP_SUPPORT)
include(FindSCTP)
else(SCTP_SUPPORT)
message(STATUS "Building cannelloni without SCTP support (SCTP_SUPPORT=OFF)")
endif(SCTP_SUPPORT)
if(NOT SCTP_FOUND AND SCTP_SUPPORT)
set(SCTP_SUPPORT OFF)
message(STATUS "SCTP not found. cannelloni will be build without SCTP support.")
message(STATUS "Install lksctp-tools for SCTP.")
endif(NOT SCTP_FOUND AND SCTP_SUPPORT)
CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/config.h
)
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
add_executable(cannelloni cannelloni.cpp)
add_library(addsources STATIC
connection.cpp
framebuffer.cpp
inet_address.cpp
thread.cpp
timer.cpp
udpthread.cpp
tcpthread.cpp
tcp_client_thread.cpp
tcp_server_thread.cpp
canthread.cpp)
add_library(cannelloni-common SHARED
parser.cpp
decoder.cpp)
add_library(cannelloni-common-static STATIC
parser.cpp
decoder.cpp)
set_target_properties ( cannelloni-common
PROPERTIES
VERSION 0.0.1
SOVERSION 0
)
include(GNUInstallDirs)
if(SCTP_SUPPORT)
add_library(sctpthread STATIC sctpthread.cpp)
target_link_libraries(sctpthread addsources sctp)
target_link_libraries(addsources sctpthread)
endif(SCTP_SUPPORT)
set_target_properties(addsources PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(cannelloni addsources cannelloni-common-static pthread)
target_compile_features(cannelloni PRIVATE cxx_auto_type)
target_compile_features(addsources PRIVATE cxx_auto_type)
install(TARGETS cannelloni DESTINATION ${CMAKE_INSTALL_BINDIR})
install(TARGETS cannelloni-common DESTINATION ${CMAKE_INSTALL_LIBDIR})