diff options
author | Aditya Vidyadhar Kamath <Aditya.Kamath1@ibm.com> | 2024-10-10 10:16:28 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2024-10-10 18:00:59 (GMT) |
commit | dc8e4f8f0cf4ca8224ca4f791974362740aba465 (patch) | |
tree | a82a71d7dc323f7878392cf013bdc698e6ca2701 /Tests | |
parent | 7fb05af311f8f49a36ecd3bd5ead19de845cf7b3 (diff) | |
download | CMake-dc8e4f8f0cf4ca8224ca4f791974362740aba465.zip CMake-dc8e4f8f0cf4ca8224ca4f791974362740aba465.tar.gz CMake-dc8e4f8f0cf4ca8224ca4f791974362740aba465.tar.bz2 |
AIX: Enable versioned shared objects with CMAKE_AIX_SHARED_LIBRARY_ARCHIVE
Closes: #26358
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/SharedLibraryArchive/CMakeLists.txt | 6 | ||||
-rw-r--r-- | Tests/SharedLibraryArchive/sla-check.cmake | 11 |
2 files changed, 12 insertions, 5 deletions
diff --git a/Tests/SharedLibraryArchive/CMakeLists.txt b/Tests/SharedLibraryArchive/CMakeLists.txt index 3af0f76..f6bef24 100644 --- a/Tests/SharedLibraryArchive/CMakeLists.txt +++ b/Tests/SharedLibraryArchive/CMakeLists.txt @@ -9,7 +9,7 @@ if(NOT aix_sla) message(FATAL_ERROR "AIX_SHARED_LIBRARY_ARCHIVE not initialized on SHARED library") endif() add_custom_command(TARGET sla POST_BUILD VERBATIM - COMMAND ${CMAKE_COMMAND} -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} -Dsla=$<TARGET_FILE:sla> -P${CMAKE_CURRENT_SOURCE_DIR}/sla-check.cmake + COMMAND ${CMAKE_COMMAND} -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} -Dsla=$<TARGET_FILE:sla> -Dname=sla -Dsoversion= -P${CMAKE_CURRENT_SOURCE_DIR}/sla-check.cmake ) add_executable(UseSLA use_sla.c) @@ -25,8 +25,10 @@ get_property(aix_sla_versioned TARGET sla_versioned PROPERTY AIX_SHARED_LIBRARY_ if(NOT aix_sla_versioned) message(FATAL_ERROR "AIX_SHARED_LIBRARY_ARCHIVE not initialized on SHARED library") endif() - set_target_properties(sla_versioned PROPERTIES OUTPUT_NAME "sla_versioned" VERSION 3 SOVERSION 2) +add_custom_command(TARGET sla_versioned POST_BUILD VERBATIM + COMMAND ${CMAKE_COMMAND} -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} -Dsla=$<TARGET_FILE:sla_versioned> -Dname=sla_versioned -Dsoversion=2 -P${CMAKE_CURRENT_SOURCE_DIR}/sla-check.cmake + ) add_executable(UseSLA_versioned use_sla.c) get_property(aix_sla_versioned TARGET UseSLA_versioned PROPERTY AIX_SHARED_LIBRARY_ARCHIVE) diff --git a/Tests/SharedLibraryArchive/sla-check.cmake b/Tests/SharedLibraryArchive/sla-check.cmake index bc1fee5..90a0de4 100644 --- a/Tests/SharedLibraryArchive/sla-check.cmake +++ b/Tests/SharedLibraryArchive/sla-check.cmake @@ -1,9 +1,14 @@ if(CMAKE_SYSTEM_NAME STREQUAL "AIX") - if(NOT sla MATCHES [[/libsla\.a]]) + set(sla_regex "/lib${name}\\.a$") + if(NOT sla MATCHES "${sla_regex}") message(FATAL_ERROR "sla library does not look like an archive:\n ${sla}") endif() execute_process(COMMAND ar t ${sla} OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE sla_members) - if(NOT sla_members MATCHES [[^libsla\.so]]) - message(FATAL_ERROR "sla library archive does not have expected members:\n ${sla_members}") + if(soversion) + set(soversion_regex "\\.${soversion}") + endif() + set(sla_members_regex "^lib${name}\\.so${soversion_regex}$") + if(NOT sla_members MATCHES "${sla_members_regex}") + message(FATAL_ERROR "sla library archive has members:\n ${sla_members}\nthat do not match:\n ${sla_members_regex}") endif() endif() |