|
@@ -12,6 +12,9 @@ option(NO_EXAMPLES "Disable examples" OFF)
|
|
option(NO_TESTS "Disable tests build" OFF)
|
|
option(NO_TESTS "Disable tests build" OFF)
|
|
option(WARNINGS_AS_ERRORS "Treat warnings as errors" OFF)
|
|
option(WARNINGS_AS_ERRORS "Treat warnings as errors" OFF)
|
|
option(CAPI_STDCALL "Set calling convention of C API callbacks stdcall" OFF)
|
|
option(CAPI_STDCALL "Set calling convention of C API callbacks stdcall" OFF)
|
|
|
|
+# Option USE_SRTP defaults to AUTO (enabled if libSRTP is found, else disabled)
|
|
|
|
+set(USE_SRTP AUTO CACHE STRING "Use libSRTP and enable media support")
|
|
|
|
+set_property(CACHE USE_SRTP PROPERTY STRINGS AUTO ON OFF)
|
|
|
|
|
|
if(USE_NICE)
|
|
if(USE_NICE)
|
|
option(USE_JUICE "Use libjuice" OFF)
|
|
option(USE_JUICE "Use libjuice" OFF)
|
|
@@ -20,9 +23,9 @@ else()
|
|
endif()
|
|
endif()
|
|
|
|
|
|
if(USE_GNUTLS)
|
|
if(USE_GNUTLS)
|
|
- option(USE_NETTLE "Use Nettle instead of OpenSSL in libjuice" ON)
|
|
|
|
|
|
+ option(USE_NETTLE "Use Nettle in libjuice" ON)
|
|
else()
|
|
else()
|
|
- option(USE_NETTLE "Use Nettle instead of OpenSSL in libjuice" OFF)
|
|
|
|
|
|
+ option(USE_NETTLE "Use Nettle in libjuice" OFF)
|
|
endif()
|
|
endif()
|
|
|
|
|
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|
@@ -162,8 +165,18 @@ if(WIN32)
|
|
target_link_libraries(datachannel-static PRIVATE ws2_32) # winsock2
|
|
target_link_libraries(datachannel-static PRIVATE ws2_32) # winsock2
|
|
endif()
|
|
endif()
|
|
|
|
|
|
-find_package(SRTP)
|
|
|
|
-if(SRTP_FOUND)
|
|
|
|
|
|
+if(USE_SRTP STREQUAL "AUTO")
|
|
|
|
+ find_package(SRTP)
|
|
|
|
+ if(SRTP_FOUND)
|
|
|
|
+ message(STATUS "LibSRTP found, compiling with media transport")
|
|
|
|
+ else()
|
|
|
|
+ message(STATUS "LibSRTP NOT found, compiling WITHOUT media transport")
|
|
|
|
+ endif()
|
|
|
|
+elseif(USE_SRTP)
|
|
|
|
+ find_package(SRTP REQUIRED)
|
|
|
|
+endif()
|
|
|
|
+
|
|
|
|
+if(USE_SRTP AND SRTP_FOUND)
|
|
if(NOT TARGET SRTP::SRTP)
|
|
if(NOT TARGET SRTP::SRTP)
|
|
add_library(SRTP::SRTP UNKNOWN IMPORTED)
|
|
add_library(SRTP::SRTP UNKNOWN IMPORTED)
|
|
set_target_properties(SRTP::SRTP PROPERTIES
|
|
set_target_properties(SRTP::SRTP PROPERTIES
|
|
@@ -171,13 +184,11 @@ if(SRTP_FOUND)
|
|
IMPORTED_LINK_INTERFACE_LANGUAGES C
|
|
IMPORTED_LINK_INTERFACE_LANGUAGES C
|
|
IMPORTED_LOCATION ${SRTP_LIBRARIES})
|
|
IMPORTED_LOCATION ${SRTP_LIBRARIES})
|
|
endif()
|
|
endif()
|
|
- message(STATUS "LibSRTP found, compiling with media transport")
|
|
|
|
target_compile_definitions(datachannel PUBLIC RTC_ENABLE_MEDIA=1)
|
|
target_compile_definitions(datachannel PUBLIC RTC_ENABLE_MEDIA=1)
|
|
target_compile_definitions(datachannel-static PUBLIC RTC_ENABLE_MEDIA=1)
|
|
target_compile_definitions(datachannel-static PUBLIC RTC_ENABLE_MEDIA=1)
|
|
target_link_libraries(datachannel PRIVATE SRTP::SRTP)
|
|
target_link_libraries(datachannel PRIVATE SRTP::SRTP)
|
|
target_link_libraries(datachannel-static PRIVATE SRTP::SRTP)
|
|
target_link_libraries(datachannel-static PRIVATE SRTP::SRTP)
|
|
else()
|
|
else()
|
|
- message(STATUS "LibSRTP NOT found, compiling WITHOUT media transport")
|
|
|
|
target_compile_definitions(datachannel PUBLIC RTC_ENABLE_MEDIA=0)
|
|
target_compile_definitions(datachannel PUBLIC RTC_ENABLE_MEDIA=0)
|
|
target_compile_definitions(datachannel-static PUBLIC RTC_ENABLE_MEDIA=0)
|
|
target_compile_definitions(datachannel-static PUBLIC RTC_ENABLE_MEDIA=0)
|
|
endif()
|
|
endif()
|