summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-10-14 13:08:18 +0000
committerKitware Robot <kwrobot@kitware.com>2022-10-14 09:08:31 -0400
commit83663325f664af7ddcf3ecdff746d30d9fca3420 (patch)
treef715251d20898f5ae5b86ffc79371fbd9afcfd23
parentb2774b380ee33475b807b5f1bdbeeffc81aacb45 (diff)
parentcf612440dc7e925ceff5df22ff6320fdfdd46b17 (diff)
downloadcmake-83663325f664af7ddcf3ecdff746d30d9fca3420.tar.gz
Merge topic 'FindZLIB-no-components'
cf612440dc FindZLIB: Fail if components are requested as it does not provide any Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !7767
-rw-r--r--Modules/FindZLIB.cmake11
1 files changed, 10 insertions, 1 deletions
diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake
index be5c775b20..cfe67158f1 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})