-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[freetype] Fix INTERFACE_LINK_LIBRARIES in exported cmake file #14499
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 04ce73a..ee3cc05 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -454,7 +454,7 @@ endif () | ||
set(PKG_CONFIG_REQUIRED_PRIVATE "") | ||
|
||
if (ZLIB_FOUND) | ||
- target_link_libraries(freetype PRIVATE ${ZLIB_LIBRARIES}) | ||
+ target_link_libraries(freetype PRIVATE ZLIB::ZLIB) | ||
target_include_directories(freetype PRIVATE ${ZLIB_INCLUDE_DIRS}) | ||
list(APPEND PKG_CONFIG_REQUIRED_PRIVATE "zlib") | ||
endif () | ||
@@ -562,8 +562,15 @@ if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL) | ||
install( | ||
EXPORT freetype-targets | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/freetype | ||
- FILE freetype-config.cmake | ||
COMPONENT headers) | ||
+ | ||
+ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/freetype-config.cmake" | ||
+[[include(CMakeFindDependencyMacro) | ||
+find_dependency(ZLIB) | ||
+include("${CMAKE_CURRENT_LIST_DIR}/freetype-targets.cmake") | ||
+]]) | ||
+ | ||
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freetype-config.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/freetype) | ||
endif () | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index b45e878..19f8692 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -536,7 +536,7 @@ if(PNG_SHARED) | ||
set_target_properties(png PROPERTIES PREFIX "lib") | ||
set_target_properties(png PROPERTIES IMPORT_PREFIX "lib") | ||
endif() | ||
- target_link_libraries(png ${ZLIB_LIBRARY} ${M_LIBRARY}) | ||
+ target_link_libraries(png ZLIB::ZLIB ${M_LIBRARY}) | ||
|
||
if(UNIX AND AWK) | ||
if(HAVE_LD_VERSION_SCRIPT) | ||
@@ -564,7 +564,7 @@ if(PNG_STATIC) | ||
# msvc does not append 'lib' - do it here to have consistent name | ||
set_target_properties(png_static PROPERTIES PREFIX "lib") | ||
endif() | ||
- target_link_libraries(png_static ${ZLIB_LIBRARY} ${M_LIBRARY}) | ||
+ target_link_libraries(png_static ZLIB::ZLIB ${M_LIBRARY}) | ||
endif() | ||
|
||
if(PNG_FRAMEWORK) | ||
@@ -581,7 +581,7 @@ if(PNG_FRAMEWORK) | ||
XCODE_ATTRIBUTE_INSTALL_PATH "@rpath" | ||
PUBLIC_HEADER "${libpng_public_hdrs}" | ||
OUTPUT_NAME png) | ||
- target_link_libraries(png_framework ${ZLIB_LIBRARY} ${M_LIBRARY}) | ||
+ target_link_libraries(png_framework ZLIB::ZLIB ${M_LIBRARY}) | ||
endif() | ||
|
||
if(NOT PNG_LIB_TARGETS) | ||
@@ -746,7 +746,7 @@ if(PNG_SHARED) | ||
set(PNG_BIN_TARGETS pngfix) | ||
|
||
add_executable(png-fix-itxt ${png_fix_itxt_sources}) | ||
- target_link_libraries(png-fix-itxt ${ZLIB_LIBRARY} ${M_LIBRARY}) | ||
+ target_link_libraries(png-fix-itxt ZLIB::ZLIB ${M_LIBRARY}) | ||
list(APPEND PNG_BIN_TARGETS png-fix-itxt) | ||
endif() | ||
|
||
@@ -851,7 +851,7 @@ endif() | ||
# INSTALL | ||
if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL) | ||
install(TARGETS ${PNG_LIB_TARGETS} | ||
- EXPORT libpng | ||
+ EXPORT libpng-targets | ||
RUNTIME DESTINATION bin | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
@@ -919,7 +919,14 @@ endif() | ||
|
||
# Create an export file that CMake users can include() to import our targets. | ||
if(NOT SKIP_INSTALL_EXPORT AND NOT SKIP_INSTALL_ALL) | ||
- install(EXPORT libpng DESTINATION lib/libpng FILE libpngConfig.cmake) | ||
+ install(EXPORT libpng-targets DESTINATION lib/libpng) | ||
+ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/libpng-config.cmake" | ||
+ [[include(CMakeFindDependencyMacro) | ||
+find_dependency(ZLIB) | ||
+include("${CMAKE_CURRENT_LIST_DIR}/libpng-targets.cmake") | ||
+ ]]) | ||
+ | ||
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng-config.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/libpng) | ||
endif() | ||
|
||
# what's with libpng-manual.txt and all the extra files? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 thatZLIB_LIBRARIES
is not correctly set with debug/optimized keywords and needs fixing on Linux/OSX.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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).