mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-28 04:49:08 +08:00
0f6d405151
Fix #39141. Fix the library name for `pkg-config` is `z-ng` but output name is `zlib-ng[d].lib` for windows.
54 lines
2.1 KiB
CMake
54 lines
2.1 KiB
CMake
vcpkg_from_github(
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
REPO zlib-ng/zlib-ng
|
|
REF "${VERSION}"
|
|
SHA512 9212d87c63a2da4e5355a7a1c75380aeba40fbd0ea3d71d3784cb3eac94237f9bea2a1b7993a08f39d4197725c4c133087d3a9d213d3944aa48a7559de2be920
|
|
HEAD_REF develop
|
|
)
|
|
|
|
vcpkg_cmake_configure(
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
|
OPTIONS
|
|
"-DZLIB_FULL_VERSION=${ZLIB_FULL_VERSION}"
|
|
-DZLIB_ENABLE_TESTS=OFF
|
|
-DWITH_NEW_STRATEGIES=ON
|
|
OPTIONS_RELEASE
|
|
-DWITH_OPTIM=ON
|
|
)
|
|
vcpkg_cmake_install()
|
|
vcpkg_copy_pdbs()
|
|
|
|
# Condition in `WIN32`, from https://github.com/zlib-ng/zlib-ng/blob/2.1.5/CMakeLists.txt#L1081-L1100
|
|
# (dynamic) for `zlib` or (static `MSVC) for `zlibstatic` or default `z`
|
|
# i.e. (windows) and not (static mingw) https://learn.microsoft.com/en-us/vcpkg/maintainers/variables#vcpkg_target_is_system
|
|
if(VCPKG_TARGET_IS_WINDOWS AND (NOT (VCPKG_LIBRARY_LINKAGE STREQUAL static AND VCPKG_TARGET_IS_MINGW)))
|
|
set(_port_suffix)
|
|
if(ZLIB_COMPAT)
|
|
set(_port_suffix "")
|
|
else()
|
|
set(_port_suffix "-ng")
|
|
endif()
|
|
|
|
set(_port_output_name)
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
|
set(_port_output_name "zlib${_port_suffix}")
|
|
else()
|
|
set(_port_output_name "zlibstatic${_port_suffix}")
|
|
endif()
|
|
|
|
# CMAKE_DEBUG_POSTFIX from https://github.com/zlib-ng/zlib-ng/blob/2.1.5/CMakeLists.txt#L494
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/zlib${_port_suffix}.pc" " -lz${_port_suffix}" " -l${_port_output_name}")
|
|
endif()
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/zlib${_port_suffix}.pc" " -lz${_port_suffix}" " -l${_port_output_name}d")
|
|
endif()
|
|
endif()
|
|
|
|
vcpkg_fixup_pkgconfig()
|
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share"
|
|
"${CURRENT_PACKAGES_DIR}/debug/include"
|
|
)
|
|
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.md")
|