[libpng] Fix find_package() in CONFIG mode (#7968) (#7972)

* Fix find_package(libpng CONFIG)

* Fix typos
This commit is contained in:
Victor Romero 2019-08-30 01:15:10 -07:00 committed by GitHub
parent 9e68729bb6
commit dc61560b9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 1 deletions

View File

@ -1,5 +1,5 @@
Source: libpng
Version: 1.6.37-2
Version: 1.6.37-3
Build-Depends: zlib
Homepage: https://github.com/glennrp/libpng
Description: libpng is a library implementing an interface for reading and writing PNG (Portable Network Graphics) format files.

View File

@ -0,0 +1,6 @@
# The upstream CMakeLists.txt exports libpng's targets to a file named `libpng16.cmake`.
# However, `find_package(libpng CONFIG)` expects a file named `libpngConfig.cmake` to exist instead.
#
# By including `libpng.cmake` from this file, `find_package(libpng CONFIG)` will work.
get_filename_component(_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
include("${_DIR}/libpng16.cmake")

View File

@ -46,6 +46,7 @@ endif()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/libpng)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share/)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/libpngConfig.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/libpng)
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libpng)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/libpng/LICENSE ${CURRENT_PACKAGES_DIR}/share/libpng/copyright)