vcpkg/ports/libwebp/0002-cmake-config-add-backwards-compatibility.patch
JonLiu1993 8e0a801c62
[libwebp] update to 1.2.1 (#20152)
* [libwebp] update to 1.2.1

* update version

* Convert patch CRLF to LF

* update version

* update patch and portfile,cmake

* update version

* update portifile.cmake

* update portfile.cmake

* update version

* update portfile.cmake

* update version

* revert portfile.cmake

* update version

* add trailing line break

* update version
2021-09-27 17:51:56 -07:00

70 lines
2.6 KiB
Diff

diff --git a/cmake/WebPConfig.cmake.in b/cmake/WebPConfig.cmake.in
index 822fc59..cef75fe 100644
--- a/cmake/WebPConfig.cmake.in
+++ b/cmake/WebPConfig.cmake.in
@@ -4,8 +4,60 @@ set(WEBP_VERSION ${WebP_VERSION})
@PACKAGE_INIT@
include ("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
+include(${CMAKE_ROOT}/Modules/SelectLibraryConfigurations.cmake)
-set(WebP_INCLUDE_DIRS "@CMAKE_INSTALL_FULL_INCLUDEDIR@")
-set(WEBP_INCLUDE_DIRS ${WebP_INCLUDE_DIRS})
-set(WebP_LIBRARIES "@INSTALLED_LIBRARIES@")
-set(WEBP_LIBRARIES "${WebP_LIBRARIES}")
+find_path(WEBP_INCLUDE_DIR NAMES webp/types.h)
+set(WebP_INCLUDE_DIR ${WEBP_INCLUDE_DIR})
+set(WebP_INCLUDE_DIRS ${WEBP_INCLUDE_DIR})
+set(WEBP_INCLUDE_DIRS ${WEBP_INCLUDE_DIR})
+
+if(NOT WEBP_BASE_LIBRARY AND NOT WebP_BASE_LIBRARY)
+ find_library(WEBP_BASE_LIBRARY_RELEASE NAMES webp)
+ find_library(WEBP_BASE_LIBRARY_DEBUG NAMES webpd)
+ select_library_configurations(WEBP_BASE)
+ set(WebP_BASE_LIBRARY ${WEBP_BASE_LIBRARY})
+ if(WEBP_BASE_LIBRARY)
+ list(APPEND WEBP_LIBRARIES "${WEBP_BASE_LIBRARY}")
+ list(APPEND WebP_LIBRARIES "${WebP_BASE_LIBRARY}")
+ endif()
+endif()
+
+if(NOT WEBP_DECODER_LIBRARY AND NOT WebP_DECODER_LIBRARY)
+ find_library(WEBP_DECODER_LIBRARY_RELEASE NAMES webpdecoder)
+ find_library(WEBP_DECODER_LIBRARY_DEBUG NAMES webpdecoderd)
+ select_library_configurations(WEBP_DECODER)
+ set(WebP_DECODER_LIBRARY ${WEBP_DECODER_LIBRARY})
+ if(WEBP_DECODER_LIBRARY)
+ list(APPEND WEBP_LIBRARIES "${WEBP_DECODER_LIBRARY}")
+ list(APPEND WebP_LIBRARIES "${WebP_DECODER_LIBRARY}")
+ endif()
+endif()
+
+if(NOT WEBP_DEMUX_LIBRARY AND NOT WebP_DEMUX_LIBRARY)
+ find_library(WEBP_DEMUX_LIBRARY_RELEASE NAMES webpdemux)
+ find_library(WEBP_DEMUX_LIBRARY_DEBUG NAMES webpdemuxd)
+ select_library_configurations(WEBP_DEMUX)
+ set(WebP_DEMUX_LIBRARY ${WEBP_DEMUX_LIBRARY})
+ if(WEBP_DEMUX_LIBRARY)
+ list(APPEND WEBP_LIBRARIES "${WEBP_DEMUX_LIBRARY}")
+ list(APPEND WebP_LIBRARIES "${WebP_DEMUX_LIBRARY}")
+ endif()
+endif()
+
+if(NOT WEBP_MUX_LIBRARY AND NOT WebP_MUX_LIBRARY)
+ find_library(WEBP_MUX_LIBRARY_RELEASE NAMES libwebpmux)
+ find_library(WEBP_MUX_LIBRARY_DEBUG NAMES libwebpmuxd)
+ select_library_configurations(WEBP_MUX)
+ set(WebP_MUX_LIBRARY ${WEBP_MUX_LIBRARY})
+ if(WEBP_MUX_LIBRARY)
+ list(APPEND WEBP_LIBRARIES "${WEBP_MUX_LIBRARY}")
+ list(APPEND WebP_LIBRARIES "${WebP_MUX_LIBRARY}")
+ endif()
+endif()
+
+set(WEBP_LIBRARY ${WEBP_BASE_LIBRARY})
+set(WebP_LIBRARY ${WebP_BASE_LIBRARY})
+if(WEBP_BASE_LIBRARY AND WEBP_INCLUDE_DIR)
+ set(WEBP_FOUND 1)
+ set(WebP_FOUND 1)
+endif()