From ac9c6f53a5e1d0637fb390f1cd7b44bd8c38d72e Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Tue, 27 Oct 2020 11:49:17 +0100 Subject: MDEV-24034 Policy CMP0075 is not set during compile The policy is not set for 10.2 If it is set, CMake would complain about bundled zlib for which the policy is not set. Fix: - Set policy for 10.2 for the top level project. For 10.3+ it was already set - Cleanup zlib to remove unneeded stuff. It is an internal static library, it needs none of PROJECT, library versioning, RC file on Windows. The name of the library on Unix does not make any difference, since it is static and compiled in. --- CMakeLists.txt | 3 +++ zlib/CMakeLists.txt | 39 --------------------------------------- 2 files changed, 3 insertions(+), 39 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4734c6f7d5f..466b2a5bc3a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,6 +37,9 @@ ENDIF() IF(POLICY CMP0054) CMAKE_POLICY(SET CMP0054 NEW) ENDIF() +IF(POLICY CMP0075) + CMAKE_POLICY(SET CMP0075 NEW) +ENDIF() MESSAGE(STATUS "Running cmake version ${CMAKE_VERSION}") diff --git a/zlib/CMakeLists.txt b/zlib/CMakeLists.txt index 810ec8ae0cb..ee79bc0bd5f 100644 --- a/zlib/CMakeLists.txt +++ b/zlib/CMakeLists.txt @@ -13,12 +13,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA -cmake_minimum_required(VERSION 2.4.4) -set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) - -project(zlib C) - -set(VERSION "1.2.11") include(CheckTypeSize) include(CheckFunctionExists) @@ -110,40 +104,7 @@ set(ZLIB_SRCS zutil.c ) -if(NOT MINGW) - set(ZLIB_DLL_SRCS - win32/zlib1.rc # If present will override custom build rule below. - ) -endif() - -# parse the full version number from zlib.h and include in ZLIB_FULL_VERSION -file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents) -string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*" - "\\1" ZLIB_FULL_VERSION ${_zlib_h_contents}) - ADD_CONVENIENCE_LIBRARY(zlib STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) RESTRICT_SYMBOL_EXPORTS(zlib) - -if(NOT CYGWIN) - # This property causes shared libraries on Linux to have the full version - # encoded into their final filename. We disable this on Cygwin because - # it causes cygz-${ZLIB_FULL_VERSION}.dll to be created when cygz.dll - # seems to be the default. - # - # This has no effect with MSVC, on that platform the version info for - # the DLL comes from the resource file win32/zlib1.rc - set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION}) -endif() - -if(CMAKE_SYSTEM_NAME MATCHES "SunOS") - # On unix-like platforms the library is almost always called libz - set_target_properties(zlib PROPERTIES OUTPUT_NAME z) -elseif(UNIX) - # On unix-like platforms the library is almost always called libz - set_target_properties(zlib PROPERTIES OUTPUT_NAME z) -endif() - - -RESTRICT_SYMBOL_EXPORTS(zlib) -- cgit v1.2.1