Require OpenSSL by default and add list it as a dependency for Conan

OpenSSL support remains optional, but instead of including it or not solely depending on whether cmake manages to find it, there is now a DDSC_ENABLE_OPENSSL option that defaults to "ON". Setting to OFF removes the dependency. The Conan configuration has been updated to automatically provide openssl 1.1.1a.

Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
Erik Boasson 2019-01-31 17:19:18 +01:00
parent 334a85e0f1
commit b8329ce206
3 changed files with 15 additions and 6 deletions

View file

@ -1,5 +1,6 @@
[requires]
cunit/2.1-3@bincrafters/stable
OpenSSL/1.1.1a@conan/stable
[generators]
cmake

View file

@ -10,8 +10,8 @@
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
if(TARGET CONAN_PKG::OpenSSL)
add_library(OpenSSL INTERFACE IMPORTED) #ALIAS CONAN_PKG::OpenSSL)
target_link_libraries(OpenSSL INTERFACE CONAN_PKG::OpenSSL)
add_library(OpenSSL::SSL INTERFACE IMPORTED)
target_link_libraries(OpenSSL::SSL INTERFACE CONAN_PKG::OpenSSL)
set(OPENSSL_FOUND TRUE)
else()
# Loop over a list of possible module paths (without the current directory).

View file

@ -33,10 +33,18 @@ endif()
add_definitions(-DDDSI_INCLUDE_NETWORK_PARTITIONS -DDDSI_INCLUDE_SSM)
option(DDSC_ENABLE_OPENSSL "Enable openssl support" ON)
if(DDSC_ENABLE_OPENSSL)
find_package(OpenSSL)
if(OPENSSL_FOUND)
add_definitions(-DDDSI_INCLUDE_SSL)
target_link_libraries(ddsc PRIVATE OpenSSL)
target_link_libraries(ddsc PRIVATE OpenSSL::SSL)
if(CMAKE_GENERATOR MATCHES "Visual Studio")
set_target_properties(ddsc PROPERTIES LINK_FLAGS "/ignore:4099")
endif()
else()
message(FATAL_ERROR "To build without openssl support, set DDSC_ENABLE_OPENSSL to OFF")
endif()
endif()
include(ddsi/CMakeLists.txt)