From f7ab6e43732bc68b38ef5db5feda27105d954b5b Mon Sep 17 00:00:00 2001 From: Vollstrecker Date: Mon, 2 Dec 2024 15:11:31 +0100 Subject: [PATCH] CMake: Add aliases to match the export names. --- CMakeLists.txt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b24374a..79009627 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -94,6 +94,7 @@ if(ZLIB_BUILD_SHARED) ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS} $<$,$>:win32/zlib1.rc>) + add_library(ZLIB::ZLIB ALIAS zlib) target_include_directories(zlib PUBLIC $ $ @@ -113,6 +114,7 @@ if(ZLIB_BUILD_SHARED) # the DLL comes from the resource file win32/zlib1.rc set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL + EXPORT_NAME ZLIB OUTPUT_NAME z SOVERSION 1 $<$:VERSION ${zlib_VERSION}>) @@ -128,6 +130,7 @@ if(ZLIB_BUILD_STATIC) ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) + add_library(ZLIB::ZLIBSTATIC ALIAS zlibstatic) target_include_directories(zlibstatic PUBLIC $ $ @@ -193,20 +196,20 @@ endif(ZLIB_INSTALL_LIBRARIES) if(ZLIB_BUILD_TESTING) enable_testing() add_executable(zlib_example test/example.c) - target_link_libraries(zlib_example zlib) + target_link_libraries(zlib_example ZLIB::ZLIB) add_test(zlib_example zlib_example) add_executable(minigzip test/minigzip.c) - target_link_libraries(minigzip zlib) + target_link_libraries(minigzip ZLIB::ZLIB) if(HAVE_OFF64_T) add_executable(zlib_example64 test/example.c) target_compile_definitions(zlib_example64 PRIVATE LARGEFILE64_SOURCE=1) - target_link_libraries(zlib_example64 zlib) + target_link_libraries(zlib_example64 ZLIB::ZLIB) add_test(zlib_example64 zlib_example64) add_executable(minigzip64 test/minigzip.c) target_compile_definitions(minigzip64 PRIVATE LARGEFILE64_SOURCE=1) - target_link_libraries(minigzip64 zlib) + target_link_libraries(minigzip64 ZLIB::ZLIB) endif(HAVE_OFF64_T) endif(ZLIB_BUILD_TESTING)