diff options
author | Brad King <brad.king@kitware.com> | 2022-09-07 13:42:02 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-09-07 13:42:11 (GMT) |
commit | 9a916eaae3f9ddf668d1c4194b268738b1b18c9b (patch) | |
tree | 3068528c7d00d98aade5a3e58e57b51ff69e77ed /Modules | |
parent | 79e37d3d614e303ad0b8c83a0a4fa33ee91d730f (diff) | |
parent | 67b6f1a09b3e14373ba5683d11300a145c80877f (diff) | |
download | CMake-9a916eaae3f9ddf668d1c4194b268738b1b18c9b.zip CMake-9a916eaae3f9ddf668d1c4194b268738b1b18c9b.tar.gz CMake-9a916eaae3f9ddf668d1c4194b268738b1b18c9b.tar.bz2 |
Merge topic 'zlib-windows-cross-compile-fix' into release-3.24
67b6f1a09b FindZLIB: fix CMAKE_FIND_LIBRARY_PREFIXES being unset when it was empty
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7647
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindZLIB.cmake | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake index f50116f..be5c775 100644 --- a/Modules/FindZLIB.cmake +++ b/Modules/FindZLIB.cmake @@ -92,8 +92,16 @@ endforeach() # Allow ZLIB_LIBRARY to be set manually, as the location of the zlib library if(NOT ZLIB_LIBRARY) - set(_zlib_ORIG_CMAKE_FIND_LIBRARY_PREFIXES ${CMAKE_FIND_LIBRARY_PREFIXES}) - set(_zlib_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) + if(DEFINED CMAKE_FIND_LIBRARY_PREFIXES) + set(_zlib_ORIG_CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}") + else() + set(_zlib_ORIG_CMAKE_FIND_LIBRARY_PREFIXES) + endif() + if(DEFINED CMAKE_FIND_LIBRARY_SUFFIXES) + set(_zlib_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_FIND_LIBRARY_SUFFIXES}") + else() + set(_zlib_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES) + endif() # Prefix/suffix of the win32/Makefile.gcc build if(WIN32) list(APPEND CMAKE_FIND_LIBRARY_PREFIXES "" "lib") @@ -114,8 +122,16 @@ if(NOT ZLIB_LIBRARY) endforeach() # Restore the original find library ordering - set(CMAKE_FIND_LIBRARY_SUFFIXES ${_zlib_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) - set(CMAKE_FIND_LIBRARY_PREFIXES ${_zlib_ORIG_CMAKE_FIND_LIBRARY_PREFIXES}) + if(DEFINED _zlib_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES) + set(CMAKE_FIND_LIBRARY_SUFFIXES "${_zlib_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}") + else() + set(CMAKE_FIND_LIBRARY_SUFFIXES) + endif() + if(DEFINED _zlib_ORIG_CMAKE_FIND_LIBRARY_PREFIXES) + set(CMAKE_FIND_LIBRARY_PREFIXES "${_zlib_ORIG_CMAKE_FIND_LIBRARY_PREFIXES}") + else() + set(CMAKE_FIND_LIBRARY_PREFIXES) + endif() include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) select_library_configurations(ZLIB) |