summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorAditya Vidyadhar Kamath <Aditya.Kamath1@ibm.com>2024-10-10 10:16:28 (GMT)
committerBrad King <brad.king@kitware.com>2024-10-10 18:00:59 (GMT)
commitdc8e4f8f0cf4ca8224ca4f791974362740aba465 (patch)
treea82a71d7dc323f7878392cf013bdc698e6ca2701 /Tests
parent7fb05af311f8f49a36ecd3bd5ead19de845cf7b3 (diff)
downloadCMake-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.txt6
-rw-r--r--Tests/SharedLibraryArchive/sla-check.cmake11
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()