-
Notifications
You must be signed in to change notification settings - Fork 10
/
CMakeLists.txt
139 lines (121 loc) · 4.02 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
cmake_minimum_required(VERSION 3.13)
# Parse version number from the header file
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/liveMedia/include/liveMedia_version.hh contents)
string(REGEX MATCH "define LIVEMEDIA_LIBRARY_VERSION_STRING \"([0-9\.]+)\"" _ ${contents})
set(project_version ${CMAKE_MATCH_1})
if(NOT DEFINED PROJECT_NAME)
set(live555_master_project TRUE)
endif()
project(live555
LANGUAGES C CXX
VERSION ${project_version}
)
message(STATUS "live555 version: ${project_version}")
list(APPEND CMAKE_MODULE_PATH ${live555_SOURCE_DIR}/cmake)
include(TargetVersion)
option(LIVE555_EPOLL_SUPPORT "Enable epoll task scheduler (Windows also)" ON)
option(LIVE555_BUILD_EXAMPLES "Build examples and test programs" ${live555_master_project})
option(LIVE555_ENABLE_OPENSSL "Build with OpenSSL support (rtsps, SRTP)." ON)
option(LIVE555_MONOLITH_BUILD "Build all modules as one monolithic library" OFF)
option(LIVE555_DEBUG_OUTPUT "Enable debug output" OFF)
add_library(live555_cxx_flags INTERFACE)
if(WIN32)
target_compile_definitions(live555_cxx_flags INTERFACE
LOCALE_NOT_USED
SOCKLEN_T=int
)
if(BUILD_SHARED_LIBS)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
set(CMAKE_DEBUG_POSTFIX d)
endif()
else()
target_compile_definitions(live555_cxx_flags INTERFACE
BSD=1
SOCKLEN_T=socklen_t
)
endif()
if(LIVE555_ENABLE_OPENSSL)
find_package(OpenSSL 1.1.1 REQUIRED COMPONENTS Crypto SSL)
target_link_libraries(live555_cxx_flags INTERFACE
OpenSSL::Crypto
OpenSSL::SSL
)
else()
target_compile_definitions(live555_cxx_flags INTERFACE NO_OPENSSL=1)
endif()
install(TARGETS live555_cxx_flags EXPORT live555Target)
if(LIVE555_MONOLITH_BUILD)
set(live555_library_type OBJECT)
endif()
add_subdirectory(UsageEnvironment)
add_subdirectory(groupsock)
add_subdirectory(BasicUsageEnvironment)
add_subdirectory(liveMedia)
if(LIVE555_EPOLL_SUPPORT)
add_subdirectory(EpollTaskScheduler)
endif()
if(LIVE555_MONOLITH_BUILD)
add_library(live555 dummy.cpp)
target_link_libraries(live555 PUBLIC
UsageEnvironment
groupsock
BasicUsageEnvironment
liveMedia
)
if(TARGET EpollTaskScheduler)
target_link_libraries(live555 PUBLIC EpollTaskScheduler)
add_library(live555::EpollTaskScheduler ALIAS EpollTaskScheduler)
endif()
add_library(live555::live555 ALIAS live555)
add_library(live555::UsageEnvironment ALIAS live555)
add_library(live555::groupsock ALIAS live555)
add_library(live555::BasicUsageEnvironment ALIAS live555)
add_library(live555::liveMedia ALIAS live555)
live555_target_version(live555
CURRENT 1
REVISION 0
AGE 0
)
set_target_properties(live555 PROPERTIES FOLDER "live555")
else()
add_library(live555 INTERFACE)
add_library(live555::live555 ALIAS live555)
target_link_libraries(live555 INTERFACE
UsageEnvironment
groupsock
BasicUsageEnvironment
liveMedia
)
if(TARGET EpollTaskScheduler)
target_link_libraries(live555 INTERFACE EpollTaskScheduler)
endif()
endif()
install(TARGETS live555 EXPORT live555Target
INCLUDES DESTINATION include/liveMedia
RUNTIME DESTINATION bin/$<CONFIG>
LIBRARY DESTINATION lib/$<CONFIG>
ARCHIVE DESTINATION lib/$<CONFIG>
)
if(LIVE555_BUILD_EXAMPLES)
add_subdirectory(testProgs)
add_subdirectory(proxyServer)
add_subdirectory(mediaServer)
add_subdirectory(hlsProxy)
endif()
if(live555_master_project)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
endif()
# Installation stuff
set(config_version_file ${CMAKE_CURRENT_BINARY_DIR}/live555ConfigVersion.cmake)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(${config_version_file}
VERSION ${live555_VERSION}
COMPATIBILITY ExactVersion)
install(FILES ${config_version_file}
DESTINATION lib/cmake/live555
)
install(EXPORT live555Target
NAMESPACE live555::
DESTINATION lib/cmake/live555
FILE live555Config.cmake
)