diff options
Diffstat (limited to 'Source/Modules/CMakeBuildUtilities.cmake')
-rw-r--r-- | Source/Modules/CMakeBuildUtilities.cmake | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/Source/Modules/CMakeBuildUtilities.cmake b/Source/Modules/CMakeBuildUtilities.cmake index 4823adf..f217f9b 100644 --- a/Source/Modules/CMakeBuildUtilities.cmake +++ b/Source/Modules/CMakeBuildUtilities.cmake @@ -114,18 +114,20 @@ endif() #--------------------------------------------------------------------- # Build zlib library for Curl, CMake, and CTest. -set(CMAKE_ZLIB_HEADER "cm_zlib.h") if(CMAKE_USE_SYSTEM_ZLIB) find_package(ZLIB) if(NOT ZLIB_FOUND) message(FATAL_ERROR "CMAKE_USE_SYSTEM_ZLIB is ON but a zlib is not found!") endif() - set(CMAKE_ZLIB_INCLUDES ${ZLIB_INCLUDE_DIR}) - set(CMAKE_ZLIB_LIBRARIES ${ZLIB_LIBRARIES}) else() - set(CMAKE_ZLIB_INCLUDES ${CMake_SOURCE_DIR}/Utilities) - set(CMAKE_ZLIB_LIBRARIES cmzlib) + if(NOT POLICY CMP0102) # CMake < 3.17 + # Store in cache to protect from mark_as_advanced. + set(ZLIB_INCLUDE_DIR ${CMake_SOURCE_DIR}/Utilities CACHE PATH "") + else() + set(ZLIB_INCLUDE_DIR ${CMake_SOURCE_DIR}/Utilities) + endif() + set(ZLIB_LIBRARY cmzlib) set(WITHOUT_ZLIB_DLL "") set(WITHOUT_ZLIB_DLL_WITH_LIB cmzlib) set(ZLIB_DLL "") @@ -134,6 +136,7 @@ else() set(ZLIB_WINAPI_COMPILED 0) set(ZLIB_WINAPI_WITH_LIB cmzlib) add_subdirectory(Utilities/cmzlib) + add_library(ZLIB::ZLIB ALIAS cmzlib) CMAKE_SET_TARGET_FOLDER(cmzlib "Utilities/3rdParty") endif() @@ -148,9 +151,6 @@ if(CMAKE_USE_SYSTEM_CURL) set(CMAKE_CURL_INCLUDES ${CURL_INCLUDE_DIRS}) set(CMAKE_CURL_LIBRARIES ${CURL_LIBRARIES}) else() - set(CURL_SPECIAL_ZLIB_H ${CMAKE_ZLIB_HEADER}) - set(CURL_SPECIAL_LIBZ_INCLUDES ${CMAKE_ZLIB_INCLUDES}) - set(CURL_SPECIAL_LIBZ ${CMAKE_ZLIB_LIBRARIES}) set(CMAKE_CURL_INCLUDES) set(CMAKE_CURL_LIBRARIES cmcurl) if(CMAKE_TESTS_CDASH_SERVER) @@ -263,8 +263,6 @@ if(CMAKE_USE_SYSTEM_LIBARCHIVE) else() set(EXPAT_INCLUDE_DIR ${CMAKE_EXPAT_INCLUDES}) set(EXPAT_LIBRARY ${CMAKE_EXPAT_LIBRARIES}) - set(ZLIB_INCLUDE_DIR ${CMAKE_ZLIB_INCLUDES}) - set(ZLIB_LIBRARY ${CMAKE_ZLIB_LIBRARIES}) add_compile_definitions(LIBARCHIVE_STATIC) set(ENABLE_MBEDTLS OFF) set(ENABLE_NETTLE OFF) |