2018-04-10 17:03:59 +02:00
|
|
|
#
|
|
|
|
# Copyright(c) 2006 to 2018 ADLINK Technology Limited and others
|
|
|
|
#
|
|
|
|
# This program and the accompanying materials are made available under the
|
|
|
|
# terms of the Eclipse Public License v. 2.0 which is available at
|
|
|
|
# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
|
|
|
|
# v. 1.0 which is available at
|
|
|
|
# http://www.eclipse.org/org/documents/edl-v10.php.
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
|
|
|
#
|
|
|
|
include (GenerateExportHeader)
|
|
|
|
|
|
|
|
FUNCTION(PREPEND var prefix)
|
|
|
|
SET(listVar "")
|
|
|
|
FOREACH(f ${ARGN})
|
|
|
|
LIST(APPEND listVar "${prefix}/${f}")
|
|
|
|
ENDFOREACH(f)
|
|
|
|
SET(${var} "${listVar}" PARENT_SCOPE)
|
|
|
|
ENDFUNCTION(PREPEND)
|
|
|
|
|
2019-05-23 14:27:56 +02:00
|
|
|
if (BUILD_SHARED_LIBS OR NOT DEFINED BUILD_SHARED_LIBS)
|
|
|
|
add_library(ddsc SHARED)
|
2018-04-10 17:03:59 +02:00
|
|
|
else()
|
2019-05-23 14:27:56 +02:00
|
|
|
add_library(ddsc)
|
2018-04-10 17:03:59 +02:00
|
|
|
endif()
|
|
|
|
|
2018-06-13 15:52:43 +02:00
|
|
|
add_definitions(-DDDSI_INCLUDE_NETWORK_PARTITIONS -DDDSI_INCLUDE_SSM)
|
2018-06-07 16:39:39 +02:00
|
|
|
|
2019-07-26 09:43:53 +02:00
|
|
|
# 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)
|
2019-01-31 17:19:18 +01:00
|
|
|
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()
|
2019-07-26 09:43:53 +02:00
|
|
|
message(STATUS "Building with OpenSSL support")
|
2019-01-31 17:19:18 +01:00
|
|
|
else()
|
2019-07-26 09:43:53 +02:00
|
|
|
message(STATUS "Building without OpenSSL support")
|
2019-01-31 17:19:18 +01:00
|
|
|
endif()
|
2019-01-30 14:39:34 +01:00
|
|
|
endif()
|
|
|
|
|
2018-04-10 17:03:59 +02:00
|
|
|
include(ddsi/CMakeLists.txt)
|
|
|
|
include(ddsc/CMakeLists.txt)
|
|
|
|
|
2019-01-18 14:10:19 +01:00
|
|
|
target_link_libraries(ddsc PRIVATE ddsrt)
|
2019-04-01 12:03:09 +02:00
|
|
|
target_compile_definitions(
|
2019-04-04 15:35:11 +02:00
|
|
|
ddsc PUBLIC
|
2019-04-16 10:23:32 +02:00
|
|
|
$<BUILD_INTERFACE:$<TARGET_PROPERTY:ddsrt,INTERFACE_COMPILE_DEFINITIONS>>)
|
2019-01-18 14:10:19 +01:00
|
|
|
target_include_directories(
|
2019-04-04 15:35:11 +02:00
|
|
|
ddsc PUBLIC
|
2019-04-16 10:23:32 +02:00
|
|
|
$<BUILD_INTERFACE:$<TARGET_PROPERTY:ddsrt,INTERFACE_INCLUDE_DIRECTORIES>>)
|
2018-04-10 17:03:59 +02:00
|
|
|
|
|
|
|
# SOVERSION should increase on incompatible ABI change
|
|
|
|
set_target_properties(ddsc PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR})
|
|
|
|
|
|
|
|
# Create a pseudo-target that other targets (i.e. examples, tests) can depend
|
|
|
|
# on and can also be provided as import-target by a package-file when building
|
|
|
|
# those targets outside the regular Cyclone build-tree (i.e. the installed tree)
|
|
|
|
add_library(${CMAKE_PROJECT_NAME}::ddsc ALIAS ddsc)
|
|
|
|
|
|
|
|
install(
|
|
|
|
TARGETS ddsc
|
|
|
|
EXPORT "${CMAKE_PROJECT_NAME}"
|
|
|
|
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT lib
|
|
|
|
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib
|
|
|
|
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib
|
|
|
|
)
|
2019-02-10 18:29:21 +01:00
|
|
|
|
2019-07-26 09:43:53 +02:00
|
|
|
if(BUILD_IDLC)
|
|
|
|
add_subdirectory(xtests)
|
|
|
|
endif()
|