Describe the bug
ZLIB triies to find libz but its named zlib.lib on Windows
Environment
To Reproduce
Steps to reproduce the behavior:
Expected behavior
It should look for zlib.lib when cross-compiling
Fix
It seems the variable VCPKG_TARGET_IS_WINDOWS in scripts/cmake/vcpkg_common_definitions.cmake is not set when cross-compiling.
Maybe you should add a check for the Windows target if VCPKG_CMAKE_SYSTEM_NAME is Windows.
For now, I've added set(VCPKG_TARGET_IS_WINDOWS 1) in my triplet and that fixes the zlib build.
Additional context
My custom triplet:
set(VCPKG_TARGET_ARCHITECTURE x86)
set(VCPKG_CRT_LINKAGE static)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_BUILD_TYPE release)
set(VCPKG_CMAKE_SYSTEM_NAME Windows)
# For clang_windows toolchain
set(ENV{HOST_ARCH} ${VCPKG_TARGET_ARCHITECTURE})
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE /clang_windows_sdk/clang-cl-msvc.cmake)
set(VCPKG_CMAKE_SYSTEM_NAME Windows)
unset this and instead add
set(CMAKE_SYSTEM_NAME Windows)
into your toolchain
within vcpkg and unset VCPKG_CMAKE_SYSTEM_NAME means Windows.
set(VCPKG_CMAKE_SYSTEM_NAME Windows)
unset this and instead add
set(CMAKE_SYSTEM_NAME Windows)
into your toolchainwithin vcpkg and unset VCPKG_CMAKE_SYSTEM_NAME means Windows.
It is already set in my toolchain.
Most helpful comment
unset this and instead add
set(CMAKE_SYSTEM_NAME Windows)into your toolchain
within vcpkg and unset VCPKG_CMAKE_SYSTEM_NAME means Windows.