From a091f4c8e0ce383f2831f2f111f3f2945c6b9db8 Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Fri, 11 Oct 2024 19:42:13 +0100 Subject: [PATCH] Set VERSION property against all libraries to write versioned SONAME (#6087) The SONAME currently written to shared libraries is unversioned, e.g. libazure-core.so. The SDK's ABI is unstable, so replacing these .so files with newer versions will immediately break any consumers. Setting the VERSION property results in libazure-core.so being a symlink that is used at build time to point to the versioned library, e.g. libazure-core.so.1.14.0. Consumers point directly to the versioned library and continue to work against the older version when the library is upgraded. Once rebuilt, they then point to the newer version instead. It is more common to use an ABI version that is separate to the library version, but it makes sense to use the latter when the ABI is unstable. The Boost libraries do exactly this. This change has no effect on static libraries, which is the more common use case. See the CMake documentation for its wider effects. https://cmake.org/cmake/help/latest/prop_tgt/VERSION.html --- sdk/attestation/azure-security-attestation/CMakeLists.txt | 1 + sdk/core/azure-core-amqp/CMakeLists.txt | 1 + sdk/core/azure-core-tracing-opentelemetry/CMakeLists.txt | 2 ++ sdk/core/azure-core/CMakeLists.txt | 1 + .../CMakeLists.txt | 1 + sdk/eventhubs/azure-messaging-eventhubs/CMakeLists.txt | 1 + sdk/identity/azure-identity/CMakeLists.txt | 1 + .../azure-security-keyvault-administration/CMakeLists.txt | 1 + .../azure-security-keyvault-certificates/CMakeLists.txt | 1 + sdk/keyvault/azure-security-keyvault-keys/CMakeLists.txt | 1 + sdk/keyvault/azure-security-keyvault-secrets/CMakeLists.txt | 1 + sdk/storage/azure-storage-blobs/CMakeLists.txt | 1 + sdk/storage/azure-storage-common/CMakeLists.txt | 1 + sdk/storage/azure-storage-files-datalake/CMakeLists.txt | 1 + sdk/storage/azure-storage-files-shares/CMakeLists.txt | 1 + sdk/storage/azure-storage-queues/CMakeLists.txt | 1 + sdk/tables/azure-data-tables/CMakeLists.txt | 1 + sdk/template/azure-template/CMakeLists.txt | 1 + 18 files changed, 19 insertions(+) diff --git a/sdk/attestation/azure-security-attestation/CMakeLists.txt b/sdk/attestation/azure-security-attestation/CMakeLists.txt index 8dec8cfa5..dee51d63f 100644 --- a/sdk/attestation/azure-security-attestation/CMakeLists.txt +++ b/sdk/attestation/azure-security-attestation/CMakeLists.txt @@ -86,6 +86,7 @@ create_code_coverage(attestation azure-security-attestation azure-security-attes get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/src/private/package_version.hpp") +set_target_properties(azure-security-attestation PROPERTIES VERSION ${AZ_LIBRARY_VERSION}) generate_documentation(azure-security-attestation ${AZ_LIBRARY_VERSION}) az_vcpkg_export( diff --git a/sdk/core/azure-core-amqp/CMakeLists.txt b/sdk/core/azure-core-amqp/CMakeLists.txt index 3ef7bf8d9..6d2829e84 100644 --- a/sdk/core/azure-core-amqp/CMakeLists.txt +++ b/sdk/core/azure-core-amqp/CMakeLists.txt @@ -177,6 +177,7 @@ target_link_libraries(azure-core-amqp PRIVATE PUBLIC Azure::azure-core) get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/src/private/package_version.hpp") +set_target_properties(azure-core-amqp PROPERTIES VERSION ${AZ_LIBRARY_VERSION}) generate_documentation(azure-core-amqp ${AZ_LIBRARY_VERSION}) az_vcpkg_export( diff --git a/sdk/core/azure-core-tracing-opentelemetry/CMakeLists.txt b/sdk/core/azure-core-tracing-opentelemetry/CMakeLists.txt index 23cf7d143..a3c058874 100644 --- a/sdk/core/azure-core-tracing-opentelemetry/CMakeLists.txt +++ b/sdk/core/azure-core-tracing-opentelemetry/CMakeLists.txt @@ -83,6 +83,8 @@ get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/src/private/package_version.hpp") generate_documentation(azure-core-tracing-opentelemetry ${AZ_LIBRARY_VERSION}) if(BUILD_AZURE_CORE_TRACING_OPENTELEMETRY) + set_target_properties(azure-core-tracing-opentelemetry PROPERTIES VERSION ${AZ_LIBRARY_VERSION}) + az_vcpkg_export( azure-core-tracing-opentelemetry CORE_TRACING_OPENTELEMETRY diff --git a/sdk/core/azure-core/CMakeLists.txt b/sdk/core/azure-core/CMakeLists.txt index 87c5cfd9b..c7d29c3f2 100644 --- a/sdk/core/azure-core/CMakeLists.txt +++ b/sdk/core/azure-core/CMakeLists.txt @@ -192,6 +192,7 @@ if(BUILD_TRANSPORT_WINHTTP) endif() get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/src/private/package_version.hpp") +set_target_properties(azure-core PROPERTIES VERSION ${AZ_LIBRARY_VERSION}) generate_documentation(azure-core ${AZ_LIBRARY_VERSION}) az_vcpkg_export( diff --git a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CMakeLists.txt b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CMakeLists.txt index 215269090..9fbc1062a 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CMakeLists.txt +++ b/sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/CMakeLists.txt @@ -91,6 +91,7 @@ target_link_libraries(azure-messaging-eventhubs-checkpointstore-blob create_code_coverage(eventhubs azure-messaging-eventhubs-checkpointstore-blob azure-messaging-eventhubs-blobcheckpointstore-test "tests?/*;samples?/*") get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/src/private/package_version.hpp") +set_target_properties(azure-messaging-eventhubs-checkpointstore-blob PROPERTIES VERSION ${AZ_LIBRARY_VERSION}) #generate_documentation(azure-messaging-eventhubs-checkpointstore-blob ${AZ_LIBRARY_VERSION}) generate_documentation(azure-messaging-eventhubs-checkpointstore-blob ${AZ_LIBRARY_VERSION}) diff --git a/sdk/eventhubs/azure-messaging-eventhubs/CMakeLists.txt b/sdk/eventhubs/azure-messaging-eventhubs/CMakeLists.txt index 0ea0b8e10..1cb7273fa 100644 --- a/sdk/eventhubs/azure-messaging-eventhubs/CMakeLists.txt +++ b/sdk/eventhubs/azure-messaging-eventhubs/CMakeLists.txt @@ -116,6 +116,7 @@ target_compile_definitions(azure-messaging-eventhubs PRIVATE _azure_BUILDING_SDK create_code_coverage(eventhubs azure-messaging-eventhubs azure-messaging-eventhubs-test "tests?/*;samples?/*") get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/src/private/package_version.hpp") +set_target_properties(azure-messaging-eventhubs PROPERTIES VERSION ${AZ_LIBRARY_VERSION}) generate_documentation(azure-messaging-eventhubs ${AZ_LIBRARY_VERSION}) add_subdirectory(test) diff --git a/sdk/identity/azure-identity/CMakeLists.txt b/sdk/identity/azure-identity/CMakeLists.txt index 57fe6bbc2..2cd8243ac 100644 --- a/sdk/identity/azure-identity/CMakeLists.txt +++ b/sdk/identity/azure-identity/CMakeLists.txt @@ -117,6 +117,7 @@ else() endif() get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/src/private/package_version.hpp") +set_target_properties(azure-identity PROPERTIES VERSION ${AZ_LIBRARY_VERSION}) generate_documentation(azure-identity ${AZ_LIBRARY_VERSION}) az_vcpkg_export( diff --git a/sdk/keyvault/azure-security-keyvault-administration/CMakeLists.txt b/sdk/keyvault/azure-security-keyvault-administration/CMakeLists.txt index 5f70eb301..45a1181e7 100644 --- a/sdk/keyvault/azure-security-keyvault-administration/CMakeLists.txt +++ b/sdk/keyvault/azure-security-keyvault-administration/CMakeLists.txt @@ -95,6 +95,7 @@ target_compile_definitions(azure-security-keyvault-administration PRIVATE _azure create_code_coverage(keyvault azure-security-keyvault-administration azure-security-keyvault-administration-test "tests?/*;samples?/*") get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/src/private/package_version.hpp") +set_target_properties(azure-security-keyvault-administration PROPERTIES VERSION ${AZ_LIBRARY_VERSION}) generate_documentation(azure-security-keyvault-administration ${AZ_LIBRARY_VERSION}) if(BUILD_TESTING) diff --git a/sdk/keyvault/azure-security-keyvault-certificates/CMakeLists.txt b/sdk/keyvault/azure-security-keyvault-certificates/CMakeLists.txt index 0806e09b0..0c08f1576 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/CMakeLists.txt +++ b/sdk/keyvault/azure-security-keyvault-certificates/CMakeLists.txt @@ -100,6 +100,7 @@ target_compile_definitions(azure-security-keyvault-certificates PRIVATE _azure_B create_code_coverage(keyvault azure-security-keyvault-certificates azure-security-keyvault-certificates-test "tests?/*;samples?/*") get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/src/private/package_version.hpp") +set_target_properties(azure-security-keyvault-certificates PROPERTIES VERSION ${AZ_LIBRARY_VERSION}) generate_documentation(azure-security-keyvault-certificates ${AZ_LIBRARY_VERSION}) if(BUILD_TESTING) diff --git a/sdk/keyvault/azure-security-keyvault-keys/CMakeLists.txt b/sdk/keyvault/azure-security-keyvault-keys/CMakeLists.txt index 6217fd13f..d5b6db60a 100644 --- a/sdk/keyvault/azure-security-keyvault-keys/CMakeLists.txt +++ b/sdk/keyvault/azure-security-keyvault-keys/CMakeLists.txt @@ -138,6 +138,7 @@ target_compile_definitions(azure-security-keyvault-keys PRIVATE _azure_BUILDING_ create_code_coverage(keyvault azure-security-keyvault-keys azure-security-keyvault-keys-test "tests?/*;samples?/*") get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/src/private/package_version.hpp") +set_target_properties(azure-security-keyvault-keys PROPERTIES VERSION ${AZ_LIBRARY_VERSION}) generate_documentation(azure-security-keyvault-keys ${AZ_LIBRARY_VERSION}) if(BUILD_TESTING) diff --git a/sdk/keyvault/azure-security-keyvault-secrets/CMakeLists.txt b/sdk/keyvault/azure-security-keyvault-secrets/CMakeLists.txt index e5acb6001..647285994 100644 --- a/sdk/keyvault/azure-security-keyvault-secrets/CMakeLists.txt +++ b/sdk/keyvault/azure-security-keyvault-secrets/CMakeLists.txt @@ -133,6 +133,7 @@ target_compile_definitions(azure-security-keyvault-secrets PRIVATE _azure_BUILDI create_code_coverage(keyvault azure-security-keyvault-secrets azure-security-keyvault-secrets-test "tests?/*;samples?/*") get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/src/private/package_version.hpp") +set_target_properties(azure-security-keyvault-secrets PROPERTIES VERSION ${AZ_LIBRARY_VERSION}) generate_documentation(azure-security-keyvault-secrets ${AZ_LIBRARY_VERSION}) if(BUILD_TESTING) diff --git a/sdk/storage/azure-storage-blobs/CMakeLists.txt b/sdk/storage/azure-storage-blobs/CMakeLists.txt index f87ceae40..d624433d8 100644 --- a/sdk/storage/azure-storage-blobs/CMakeLists.txt +++ b/sdk/storage/azure-storage-blobs/CMakeLists.txt @@ -96,6 +96,7 @@ target_link_libraries(azure-storage-blobs PUBLIC Azure::azure-storage-common) target_compile_definitions(azure-storage-blobs PRIVATE _azure_BUILDING_SDK) get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/src/private/package_version.hpp") +set_target_properties(azure-storage-blobs PROPERTIES VERSION ${AZ_LIBRARY_VERSION}) generate_documentation(azure-storage-blobs ${AZ_LIBRARY_VERSION}) az_vcpkg_export( diff --git a/sdk/storage/azure-storage-common/CMakeLists.txt b/sdk/storage/azure-storage-common/CMakeLists.txt index 30f056dca..76afb17a3 100644 --- a/sdk/storage/azure-storage-common/CMakeLists.txt +++ b/sdk/storage/azure-storage-common/CMakeLists.txt @@ -107,6 +107,7 @@ else() endif() get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/src/private/package_version.hpp") +set_target_properties(azure-storage-common PROPERTIES VERSION ${AZ_LIBRARY_VERSION}) generate_documentation(azure-storage-common ${AZ_LIBRARY_VERSION}) az_vcpkg_export( diff --git a/sdk/storage/azure-storage-files-datalake/CMakeLists.txt b/sdk/storage/azure-storage-files-datalake/CMakeLists.txt index 71905c86d..d02850bf1 100644 --- a/sdk/storage/azure-storage-files-datalake/CMakeLists.txt +++ b/sdk/storage/azure-storage-files-datalake/CMakeLists.txt @@ -92,6 +92,7 @@ target_include_directories( target_link_libraries(azure-storage-files-datalake PUBLIC Azure::azure-storage-blobs) get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/src/private/package_version.hpp") +set_target_properties(azure-storage-files-datalake PROPERTIES VERSION ${AZ_LIBRARY_VERSION}) generate_documentation(azure-storage-files-datalake ${AZ_LIBRARY_VERSION}) az_vcpkg_export( diff --git a/sdk/storage/azure-storage-files-shares/CMakeLists.txt b/sdk/storage/azure-storage-files-shares/CMakeLists.txt index 891f95480..3b79e1041 100644 --- a/sdk/storage/azure-storage-files-shares/CMakeLists.txt +++ b/sdk/storage/azure-storage-files-shares/CMakeLists.txt @@ -88,6 +88,7 @@ target_include_directories( target_link_libraries(azure-storage-files-shares PUBLIC Azure::azure-storage-common) get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/src/private/package_version.hpp") +set_target_properties(azure-storage-files-shares PROPERTIES VERSION ${AZ_LIBRARY_VERSION}) generate_documentation(azure-storage-files-shares ${AZ_LIBRARY_VERSION}) az_vcpkg_export( diff --git a/sdk/storage/azure-storage-queues/CMakeLists.txt b/sdk/storage/azure-storage-queues/CMakeLists.txt index e567623d5..9ffc621ad 100644 --- a/sdk/storage/azure-storage-queues/CMakeLists.txt +++ b/sdk/storage/azure-storage-queues/CMakeLists.txt @@ -81,6 +81,7 @@ target_include_directories( target_link_libraries(azure-storage-queues PUBLIC Azure::azure-storage-common) get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/src/private/package_version.hpp") +set_target_properties(azure-storage-queues PROPERTIES VERSION ${AZ_LIBRARY_VERSION}) generate_documentation(azure-storage-queues ${AZ_LIBRARY_VERSION}) az_vcpkg_export( diff --git a/sdk/tables/azure-data-tables/CMakeLists.txt b/sdk/tables/azure-data-tables/CMakeLists.txt index 038e267d7..f3b5e679c 100644 --- a/sdk/tables/azure-data-tables/CMakeLists.txt +++ b/sdk/tables/azure-data-tables/CMakeLists.txt @@ -106,6 +106,7 @@ target_include_directories( target_link_libraries(azure-data-tables PUBLIC Azure::azure-core) get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/src/private/package_version.hpp") +set_target_properties(azure-data-tables PROPERTIES VERSION ${AZ_LIBRARY_VERSION}) generate_documentation(azure-data-tables ${AZ_LIBRARY_VERSION}) az_vcpkg_export( diff --git a/sdk/template/azure-template/CMakeLists.txt b/sdk/template/azure-template/CMakeLists.txt index 84e3d17fd..5dc9cdd5c 100644 --- a/sdk/template/azure-template/CMakeLists.txt +++ b/sdk/template/azure-template/CMakeLists.txt @@ -78,6 +78,7 @@ add_library(Azure::azure-template ALIAS azure-template) create_code_coverage(template azure-template azure-template-test "tests?/*;samples?/*") get_az_version("${CMAKE_CURRENT_SOURCE_DIR}/src/private/package_version.hpp") +set_target_properties(azure-template PROPERTIES VERSION ${AZ_LIBRARY_VERSION}) generate_documentation(azure-template ${AZ_LIBRARY_VERSION}) az_vcpkg_export(