Files
torstenandCopilot 342ffd3e5c Update submodule to latest BUILD_RTI fixes
- HandlerMinelayerData: BUILD_RTI Guards für RTI-Abhängigkeiten
- svcTabCommon: Export-Header-Fix via Fallback-Target
- TrainingAreaBase: Stub-Header für BUILD_RTI=OFF
- ddsfts: Include-Pfad und Dependency-Fixes
- BUILD_RTI=OFF Compilation vollständig unterstützt

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Entire-Checkpoint: 01M0JNZA586SACX1PRZ2DJAE5S
2026-08-21 19:30:20 +02:00

146 lines
3.5 KiB
CMake

# (c) 2021 Copyright, Real-Time Innovations, Inc. All rights reserved.
# No duplications, whole or partial, manual or electronic, may be made
# without express written permission. Any such copies, or revisions thereof,
# must display this notice unaltered.
# This code contains trade secrets of Real-Time Innovations, Inc.
#[[.rst:
.. _find_wolfssl:
FindWolfSSL
-----------
Find the wolfSSL's libraries and executables.
The list of paths to search the libraries are:
- ``WolfSSL_ROOT``
Output variables and targets
- ``wolfSSL_INCLUDE_DIRS``: include directory for wolfSSL library.
- ``wolfSSL_LIBRARY``: The wolfSSL library.
- ``wolfSSL_VERSION``: The version of the wolfSSL libraries.
- ``wolfSSL::wolfSSL``: imported target for wolfSSL library.
- ``wolfSSL_PATH_ENV``: The list of paths to append to the PATH or similar
environment variable to run executables in the target machine.
#]]
include(FindPackageHandleStandardArgs)
include(ConnextDdsImportedTargets)
include(ConnextDdsGetSharedLibraryId)
# We prepend WolfSSL_ROOT to FIND_ROOT_PATH to allow searching in
# cross-compiling scenarios.
if(CMAKE_CROSSCOMPILING)
# We insert it as the first one to ensure our folder is the first to be
# read.
list(INSERT CMAKE_FIND_ROOT_PATH 0 ${WolfSSL_ROOT})
endif()
find_library(wolfSSL_LIBRARY
NAMES
wolfssl
HINTS
"${WolfSSL_ROOT}/lib"
)
find_path(
wolfSSL_include_dir
NAMES
wolfio.h
HINTS
"${WolfSSL_ROOT}/include"
PATH_SUFFIXES
wolfssl
)
get_filename_component(
wolfSSL_top_level_include_dir ${wolfSSL_include_dir} DIRECTORY
)
set(wolfSSL_INCLUDE_DIRS
${wolfSSL_top_level_include_dir}
${wolfSSL_include_dir}
)
find_file(
wolfSSL_CONFIG
NAMES
wolfssl-config
HINTS
"${WolfSSL_ROOT}/bin"
REQUIRED
)
set(wolfSSL_PATH_ENV
"${WolfSSL_ROOT}/lib"
"${WolfSSL_ROOT}/bin"
)
execute_process(
COMMAND
${wolfSSL_CONFIG} --version
OUTPUT_VARIABLE wolfSSL_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
find_package_handle_standard_args(
WolfSSL
REQUIRED_VARS
wolfSSL_INCLUDE_DIRS
wolfSSL_VERSION
wolfSSL_LIBRARY
VERSION_VAR wolfSSL_VERSION
FAIL_MESSAGE
"Fail to find wolfSSL"
)
if(BUILD_SHARED_LIBS)
set(lib_type SHARED)
else()
set(lib_type STATIC)
endif()
connextdds_create_imported_target(
TARGET wolfSSL::wolfSSL
${lib_type}
BASENAME wolfSSL
INCLUDE_DIRS
${wolfSSL_INCLUDE_DIRS}
LANGUAGES "C"
PURL
"pkg:generic/wolfssl@${wolfSSL_VERSION}"
CPE
"cpe:2.3:a:wolfssl:wolfssl:${wolfSSL_VERSION}:*:*:*:*:*:*:*"
LICENSE
# TODO: Need to check since we are using commercial version
"GPL-2.0"
)
if(BUILD_SHARED_LIBS)
# In UNIX, shared libraries found by the find_library are usually
# a symbolic link to a library with ABI versioning information.
# When using test bundles, we need both libraries to be included
# in the bundle. See BUILD-1837 and GREEN-2425.
connextdds_get_shared_library_id(
${wolfSSL_LIBRARY}
wolfssl_shared_library_id
)
if(wolfssl_shared_library_id)
get_filename_component(
wolfssl_soname ${wolfssl_shared_library_id} NAME
)
set_target_properties(wolfSSL::wolfSSL
PROPERTIES
IMPORTED_SONAME ${wolfssl_soname}
)
else()
connextdds_log_message(WARNING
"It was not possible to determine wolfssl shared library ID"
)
endif()
endif()