From 52fa4fb378c740002e34de95b6f935fcdf841e47 Mon Sep 17 00:00:00 2001 From: Timofei Zhakov Date: Tue, 10 Sep 2024 05:22:46 +0200 Subject: [PATCH] [apr] add usage (#40805) --- ports/apr/portfile.cmake | 2 ++ ports/apr/usage-cmake | 19 +++++++++++++++++++ ports/apr/vcpkg.json | 1 + versions/a-/apr.json | 5 +++++ versions/baseline.json | 2 +- 5 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 ports/apr/usage-cmake diff --git a/ports/apr/portfile.cmake b/ports/apr/portfile.cmake index 189b0b6773..895a98896a 100644 --- a/ports/apr/portfile.cmake +++ b/ports/apr/portfile.cmake @@ -44,6 +44,8 @@ if (VCPKG_TARGET_IS_WINDOWS) file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") vcpkg_copy_pdbs() + + file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage-cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME usage) else() # To cross-compile you will need a triplet file that locates the tool chain and sets --host and --cache parameters of "./configure". # The ${VCPKG_PLATFORM_TOOLSET}.cache file must have been generated on the targeted host using "./configure -C". diff --git a/ports/apr/usage-cmake b/ports/apr/usage-cmake new file mode 100644 index 0000000000..0430db590a --- /dev/null +++ b/ports/apr/usage-cmake @@ -0,0 +1,19 @@ +APR provides CMake targets whose names will start with the 'lib' prefix in shared configurations, while static configurations will not: + + find_package(apr CONFIG REQUIRED) + + # Use the shared configuration + target_link_libraries(main PRIVATE apr::apr-1 apr::libaprapp-1) + + # Use the static configuration + target_link_libraries(main PRIVATE apr::apr-1 apr::aprapp-1) + +To ensure compatibility with both static and shared configurations: + + find_package(apr CONFIG REQUIRED) + target_link_libraries(main PRIVATE + $<$:apr::apr-1> + $<$:apr::aprapp-1> + $<$:apr::libapr-1> + $<$:apr::libaprapp-1> + ) diff --git a/ports/apr/vcpkg.json b/ports/apr/vcpkg.json index 802c27c798..e052319294 100644 --- a/ports/apr/vcpkg.json +++ b/ports/apr/vcpkg.json @@ -1,6 +1,7 @@ { "name": "apr", "version": "1.7.5", + "port-version": 1, "description": "The Apache Portable Runtime (APR) is a C library that forms a system portability layer that covers many operating systems.", "homepage": "https://apr.apache.org/", "license": "Apache-2.0", diff --git a/versions/a-/apr.json b/versions/a-/apr.json index bd26c80fa3..72e6287755 100644 --- a/versions/a-/apr.json +++ b/versions/a-/apr.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "499cf5fc0959f4a049ec72f0f556400e7191ffd3", + "version": "1.7.5", + "port-version": 1 + }, { "git-tree": "da67695a8735bcfaed89792be1ea44176d9202a3", "version": "1.7.5", diff --git a/versions/baseline.json b/versions/baseline.json index 7286d9791a..ad3306730c 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -166,7 +166,7 @@ }, "apr": { "baseline": "1.7.5", - "port-version": 0 + "port-version": 1 }, "apr-util": { "baseline": "1.6.3",