Skip to content

[freetype] Fix INTERFACE_LINK_LIBRARIES in exported cmake file#14499

Merged
strega-nil merged 4 commits intomicrosoft:masterfrom
JackBoosY:dev/jack/9952
Nov 12, 2020
Merged

[freetype] Fix INTERFACE_LINK_LIBRARIES in exported cmake file#14499
strega-nil merged 4 commits intomicrosoft:masterfrom
JackBoosY:dev/jack/9952

Conversation

@JackBoosY
Copy link
Contributor

@JackBoosY JackBoosY commented Nov 10, 2020

Fix wrong INTERFACE_LINK_LIBRARIES in freetype-config.cmake:

set_target_properties(freetype PROPERTIES
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include;${_IMPORT_PREFIX}/include/freetype"
  INTERFACE_LINK_LIBRARIES "/mnt/d/xlinux/installed/x64-linux/debug/lib/libz.a;\$<\$<NOT:\$<CONFIG:DEBUG>>:/mnt/d/xlinux/installed/x64-linux/lib/libbz2.a>;\$<\$<CONFIG:DEBUG>:/mnt/d/xlinux/installed/x64-linux/debug/lib/libbz2d.a>;\$<\$<NOT:\$<CONFIG:DEBUG>>:/mnt/d/xlinux/installed/x64-linux/debug/lib/libpng.a>;\$<\$<CONFIG:DEBUG>:/mnt/d/xlinux/installed/x64-linux/debug/lib/libpng16d.a>;/mnt/d/xlinux/installed/x64-linux/debug/lib/libz.a"
)

Fixes #9952.

@JackBoosY JackBoosY added category:port-bug The issue is with a library, which is something the port should already support info:internal labels Nov 10, 2020
@JackBoosY JackBoosY marked this pull request as ready for review November 10, 2020 09:59
@JackBoosY JackBoosY requested a review from PhoebeHui November 11, 2020 02:45
@PhoebeHui PhoebeHui added the info:needs-maintainer-attention Lets the current 'on rotation' vcpkg maintainer know they need to look at this. label Nov 11, 2020
set(PKG_CONFIG_REQUIRED_PRIVATE "")

if (ZLIB_FOUND)
- target_link_libraries(freetype PRIVATE ${ZLIB_LIBRARIES})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

${ZLIB_LIBRARIES} is correct, but it's value is not optimized;...;debug;..., so different values are generated in INTERFACE_LINK_LIBRARIES in freetype-config.cmake, and vcpkg_fixup_cmake_targets deletes the debug freetype-config.cmake, which causes this problem.
We should avoid using the macros provided by cmake's module.

That means ZLIB requires a wrapper to correctly set that value on Linux. You are just dropping a droplet of water on a hot stone with that patch. You might have fixed freetype but all other ports using ZLIB_LIBRARIES still have the same problem. The root cause ist that ZLIB_LIBRARIES is not correctly set with debug/optimized keywords and needs fixing on Linux/OSX.

Copy link
Contributor Author

@JackBoosY JackBoosY Nov 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

${ZLIB_LIBRARIES} is correct, but it's value is not optimized;...;debug;..., so different values are generated in INTERFACE_LINK_LIBRARIES in freetype-config.cmake, and vcpkg_fixup_cmake_targets deletes the debug freetype-config.cmake, which causes this problem.
We should avoid using the macros provided by cmake's module.

That means ZLIB requires a wrapper to correctly set that value on Linux. You are just dropping a droplet of water on a hot stone with that patch. You might have fixed freetype but all other ports using ZLIB_LIBRARIES still have the same problem. The root cause ist that ZLIB_LIBRARIES is not correctly set with debug/optimized keywords and needs fixing on Linux/OSX.

This means that all module modes(Find*.cmake) that call cmake by default have a high probability of this problem. So I think we should deal with it uniformly (by vcpkg, not by port).

@strega-nil strega-nil merged commit f50c0ea into microsoft:master Nov 12, 2020
@strega-nil
Copy link
Contributor

Merged as "makes the experience better, but it'd be great to fix the underlying issues"

@JackBoosY JackBoosY deleted the dev/jack/9952 branch November 13, 2020 02:21
@JackBoosY
Copy link
Contributor Author

In order to prevent this from happening, we at least need to find in POST_CHECK whether there is a release version of the library in *config.cmake / *targets.cmake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category:port-bug The issue is with a library, which is something the port should already support info:needs-maintainer-attention Lets the current 'on rotation' vcpkg maintainer know they need to look at this.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[freetype] (Linux) Wrong INTERFACE_LINK_LIBRARIES in config

5 participants