summaryrefslogtreecommitdiffstats
path: root/Modules/FindZLIB.cmake
diff options
context:
space:
mode:
authorkoostosh <koostosh@gmail.com>2022-10-08 16:56:12 (GMT)
committerBrad King <brad.king@kitware.com>2022-10-12 19:08:14 (GMT)
commitcf612440dc7e925ceff5df22ff6320fdfdd46b17 (patch)
tree87dafef820ce8dd1a6d31e0df71a107f55c4e488 /Modules/FindZLIB.cmake
parent7629a1182cf9006e4e83c1094794d935503dd079 (diff)
downloadCMake-cf612440dc7e925ceff5df22ff6320fdfdd46b17.zip
CMake-cf612440dc7e925ceff5df22ff6320fdfdd46b17.tar.gz
CMake-cf612440dc7e925ceff5df22ff6320fdfdd46b17.tar.bz2
FindZLIB: Fail if components are requested as it does not provide any
Fixes: #18872
Diffstat (limited to 'Modules/FindZLIB.cmake')
-rw-r--r--Modules/FindZLIB.cmake11
1 files changed, 10 insertions, 1 deletions
diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake
index be5c775..cfe6715 100644
--- a/Modules/FindZLIB.cmake
+++ b/Modules/FindZLIB.cmake
@@ -60,6 +60,14 @@ module where to look.
#]=======================================================================]
+if(ZLIB_FIND_COMPONENTS AND NOT ZLIB_FIND_QUIETLY)
+ message(AUTHOR_WARNING
+ "ZLIB does not provide any COMPONENTS. Calling\n"
+ " find_package(ZLIB COMPONENTS ...)\n"
+ "will always fail."
+ )
+endif()
+
set(_ZLIB_SEARCHES)
# Search ZLIB_ROOT first if it is set.
@@ -164,7 +172,8 @@ endif()
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB REQUIRED_VARS ZLIB_LIBRARY ZLIB_INCLUDE_DIR
- VERSION_VAR ZLIB_VERSION_STRING)
+ VERSION_VAR ZLIB_VERSION_STRING
+ HANDLE_COMPONENTS)
if(ZLIB_FOUND)
set(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR})