diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b21ad73..ee0b287 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,11 +16,47 @@ if(NOT ${PROJECT_NAME} STREQUAL "CycloneDDS") message(FATAL_ERROR "Top-level CMakeLists.txt was moved to the top-level directory. Please run cmake on ${dir} instead of ${CMAKE_CURRENT_LIST_DIR}") endif() +add_definitions(-DDDSI_INCLUDE_NETWORK_PARTITIONS -DDDSI_INCLUDE_SSM) + +# OpenSSL is huge, raising the RSS by 1MB or so, and moreover find_package(OpenSSL) causes +# trouble on some older CMake versions that otherwise work fine, so provide an option to avoid +# all OpenSSL related things. +# +# Historically the option was DDSC_ENABLE_OPENSSL so make some allowance for those who are +# currently relying on it. +option(ENABLE_SSL "Enable openssl support" ON) +option(DDSC_ENABLE_OPENSSL "Deprecated: please use ENABLE_SSL instead" ON) +if(NOT DDSC_ENABLE_OPENSSL) + message(ERROR "DDSC_ENABLE_OPENSSL is deprecated, please use ENABLE_SSL instead") + set(ENABLE_SSL OFF) +endif() + +if(ENABLE_SSL) + find_package(OpenSSL) + if(OPENSSL_FOUND) + add_definitions(-DDDSI_INCLUDE_SSL) + message(STATUS "Building with OpenSSL support") + else() + message(STATUS "Building without OpenSSL support") + endif() +endif() # Support the OMG DDS Security within ddsc adds quite a bit of code. option(ENABLE_SECURITY "Enable OMG DDS Security support" ON) if(NOT ENABLE_SECURITY) message(STATUS "Building without OMG DDS Security support") +else() + add_definitions(-DDDSI_INCLUDE_SECURITY) +endif() + +option(ENABLE_LIFESPAN "Enable Lifespan QoS support" ON) +if(ENABLE_LIFESPAN) + add_definitions(-DDDSI_INCLUDE_LIFESPAN) +endif() + +option(ENABLE_DEADLINE_MISSED "Enable Deadline Missed QoS support" ON) +if(ENABLE_DEADLINE_MISSED) + add_definitions(-DDDSI_INCLUDE_DEADLINE_MISSED) endif() add_subdirectory(ddsrt) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 9da094a..b2fbfe6 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -25,47 +25,15 @@ else() add_library(ddsc) endif() -add_definitions(-DDDSI_INCLUDE_NETWORK_PARTITIONS -DDDSI_INCLUDE_SSM) - -option(ENABLE_LIFESPAN "Enable Lifespan QoS support" ON) -if(ENABLE_LIFESPAN) - add_definitions(-DDDSI_INCLUDE_LIFESPAN) -endif() - -option(ENABLE_DEADLINE_MISSED "Enable Deadline Missed QoS support" ON) -if(ENABLE_DEADLINE_MISSED) - add_definitions(-DDDSI_INCLUDE_DEADLINE_MISSED) -endif() - -# OpenSSL is huge, raising the RSS by 1MB or so, and moreover find_package(OpenSSL) causes -# trouble on some older CMake versions that otherwise work fine, so provide an option to avoid -# all OpenSSL related things. -# -# Historically the option was DDSC_ENABLE_OPENSSL so make some allowance for those who are -# currently relying on it. -option(ENABLE_SSL "Enable openssl support" ON) -option(DDSC_ENABLE_OPENSSL "Deprecated: please use ENABLE_SSL instead" ON) -if(NOT DDSC_ENABLE_OPENSSL) - message(ERROR "DDSC_ENABLE_OPENSSL is deprecated, please use ENABLE_SSL instead") - set(ENABLE_SSL OFF) -endif() -if(ENABLE_SSL) - find_package(OpenSSL) - if(OPENSSL_FOUND) - add_definitions(-DDDSI_INCLUDE_SSL) - target_link_libraries(ddsc PRIVATE OpenSSL::SSL) - if(CMAKE_GENERATOR MATCHES "Visual Studio") - set_target_properties(ddsc PROPERTIES LINK_FLAGS "/ignore:4099") - endif() - message(STATUS "Building with OpenSSL support") - else() - message(STATUS "Building without OpenSSL support") +if(ENABLE_SSL AND OPENSSL_FOUND) + target_link_libraries(ddsc PRIVATE OpenSSL::SSL) + if(CMAKE_GENERATOR MATCHES "Visual Studio") + set_target_properties(ddsc PROPERTIES LINK_FLAGS "/ignore:4099") endif() endif() # Support the OMG DDS Security within ddsc adds quite a bit of code. if(ENABLE_SECURITY) - add_definitions(-DDDSI_INCLUDE_SECURITY) target_link_libraries(ddsc PRIVATE security_core) target_include_directories( ddsc PUBLIC diff --git a/src/security/CMakeLists.txt b/src/security/CMakeLists.txt index 3b2d8f9..b96c7da 100644 --- a/src/security/CMakeLists.txt +++ b/src/security/CMakeLists.txt @@ -11,12 +11,11 @@ # cmake_minimum_required(VERSION 3.7) -if( ENABLE_SECURITY ) - add_definitions(-DDDSI_INCLUDE_SECURITY) - add_subdirectory(api) - add_subdirectory(core) +if(ENABLE_SECURITY) + add_subdirectory(api) + add_subdirectory(core) - if ( ENABLE_SSL) + if(ENABLE_SSL) add_subdirectory(builtin_plugins) endif() endif() \ No newline at end of file diff --git a/src/security/builtin_plugins/access_control/CMakeLists.txt b/src/security/builtin_plugins/access_control/CMakeLists.txt index c0cee0a..e882b2c 100644 --- a/src/security/builtin_plugins/access_control/CMakeLists.txt +++ b/src/security/builtin_plugins/access_control/CMakeLists.txt @@ -11,8 +11,6 @@ # include (GenerateExportHeader) -find_package(OpenSSL) - PREPEND(srcs_accesscontrol "${CMAKE_CURRENT_LIST_DIR}/src" access_control_objects.c access_control_parser.c diff --git a/src/security/builtin_plugins/cryptographic/CMakeLists.txt b/src/security/builtin_plugins/cryptographic/CMakeLists.txt index 3be3010..a1eb46e 100644 --- a/src/security/builtin_plugins/cryptographic/CMakeLists.txt +++ b/src/security/builtin_plugins/cryptographic/CMakeLists.txt @@ -11,8 +11,6 @@ # include (GenerateExportHeader) -find_package(OpenSSL) - PREPEND(srcs_cryptographic "${CMAKE_CURRENT_LIST_DIR}/src" crypto_cipher.c crypto_key_exchange diff --git a/src/security/builtin_plugins/tests/CMakeLists.txt b/src/security/builtin_plugins/tests/CMakeLists.txt index ac56a7f..d2a8af1 100644 --- a/src/security/builtin_plugins/tests/CMakeLists.txt +++ b/src/security/builtin_plugins/tests/CMakeLists.txt @@ -10,7 +10,6 @@ # SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause # include(CUnit) -find_package(OpenSSL) set(security_auth_test_sources "common/src/loader.c"