From: Mika Lindqvist Date: Sun, 11 Sep 2022 15:57:02 +0000 (+0300) Subject: Fix build failure introduced by 8df665005952cdbe7dc995d409ffe4f861e7a83e X-Git-Tag: 2.1.0-beta1~167 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8353094a7bde4b7f626d84aabf7a0149724e786d;p=thirdparty%2Fzlib-ng.git Fix build failure introduced by 8df665005952cdbe7dc995d409ffe4f861e7a83e * We need absolute path for libz.a --- diff --git a/.github/workflows/link.yml b/.github/workflows/link.yml index 806a93411..0ac4f5cff 100644 --- a/.github/workflows/link.yml +++ b/.github/workflows/link.yml @@ -21,7 +21,7 @@ jobs: run: cmake --build zlib/build --config Release - name: Generate project files (native) - run: cmake -S . -B native -DZLIB_COMPAT=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DZLIB_LIBRARIES=../zlib/build/libz.a -DZLIB_INCLUDE_DIR=../zlib/build + run: cmake -S . -B native -DZLIB_COMPAT=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DZLIB_LIBRARIES=../zlib/build/libz.a -DZLIB_INCLUDE_DIR="../zlib/build;../zlib" - name: Compile source code (native) run: cmake --build native --config Release diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 51d1cf084..ad002d9ce 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -180,14 +180,24 @@ else() -fsanitize-memory-track-origins) endif() - if(NOT ZLIB_COMPAT AND DEFINED ZLIB_INCLUDE_DIR AND DEFINED ZLIB_LIBRARIES) + if(NOT ZLIB_COMPAT AND DEFINED ZLIB_LIBRARIES AND DEFINED ZLIB_INCLUDE_DIR) + if(NOT IS_ABSOLUTE ${ZLIB_LIBRARIES}) + get_filename_component(ZLIB_ABSOLUTE_PATH + "${CMAKE_CURRENT_SOURCE_DIR}/${ZLIB_LIBRARIES}" + ABSOLUTE) + else() + set(ZLIB_ABSOLUTE_PATH ${ZLIB_LIBRARIES}) + endif() + + add_library(external_zlib STATIC IMPORTED) + set_property(TARGET external_zlib PROPERTY IMPORTED_LOCATION ${ZLIB_ABSOLUTE_PATH}) message(STATUS "Added dual linking tests against zlib") message(STATUS " Zlib include dir: ${ZLIB_INCLUDE_DIR}") - message(STATUS " Zlib libraries: ${ZLIB_LIBRARIES}") + message(STATUS " Zlib libraries: ${ZLIB_ABSOLUTE_PATH}") target_sources(gtest_zlib PRIVATE test_compress_dual.cc) target_include_directories(gtest_zlib PRIVATE ${ZLIB_INCLUDE_DIR}) - target_link_libraries(gtest_zlib ${ZLIB_LIBRARIES}) + target_link_libraries(gtest_zlib external_zlib) endif() target_link_libraries(gtest_zlib zlibstatic GTest::GTest)