diff --git a/cmake/WebPConfig.cmake.in b/cmake/WebPConfig.cmake.in
index bb22164..3ad256f 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 "webp")
-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()
