FindFreetype puts $<LINK_ONLY:ZLIB::ZLIB> into FREETYPE_LIBRARIES in 3.28
In vcpkg we recently tried to upgrade our copy of CMake on the macOS test lab to 3.28. In this version, we observe that FREETYPE_LIBRARIES
now contains $<LINK_ONLY:ZLIB::ZLIB>
. This matches installed/arm64-osx/share/freetype/freetype-targets.cmake
which says:
set_target_properties(freetype PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
INTERFACE_LINK_LIBRARIES "\$<LINK_ONLY:ZLIB::ZLIB>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${VCPKG_IMPORT_PREFIX}/lib/libbz2.a>;\$<\$<CONFIG:DEBUG>:${VCPKG_IMPORT_PREFIX}/debug/lib/libbz2d.a>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${VCPKG_IMPORT_PREFIX}/lib/libpng16.a>;\$<\$<CONFIG:DEBUG>:${VCPKG_IMPORT_PREFIX}/debug/lib/libpng16d.a>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${VCPKG_IMPORT_PREFIX}/lib/libz.a>;\$<\$<CONFIG:DEBUG>:${VCPKG_IMPORT_PREFIX}/debug/lib/libz.a>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${VCPKG_IMPORT_PREFIX}/lib/libbrotlidec.a>;\$<\$<CONFIG:DEBUG>:${VCPKG_IMPORT_PREFIX}/debug/lib/libbrotlidec.a>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${VCPKG_IMPORT_PREFIX}/lib/libbrotlicommon.a>;\$<\$<CONFIG:DEBUG>:${VCPKG_IMPORT_PREFIX}/debug/lib/libbrotlicommon.a>"
)
Unfortunately, allegro5
is expecting FREETYPE_LIBRARIES
to be a list of libraries, and is setting that to CMAKE_LIBRARIES_REQUIRED
for use with CheckCSourceCompiles
:
which now causes a failure with:
CMake Error at /Users/vcpkg/Data/b/allegro5/arm64-osx-dbg/CMakeFiles/CMakeScratch/TryCompile-siHtUu/CMakeLists.txt:25 (target_link_libraries):
Target "cmTC_a0f16" links to:
ZLIB::ZLIB
but the target was not found. Possible reasons include:
* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.
It looks like this change in behavior may be due to d83d9250 /cc @brad.king
Should this change in behavior be behind a CMake policy flag? Is there something we are doing incorrectly that causes this LINK_ONLY
generator expression to end up in FREETYPE_LIBRARIES
? Is what Allegro5 is doing wrong for some reason?
Thanks folks, and sorry I don't have enough of an understanding of all the moving parts to make a self contained repro!