Files
qt6-migration-pipeline/external/rti_connext_dds-7.7.0/resource/cmake/ConnextDdsGetSharedLibraryId.cmake
T
torsten 77c67c12ca Execute the same instructions but now for tools in folders you are getti
Entire-Metadata: .entire/metadata/fb87247f-2a75-407e-b336-cbc8c20ba5a6
Entire-Session: fb87247f-2a75-407e-b336-cbc8c20ba5a6
Entire-Strategy: manual-commit
2026-09-24 16:24:51 +00:00

81 lines
2.4 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:
.. _connextdds_get_shared_library_id:
ConnextDdsGetSharedLibraryId
----------------------------
connextdds_get_shared_library_id
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Get a shared library's identifier::
connextdds_get_shared_library_id(
LIBRARY <shared_library>
IDENTIFIER <output_id>
)
Helper function to extract the shared library ID.
#]]
include(FindPackageHandleStandardArgs)
include(ConnextDdsImportedTargets)
function(connextdds_get_shared_library_id library outvar)
if(BUILD_SHARED_LIBS)
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
# We use `otool` for this task.
# otool: object file displaying tool.
find_program(OTOOL
NAMES
"otool"
DOC "The otool program"
)
if(NOT OTOOL)
connextdds_log_message(FATAL_ERROR "otool not found")
endif()
execute_process(
COMMAND
${OTOOL} -D ${library} -X
OUTPUT_VARIABLE otool_output
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE otool_retcode
)
# If everything goes properly, the return code is 0
if(otool_retcode)
connextdds_log_message(FATAL_ERROR "Failed to run otool")
endif()
string(REPLACE "\n" "" shared_library_id ${otool_output})
# Get the path to the real library
set(${outvar} "${shared_library_id}" PARENT_SCOPE)
elseif(NOT WIN32)
# Get the path to the real library
get_filename_component(
resolved_library_full ${library} REALPATH
)
set(${outvar} ${resolved_library_full} PARENT_SCOPE)
else()
connextdds_log_message(
FATAL_ERROR
"This functionality is not supported in Windows"
)
endif()
else()
connextdds_log_message(
FATAL_ERROR
"This functionality is only supported for shared libs"
)
endif()
endfunction()