aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Romero <romerosanchezv@gmail.com>2019-08-30 01:15:10 -0700
committerGitHub <noreply@github.com>2019-08-30 01:15:10 -0700
commitdc61560b9e6983f97823c430d72d5b24c8d72fd3 (patch)
tree9a34135fee3dbcf229144605dfd4286be066a2b2
parent9e68729bb6b62537314c7ab315c2dcf6dc2476b0 (diff)
downloadvcpkg-dc61560b9e6983f97823c430d72d5b24c8d72fd3.tar.gz
vcpkg-dc61560b9e6983f97823c430d72d5b24c8d72fd3.zip
[libpng] Fix find_package() in CONFIG mode (#7968) (#7972)
* Fix find_package(libpng CONFIG) * Fix typos
-rw-r--r--ports/libpng/CONTROL2
-rw-r--r--ports/libpng/libpngConfig.cmake6
-rw-r--r--ports/libpng/portfile.cmake1
3 files changed, 8 insertions, 1 deletions
diff --git a/ports/libpng/CONTROL b/ports/libpng/CONTROL
index f813439d8..c77b2a9d1 100644
--- a/ports/libpng/CONTROL
+++ b/ports/libpng/CONTROL
@@ -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.
diff --git a/ports/libpng/libpngConfig.cmake b/ports/libpng/libpngConfig.cmake
new file mode 100644
index 000000000..18108035a
--- /dev/null
+++ b/ports/libpng/libpngConfig.cmake
@@ -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")
diff --git a/ports/libpng/portfile.cmake b/ports/libpng/portfile.cmake
index 7262d34c7..7e4fc8b04 100644
--- a/ports/libpng/portfile.cmake
+++ b/ports/libpng/portfile.cmake
@@ -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)