From b7fb6d4209333a9575c6b584c86c925c00c081e1 Mon Sep 17 00:00:00 2001 From: Mizux Seiha Date: Wed, 1 Jul 2020 21:01:16 +0200 Subject: [PATCH] Update CMake --- .cmake-format.py | 232 ++++++++++++ CMakeLists.txt | 4 + cmake/cpp.cmake | 55 ++- cmake/dependencies/CMakeLists.txt | 272 +++++++------- patches/ZLIB.patch | 559 +++++++++++++++++++++++++++- patches/abseil-cpp-20200225.2.patch | 26 ++ patches/gflags-v2.2.2.patch | 39 ++ patches/protobuf-v3.12.2.patch | 17 +- patches/scip-7.0.1.patch | 14 + 9 files changed, 1045 insertions(+), 173 deletions(-) create mode 100644 .cmake-format.py create mode 100644 patches/abseil-cpp-20200225.2.patch create mode 100644 patches/gflags-v2.2.2.patch create mode 100644 patches/scip-7.0.1.patch diff --git a/.cmake-format.py b/.cmake-format.py new file mode 100644 index 0000000000..2a1ae01957 --- /dev/null +++ b/.cmake-format.py @@ -0,0 +1,232 @@ +# ---------------------------------- +# Options affecting listfile parsing +# ---------------------------------- +with section("parse"): + + # Specify structure for custom cmake functions + additional_commands = { + 'foo': { 'flags': ['BAR', 'BAZ'], + 'kwargs': {'DEPENDS': '*', + 'HEADERS': '*', + 'SOURCES': '*'}}, + 'build_git_dependency': { 'flags': [], + 'kwargs': { 'NAME': '*', + 'REPOSITORY': '*', + 'TAG': '*', + 'APPLY_PATCH': '*', + 'CMAKE_ARGS': '*'}} + } + + # Specify variable tags. + vartags = [] + + # Specify property tags. + proptags = [] + +# ----------------------------- +# Options affecting formatting. +# ----------------------------- +with section("format"): + + # How wide to allow formatted cmake files + line_width = 80 + + # How many spaces to tab for indent + tab_size = 2 + + # If an argument group contains more than this many sub-groups (parg or kwarg + # groups) then force it to a vertical layout. + max_subgroups_hwrap = 2 + + # If a positional argument group contains more than this many arguments, then + # force it to a vertical layout. + max_pargs_hwrap = 6 + + # If a cmdline positional group consumes more than this many lines without + # nesting, then invalidate the layout (and nest) + max_rows_cmdline = 2 + + # If true, separate flow control names from their parentheses with a space + separate_ctrl_name_with_space = False + + # If true, separate function names from parentheses with a space + separate_fn_name_with_space = False + + # If a statement is wrapped to more than one line, than dangle the closing + # parenthesis on its own line. + dangle_parens = False + + # If the trailing parenthesis must be 'dangled' on its on line, then align it + # to this reference: `prefix`: the start of the statement, `prefix-indent`: + # the start of the statement, plus one indentation level, `child`: align to + # the column of the arguments + dangle_align = 'prefix' + + # If the statement spelling length (including space and parenthesis) is + # smaller than this amount, then force reject nested layouts. + min_prefix_chars = 4 + + # If the statement spelling length (including space and parenthesis) is larger + # than the tab width by more than this amount, then force reject un-nested + # layouts. + max_prefix_chars = 10 + + # If a candidate layout is wrapped horizontally but it exceeds this many + # lines, then reject the layout. + max_lines_hwrap = 2 + + # What style line endings to use in the output. + line_ending = 'unix' + + # Format command names consistently as 'lower' or 'upper' case + command_case = 'canonical' + + # Format keywords consistently as 'lower' or 'upper' case + keyword_case = 'unchanged' + + # A list of command names which should always be wrapped + always_wrap = [] + + # If true, the argument lists which are known to be sortable will be sorted + # lexicographicall + enable_sort = True + + # If true, the parsers may infer whether or not an argument list is sortable + # (without annotation). + autosort = False + + # By default, if cmake-format cannot successfully fit everything into the + # desired linewidth it will apply the last, most agressive attempt that it + # made. If this flag is True, however, cmake-format will print error, exit + # with non-zero status code, and write-out nothing + require_valid_layout = False + + # A dictionary mapping layout nodes to a list of wrap decisions. See the + # documentation for more information. + layout_passes = {} + +# ------------------------------------------------ +# Options affecting comment reflow and formatting. +# ------------------------------------------------ +with section("markup"): + + # What character to use for bulleted lists + bullet_char = '*' + + # What character to use as punctuation after numerals in an enumerated list + enum_char = '.' + + # If comment markup is enabled, don't reflow the first comment block in each + # listfile. Use this to preserve formatting of your copyright/license + # statements. + first_comment_is_literal = False + + # If comment markup is enabled, don't reflow any comment block which matches + # this (regex) pattern. Default is `None` (disabled). + literal_comment_pattern = None + + # Regular expression to match preformat fences in comments default= + # ``r'^\s*([`~]{3}[`~]*)(.*)$'`` + fence_pattern = '^\\s*([`~]{3}[`~]*)(.*)$' + + # Regular expression to match rulers in comments default= + # ``r'^\s*[^\w\s]{3}.*[^\w\s]{3}$'`` + ruler_pattern = '^\\s*[^\\w\\s]{3}.*[^\\w\\s]{3}$' + + # If a comment line matches starts with this pattern then it is explicitly a + # trailing comment for the preceeding argument. Default is '#<' + explicit_trailing_pattern = '#<' + + # If a comment line starts with at least this many consecutive hash + # characters, then don't lstrip() them off. This allows for lazy hash rulers + # where the first hash char is not separated by space + hashruler_min_length = 10 + + # If true, then insert a space between the first hash char and remaining hash + # chars in a hash ruler, and normalize its length to fill the column + canonicalize_hashrulers = True + + # enable comment markup parsing and reflow + enable_markup = True + +# ---------------------------- +# Options affecting the linter +# ---------------------------- +with section("lint"): + + # a list of lint codes to disable + disabled_codes = [] + + # regular expression pattern describing valid function names + function_pattern = '[0-9a-z_]+' + + # regular expression pattern describing valid macro names + macro_pattern = '[0-9A-Z_]+' + + # regular expression pattern describing valid names for variables with global + # (cache) scope + global_var_pattern = '[A-Z][0-9A-Z_]+' + + # regular expression pattern describing valid names for variables with global + # scope (but internal semantic) + internal_var_pattern = '_[A-Z][0-9A-Z_]+' + + # regular expression pattern describing valid names for variables with local + # scope + local_var_pattern = '[a-z][a-z0-9_]+' + + # regular expression pattern describing valid names for privatedirectory + # variables + private_var_pattern = '_[0-9a-z_]+' + + # regular expression pattern describing valid names for public directory + # variables + public_var_pattern = '[A-Z][0-9A-Z_]+' + + # regular expression pattern describing valid names for function/macro + # arguments and loop variables. + argument_var_pattern = '[a-z][a-z0-9_]+' + + # regular expression pattern describing valid names for keywords used in + # functions or macros + keyword_pattern = '[A-Z][0-9A-Z_]+' + + # In the heuristic for C0201, how many conditionals to match within a loop in + # before considering the loop a parser. + max_conditionals_custom_parser = 2 + + # Require at least this many newlines between statements + min_statement_spacing = 1 + + # Require no more than this many newlines between statements + max_statement_spacing = 2 + max_returns = 6 + max_branches = 12 + max_arguments = 5 + max_localvars = 15 + max_statements = 50 + +# ------------------------------- +# Options affecting file encoding +# ------------------------------- +with section("encode"): + + # If true, emit the unicode byte-order mark (BOM) at the start of the file + emit_byteorder_mark = False + + # Specify the encoding of the input file. Defaults to utf-8 + input_encoding = 'utf-8' + + # Specify the encoding of the output file. Defaults to utf-8. Note that cmake + # only claims to support utf-8 so be careful when using anything else + output_encoding = 'utf-8' + +# ------------------------------------- +# Miscellaneous configurations options. +# ------------------------------------- +with section("misc"): + + # A dictionary containing any per-command configuration overrides. Currently + # only `command_case` is supported. + per_command = {} + diff --git a/CMakeLists.txt b/CMakeLists.txt index 662dc1b4b0..6cea79ace1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,6 +118,10 @@ CMAKE_DEPENDENT_OPTION(BUILD_ZLIB "Build the ZLIB dependency Library" OFF "NOT BUILD_DEPS" ON) message(STATUS "Build ZLIB: ${BUILD_ZLIB}") +CMAKE_DEPENDENT_OPTION(BUILD_SCIP "Build the SCIP dependency Library" OFF + "NOT BUILD_DEPS" ON) +message(STATUS "Build SCIP: ${BUILD_SCIP}") + CMAKE_DEPENDENT_OPTION(BUILD_absl "Build the abseil-cpp dependency Library" OFF "NOT BUILD_DEPS" ON) message(STATUS "Build abseil-cpp: ${BUILD_absl}") diff --git a/cmake/cpp.cmake b/cmake/cpp.cmake index a9145526de..212caf893b 100644 --- a/cmake/cpp.cmake +++ b/cmake/cpp.cmake @@ -13,15 +13,11 @@ find_package(Threads REQUIRED) set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE) # libprotobuf force us to depends on ZLIB::ZLIB target -if(BUILD_ZLIB) - find_package(ZLIB REQUIRED CONFIG) -else() +if(NOT BUILD_ZLIB) find_package(ZLIB REQUIRED) endif() -if(BUILD_absl) - find_package(absl REQUIRED CONFIG) -else() +if(NOT BUILD_absl) find_package(absl REQUIRED) endif() set(ABSL_DEPS @@ -40,54 +36,44 @@ set(ABSL_DEPS ) set(GFLAGS_USE_TARGET_NAMESPACE TRUE) -if(BUILD_gflags) - find_package(gflags REQUIRED CONFIG) - set(GFLAGS_DEP gflags::gflags_static) -else() +if(NOT BUILD_gflags) find_package(gflags REQUIRED) - set(GFLAGS_DEP gflags::gflags) endif() -if(BUILD_glog) - find_package(glog REQUIRED CONFIG) -else() +if(NOT BUILD_glog) find_package(glog REQUIRED) endif() -if(BUILD_Protobuf) - find_package(Protobuf REQUIRED CONFIG) -else() +if(NOT BUILD_Protobuf) find_package(Protobuf REQUIRED) +else() + if(${CMAKE_VERSION} VERSION_LESS "3.18") + find_package(Protobuf REQUIRED CONFIG) + endif() + + if(NOT TARGET protobuf::libprotobuf) + message(FATAL_ERROR "protobuf not builded") + endif() endif() if(USE_COINOR) - if(BUILD_CoinUtils) - find_package(CoinUtils REQUIRED CONFIG) - else() + if(NOT BUILD_CoinUtils) find_package(CoinUtils REQUIRED) endif() - if(BUILD_Osi) - find_package(Osi REQUIRED CONFIG) - else() + if(NOT BUILD_Osi) find_package(Osi REQUIRED) endif() - if(BUILD_Clp) - find_package(Clp REQUIRED CONFIG) - else() + if(NOT BUILD_Clp) find_package(Clp REQUIRED) endif() - if(BUILD_Cgl) - find_package(Cgl REQUIRED CONFIG) - else() + if(NOT BUILD_Cgl) find_package(Cgl REQUIRED) endif() - if(BUILD_Cbc) - find_package(Cbc REQUIRED CONFIG) - else() + if(NOT BUILD_Cbc) find_package(Cbc REQUIRED) endif() @@ -224,7 +210,7 @@ target_link_libraries(${PROJECT_NAME} PUBLIC ${CMAKE_DL_LIBS} ZLIB::ZLIB ${ABSL_DEPS} - ${GFLAGS_DEP} + gflags::gflags glog::glog protobuf::libprotobuf ${COINOR_DEPS} @@ -254,10 +240,11 @@ file(GLOB_RECURSE proto_files RELATIVE ${PROJECT_SOURCE_DIR} "ortools/linear_solver/*.proto" ) -# Get Protobuf include dir +## Get Protobuf include dir get_target_property(protobuf_dirs protobuf::libprotobuf INTERFACE_INCLUDE_DIRECTORIES) foreach(dir IN LISTS protobuf_dirs) if ("${dir}" MATCHES "BUILD_INTERFACE") + message(STATUS "Adding proto path: ${dir}") list(APPEND PROTO_DIRS "\"--proto_path=${dir}\"") endif() endforeach() diff --git a/cmake/dependencies/CMakeLists.txt b/cmake/dependencies/CMakeLists.txt index 269fb63a5d..dc6ce47113 100644 --- a/cmake/dependencies/CMakeLists.txt +++ b/cmake/dependencies/CMakeLists.txt @@ -1,11 +1,13 @@ -#################### -## SWIG (WIN32) ## -#################### -if(WIN32 AND (BUILD_PYTHON OR BUILD_JAVA OR BUILD_DOTNET)) +# ############################################################################## +# SWIG (WIN32) +# ############################################################################## +if(WIN32 + AND (BUILD_PYTHON + OR BUILD_JAVA + OR BUILD_DOTNET)) message(STATUS "Getting SWIG: ...") - configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/SWIG.CMakeLists.txt.in - ${CMAKE_CURRENT_BINARY_DIR}/SWIG/CMakeLists.txt @ONLY) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/SWIG.CMakeLists.txt.in + ${CMAKE_CURRENT_BINARY_DIR}/SWIG/CMakeLists.txt @ONLY) execute_process( COMMAND ${CMAKE_COMMAND} -H. -Bproject_build -G "${CMAKE_GENERATOR}" @@ -24,158 +26,172 @@ if(WIN32 AND (BUILD_PYTHON OR BUILD_JAVA OR BUILD_DOTNET)) endif() message(STATUS "Getting SWIG: ...DONE") - set(SWIG_EXECUTABLE ${CMAKE_CURRENT_BINARY_DIR}/SWIG/source/swig.exe - CACHE INTERNAL "swig.exe location" FORCE) + set(SWIG_EXECUTABLE + ${CMAKE_CURRENT_BINARY_DIR}/SWIG/source/swig.exe + CACHE INTERNAL "swig.exe location" FORCE) endif() -############ -## ZLIB ## -############ +include(FetchContent) +set(BUILD_SHARED_LIBS OFF) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) +set(BUILD_TESTING OFF) + +# ############################################################################## +# ZLIB +# ############################################################################## if(BUILD_ZLIB) - build_git_dependency( - NAME - ZLIB - REPOSITORY - "https://github.com/madler/ZLIB.git" - TAG - "v1.2.11" - APPLY_PATCH - "${CMAKE_CURRENT_LIST_DIR}/../../patches/ZLIB.patch" - ) + FetchContent_Declare( + zlib + GIT_REPOSITORY "https://github.com/madler/ZLIB.git" + GIT_TAG "v1.2.11" + PATCH_COMMAND git apply "${CMAKE_CURRENT_LIST_DIR}/../../patches/ZLIB.patch") + FetchContent_MakeAvailable(zlib) endif() -################## -## ABSEIL-CPP ## -################## +# ############################################################################## +# SCIP +# ############################################################################## +if(BUILD_SCIP) + set(SHARED OFF) + set(READLINE OFF) + set(GMP OFF) + set(PAPILO OFF) + set(ZIMPL OFF) + set(IPOPT OFF) + set(LPS "none") + #set(EXPRINT "none") + #set(TPI "tny") + FetchContent_Declare( + scip + URL "${CMAKE_CURRENT_LIST_DIR}/../../dependencies/archives/scip-7.0.1.tgz" + #PATCH_COMMAND patch -i "${CMAKE_CURRENT_LIST_DIR}/../../patches/scip-7.0.1.patch") + ) + FetchContent_MakeAvailable(scip) +endif() + +# ############################################################################## +# ABSEIL-CPP +# ############################################################################## if(BUILD_absl) - build_git_dependency( - NAME - abseil-cpp - REPOSITORY - "https://github.com/abseil/abseil-cpp.git" - TAG - "20200225.2" - ) + set(ABSL_ENABLE_INSTALL ON) + FetchContent_Declare( + absl + GIT_REPOSITORY "https://github.com/abseil/abseil-cpp.git" + GIT_TAG "20200225.2" + PATCH_COMMAND git apply + "${CMAKE_CURRENT_LIST_DIR}/../../patches/abseil-cpp-20200225.2.patch") + FetchContent_MakeAvailable(absl) endif() -############## -## GFLAGS ## -############## +# ############################################################################## +# GFLAGS +# ############################################################################## if(BUILD_gflags) - build_git_dependency( - NAME - gflags - REPOSITORY - "https://github.com/gflags/gflags.git" - TAG - "v2.2.2" - CMAKE_ARGS - -DINSTALL_SHARED_LIBS:BOOL=OFF - -DBUILD_STATIC_LIBS:BOOL=ON - -DINSTALL_STATIC_LIBS:BOOL=ON - ) + set(INSTALL_HEADERS ON) + set(INSTALL_SHARED_LIBS OFF) + set(INSTALL_SHARED_LIBS OFF) + set(BUILD_STATIC_LIBS ON) + set(INSTALL_STATIC_LIBS ON) + FetchContent_Declare( + gflags + GIT_REPOSITORY "https://github.com/gflags/gflags.git" + GIT_TAG "v2.2.2" + PATCH_COMMAND git apply "${CMAKE_CURRENT_LIST_DIR}/../../patches/gflags-v2.2.2.patch") + FetchContent_MakeAvailable(gflags) endif() -############ -## GLOG ## -############ +# ############################################################################## +# GLOG +# ############################################################################## if(BUILD_glog) - build_git_dependency( - NAME - glog - REPOSITORY - "https://github.com/google/glog.git" - TAG - "v0.4.0" - CMAKE_ARGS - -DWITH_GFLAGS:BOOL=OFF - ) + FetchContent_Declare( + glog + GIT_REPOSITORY "https://github.com/google/glog.git" + GIT_TAG "v0.4.0") + set(WITH_GFLAGS OFF) + FetchContent_MakeAvailable(glog) endif() -################ -## Protobuf ## -################ +# ############################################################################## +# Protobuf +# ############################################################################## +message(WARNING "fetching protobuf...") if(BUILD_Protobuf) - build_git_dependency( - NAME - Protobuf - REPOSITORY - "https://github.com/protocolbuffers/protobuf.git" - TAG - "v3.12.2" - CMAKE_ARGS + # FetchContent_Declare(SOURCE_SUBDIR) was introduced in 3.18 + if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.18") + set(protobuf_BUILD_TESTS OFF) + set(protobuf_MSVC_STATIC_RUNTIME OFF) + FetchContent_Declare( + protobuf + GIT_REPOSITORY "https://github.com/protocolbuffers/protobuf.git" + GIT_TAG "v3.12.2" + SOURCE_SUBDIR cmake) + FetchContent_MakeAvailable(protobuf) + else() + build_git_dependency( + NAME Protobuf + REPOSITORY "https://github.com/protocolbuffers/protobuf.git" + TAG "v3.12.2" + APPLY_PATCH "${CMAKE_CURRENT_LIST_DIR}/../../patches/protobuf-v3.12.2.patch" + CMAKE_ARGS -Dprotobuf_MSVC_STATIC_RUNTIME:BOOL=OFF -Dprotobuf_BUILD_TESTS:BOOL=OFF "SOURCE_SUBDIR cmake" - ) + ) + endif() endif() -################# -## Coinutils ## -################# +# ############################################################################## +# Coinutils +# ############################################################################## if(BUILD_CoinUtils) - build_git_dependency( - NAME - CoinUtils - REPOSITORY - "https://github.com/Mizux/CoinUtils.git" - TAG - "stable/2.11" - ) + FetchContent_Declare( + CoinUtils + GIT_REPOSITORY "https://github.com/Mizux/CoinUtils.git" + GIT_TAG "stable/2.11") + FetchContent_MakeAvailable(CoinUtils) endif() -########### -## Osi ## -########### +# ############################################################################## +# Osi +# ############################################################################## if(BUILD_Osi) - build_git_dependency( - NAME - Osi - REPOSITORY - "https://github.com/Mizux/Osi.git" - TAG - "stable/0.108" - ) + FetchContent_Declare( + Osi + GIT_REPOSITORY "https://github.com/Mizux/Osi.git" + GIT_TAG "stable/0.108") + FetchContent_MakeAvailable(Osi) endif() -########### -## Clp ## -########### +# ############################################################################## +# Clp +# ############################################################################## if(BUILD_Clp) - build_git_dependency( - NAME - Clp - REPOSITORY - "https://github.com/Mizux/Clp.git" - TAG - "stable/1.17.4" - ) + FetchContent_Declare( + Clp + GIT_REPOSITORY "https://github.com/Mizux/Clp.git" + GIT_TAG "stable/1.17.4") + FetchContent_MakeAvailable(Clp) endif() -########### -## Cgl ## -########### +# ############################################################################## +# Cgl +# ############################################################################## if(BUILD_Cgl) - build_git_dependency( - NAME - Cgl - REPOSITORY - "https://github.com/Mizux/Cgl.git" - TAG - "stable/0.60" - ) + FetchContent_Declare( + Cgl + GIT_REPOSITORY "https://github.com/Mizux/Cgl.git" + GIT_TAG "stable/0.60") + FetchContent_MakeAvailable(Cgl) endif() -########### -## Cbc ## -########### +# ############################################################################## +# Cbc +# ############################################################################## if(BUILD_Cbc) - build_git_dependency( - NAME - Cbc - REPOSITORY - "https://github.com/Mizux/Cbc.git" - TAG - "stable/2.10" - ) + FetchContent_Declare( + Cbc + GIT_REPOSITORY "https://github.com/Mizux/Cbc.git" + GIT_TAG "stable/2.10") + FetchContent_MakeAvailable(Cbc) endif() diff --git a/patches/ZLIB.patch b/patches/ZLIB.patch index 089a5f721d..c267d13a00 100644 --- a/patches/ZLIB.patch +++ b/patches/ZLIB.patch @@ -1,12 +1,13 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 0fe939d..bbf748b 100644 +index 0fe939d..6ae9991 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -1,24 +1,23 @@ +@@ -1,24 +1,24 @@ -cmake_minimum_required(VERSION 2.4.4) -set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) +cmake_minimum_required(VERSION 2.8.12) +cmake_policy(SET CMP0048 NEW) ++cmake_policy(SET CMP0077 NEW) +project(zlib VERSION 1.2.11.1 LANGUAGES C) -project(zlib C) @@ -39,7 +40,7 @@ index 0fe939d..bbf748b 100644 check_include_file(sys/types.h HAVE_SYS_TYPES_H) check_include_file(stdint.h HAVE_STDINT_H) -@@ -63,7 +62,6 @@ if(MSVC) +@@ -63,7 +63,6 @@ if(MSVC) set(CMAKE_DEBUG_POSTFIX "d") add_definitions(-D_CRT_SECURE_NO_DEPRECATE) add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) @@ -47,7 +48,7 @@ index 0fe939d..bbf748b 100644 endif() if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) -@@ -83,7 +81,6 @@ configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmakein +@@ -83,7 +82,6 @@ configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmakein ${ZLIB_PC} @ONLY) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein ${CMAKE_CURRENT_BINARY_DIR}/zconf.h @ONLY) @@ -55,7 +56,7 @@ index 0fe939d..bbf748b 100644 #============================================================================ -@@ -132,9 +129,9 @@ endif() +@@ -132,9 +130,9 @@ endif() if(CMAKE_COMPILER_IS_GNUCC) if(ASM686) set(ZLIB_ASMS contrib/asm686/match.S) @@ -67,7 +68,7 @@ index 0fe939d..bbf748b 100644 if(ZLIB_ASMS) add_definitions(-DASMV) -@@ -143,20 +140,20 @@ if(CMAKE_COMPILER_IS_GNUCC) +@@ -143,20 +141,20 @@ if(CMAKE_COMPILER_IS_GNUCC) endif() if(MSVC) @@ -96,7 +97,7 @@ index 0fe939d..bbf748b 100644 if(ZLIB_ASMS) add_definitions(-DASMV -DASMINF) endif() -@@ -183,10 +180,21 @@ if(MINGW) +@@ -183,10 +181,21 @@ if(MINGW) set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj) endif(MINGW) @@ -122,7 +123,7 @@ index 0fe939d..bbf748b 100644 if(NOT CYGWIN) # This property causes shared libraries on Linux to have the full version -@@ -196,26 +204,48 @@ if(NOT CYGWIN) +@@ -196,26 +205,48 @@ if(NOT CYGWIN) # # This has no effect with MSVC, on that platform the version info for # the DLL comes from the resource file win32/zlib1.rc @@ -183,7 +184,7 @@ index 0fe939d..bbf748b 100644 if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL ) install(FILES ${ZLIB_PUBLIC_HDRS} DESTINATION "${INSTALL_INC_DIR}") endif() -@@ -229,21 +259,22 @@ endif() +@@ -229,21 +260,22 @@ endif() #============================================================================ # Example binaries #============================================================================ @@ -223,3 +224,543 @@ index 0fe939d..bbf748b 100644 + set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") + endif() endif() +diff --git a/zconf.h b/zconf.h +deleted file mode 100644 +index 5e1d68a..0000000 +--- a/zconf.h ++++ /dev/null +@@ -1,534 +0,0 @@ +-/* zconf.h -- configuration of the zlib compression library +- * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler +- * For conditions of distribution and use, see copyright notice in zlib.h +- */ +- +-/* @(#) $Id$ */ +- +-#ifndef ZCONF_H +-#define ZCONF_H +- +-/* +- * If you *really* need a unique prefix for all types and library functions, +- * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. +- * Even better than compiling with -DZ_PREFIX would be to use configure to set +- * this permanently in zconf.h using "./configure --zprefix". +- */ +-#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ +-# define Z_PREFIX_SET +- +-/* all linked symbols and init macros */ +-# define _dist_code z__dist_code +-# define _length_code z__length_code +-# define _tr_align z__tr_align +-# define _tr_flush_bits z__tr_flush_bits +-# define _tr_flush_block z__tr_flush_block +-# define _tr_init z__tr_init +-# define _tr_stored_block z__tr_stored_block +-# define _tr_tally z__tr_tally +-# define adler32 z_adler32 +-# define adler32_combine z_adler32_combine +-# define adler32_combine64 z_adler32_combine64 +-# define adler32_z z_adler32_z +-# ifndef Z_SOLO +-# define compress z_compress +-# define compress2 z_compress2 +-# define compressBound z_compressBound +-# endif +-# define crc32 z_crc32 +-# define crc32_combine z_crc32_combine +-# define crc32_combine64 z_crc32_combine64 +-# define crc32_z z_crc32_z +-# define deflate z_deflate +-# define deflateBound z_deflateBound +-# define deflateCopy z_deflateCopy +-# define deflateEnd z_deflateEnd +-# define deflateGetDictionary z_deflateGetDictionary +-# define deflateInit z_deflateInit +-# define deflateInit2 z_deflateInit2 +-# define deflateInit2_ z_deflateInit2_ +-# define deflateInit_ z_deflateInit_ +-# define deflateParams z_deflateParams +-# define deflatePending z_deflatePending +-# define deflatePrime z_deflatePrime +-# define deflateReset z_deflateReset +-# define deflateResetKeep z_deflateResetKeep +-# define deflateSetDictionary z_deflateSetDictionary +-# define deflateSetHeader z_deflateSetHeader +-# define deflateTune z_deflateTune +-# define deflate_copyright z_deflate_copyright +-# define get_crc_table z_get_crc_table +-# ifndef Z_SOLO +-# define gz_error z_gz_error +-# define gz_intmax z_gz_intmax +-# define gz_strwinerror z_gz_strwinerror +-# define gzbuffer z_gzbuffer +-# define gzclearerr z_gzclearerr +-# define gzclose z_gzclose +-# define gzclose_r z_gzclose_r +-# define gzclose_w z_gzclose_w +-# define gzdirect z_gzdirect +-# define gzdopen z_gzdopen +-# define gzeof z_gzeof +-# define gzerror z_gzerror +-# define gzflush z_gzflush +-# define gzfread z_gzfread +-# define gzfwrite z_gzfwrite +-# define gzgetc z_gzgetc +-# define gzgetc_ z_gzgetc_ +-# define gzgets z_gzgets +-# define gzoffset z_gzoffset +-# define gzoffset64 z_gzoffset64 +-# define gzopen z_gzopen +-# define gzopen64 z_gzopen64 +-# ifdef _WIN32 +-# define gzopen_w z_gzopen_w +-# endif +-# define gzprintf z_gzprintf +-# define gzputc z_gzputc +-# define gzputs z_gzputs +-# define gzread z_gzread +-# define gzrewind z_gzrewind +-# define gzseek z_gzseek +-# define gzseek64 z_gzseek64 +-# define gzsetparams z_gzsetparams +-# define gztell z_gztell +-# define gztell64 z_gztell64 +-# define gzungetc z_gzungetc +-# define gzvprintf z_gzvprintf +-# define gzwrite z_gzwrite +-# endif +-# define inflate z_inflate +-# define inflateBack z_inflateBack +-# define inflateBackEnd z_inflateBackEnd +-# define inflateBackInit z_inflateBackInit +-# define inflateBackInit_ z_inflateBackInit_ +-# define inflateCodesUsed z_inflateCodesUsed +-# define inflateCopy z_inflateCopy +-# define inflateEnd z_inflateEnd +-# define inflateGetDictionary z_inflateGetDictionary +-# define inflateGetHeader z_inflateGetHeader +-# define inflateInit z_inflateInit +-# define inflateInit2 z_inflateInit2 +-# define inflateInit2_ z_inflateInit2_ +-# define inflateInit_ z_inflateInit_ +-# define inflateMark z_inflateMark +-# define inflatePrime z_inflatePrime +-# define inflateReset z_inflateReset +-# define inflateReset2 z_inflateReset2 +-# define inflateResetKeep z_inflateResetKeep +-# define inflateSetDictionary z_inflateSetDictionary +-# define inflateSync z_inflateSync +-# define inflateSyncPoint z_inflateSyncPoint +-# define inflateUndermine z_inflateUndermine +-# define inflateValidate z_inflateValidate +-# define inflate_copyright z_inflate_copyright +-# define inflate_fast z_inflate_fast +-# define inflate_table z_inflate_table +-# ifndef Z_SOLO +-# define uncompress z_uncompress +-# define uncompress2 z_uncompress2 +-# endif +-# define zError z_zError +-# ifndef Z_SOLO +-# define zcalloc z_zcalloc +-# define zcfree z_zcfree +-# endif +-# define zlibCompileFlags z_zlibCompileFlags +-# define zlibVersion z_zlibVersion +- +-/* all zlib typedefs in zlib.h and zconf.h */ +-# define Byte z_Byte +-# define Bytef z_Bytef +-# define alloc_func z_alloc_func +-# define charf z_charf +-# define free_func z_free_func +-# ifndef Z_SOLO +-# define gzFile z_gzFile +-# endif +-# define gz_header z_gz_header +-# define gz_headerp z_gz_headerp +-# define in_func z_in_func +-# define intf z_intf +-# define out_func z_out_func +-# define uInt z_uInt +-# define uIntf z_uIntf +-# define uLong z_uLong +-# define uLongf z_uLongf +-# define voidp z_voidp +-# define voidpc z_voidpc +-# define voidpf z_voidpf +- +-/* all zlib structs in zlib.h and zconf.h */ +-# define gz_header_s z_gz_header_s +-# define internal_state z_internal_state +- +-#endif +- +-#if defined(__MSDOS__) && !defined(MSDOS) +-# define MSDOS +-#endif +-#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) +-# define OS2 +-#endif +-#if defined(_WINDOWS) && !defined(WINDOWS) +-# define WINDOWS +-#endif +-#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) +-# ifndef WIN32 +-# define WIN32 +-# endif +-#endif +-#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) +-# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) +-# ifndef SYS16BIT +-# define SYS16BIT +-# endif +-# endif +-#endif +- +-/* +- * Compile with -DMAXSEG_64K if the alloc function cannot allocate more +- * than 64k bytes at a time (needed on systems with 16-bit int). +- */ +-#ifdef SYS16BIT +-# define MAXSEG_64K +-#endif +-#ifdef MSDOS +-# define UNALIGNED_OK +-#endif +- +-#ifdef __STDC_VERSION__ +-# ifndef STDC +-# define STDC +-# endif +-# if __STDC_VERSION__ >= 199901L +-# ifndef STDC99 +-# define STDC99 +-# endif +-# endif +-#endif +-#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) +-# define STDC +-#endif +-#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) +-# define STDC +-#endif +-#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) +-# define STDC +-#endif +-#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) +-# define STDC +-#endif +- +-#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ +-# define STDC +-#endif +- +-#ifndef STDC +-# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ +-# define const /* note: need a more gentle solution here */ +-# endif +-#endif +- +-#if defined(ZLIB_CONST) && !defined(z_const) +-# define z_const const +-#else +-# define z_const +-#endif +- +-#ifdef Z_SOLO +- typedef unsigned long z_size_t; +-#else +-# define z_longlong long long +-# if defined(NO_SIZE_T) +- typedef unsigned NO_SIZE_T z_size_t; +-# elif defined(STDC) +-# include +- typedef size_t z_size_t; +-# else +- typedef unsigned long z_size_t; +-# endif +-# undef z_longlong +-#endif +- +-/* Maximum value for memLevel in deflateInit2 */ +-#ifndef MAX_MEM_LEVEL +-# ifdef MAXSEG_64K +-# define MAX_MEM_LEVEL 8 +-# else +-# define MAX_MEM_LEVEL 9 +-# endif +-#endif +- +-/* Maximum value for windowBits in deflateInit2 and inflateInit2. +- * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files +- * created by gzip. (Files created by minigzip can still be extracted by +- * gzip.) +- */ +-#ifndef MAX_WBITS +-# define MAX_WBITS 15 /* 32K LZ77 window */ +-#endif +- +-/* The memory requirements for deflate are (in bytes): +- (1 << (windowBits+2)) + (1 << (memLevel+9)) +- that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) +- plus a few kilobytes for small objects. For example, if you want to reduce +- the default memory requirements from 256K to 128K, compile with +- make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" +- Of course this will generally degrade compression (there's no free lunch). +- +- The memory requirements for inflate are (in bytes) 1 << windowBits +- that is, 32K for windowBits=15 (default value) plus about 7 kilobytes +- for small objects. +-*/ +- +- /* Type declarations */ +- +-#ifndef OF /* function prototypes */ +-# ifdef STDC +-# define OF(args) args +-# else +-# define OF(args) () +-# endif +-#endif +- +-#ifndef Z_ARG /* function prototypes for stdarg */ +-# if defined(STDC) || defined(Z_HAVE_STDARG_H) +-# define Z_ARG(args) args +-# else +-# define Z_ARG(args) () +-# endif +-#endif +- +-/* The following definitions for FAR are needed only for MSDOS mixed +- * model programming (small or medium model with some far allocations). +- * This was tested only with MSC; for other MSDOS compilers you may have +- * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, +- * just define FAR to be empty. +- */ +-#ifdef SYS16BIT +-# if defined(M_I86SM) || defined(M_I86MM) +- /* MSC small or medium model */ +-# define SMALL_MEDIUM +-# ifdef _MSC_VER +-# define FAR _far +-# else +-# define FAR far +-# endif +-# endif +-# if (defined(__SMALL__) || defined(__MEDIUM__)) +- /* Turbo C small or medium model */ +-# define SMALL_MEDIUM +-# ifdef __BORLANDC__ +-# define FAR _far +-# else +-# define FAR far +-# endif +-# endif +-#endif +- +-#if defined(WINDOWS) || defined(WIN32) +- /* If building or using zlib as a DLL, define ZLIB_DLL. +- * This is not mandatory, but it offers a little performance increase. +- */ +-# ifdef ZLIB_DLL +-# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) +-# ifdef ZLIB_INTERNAL +-# define ZEXTERN extern __declspec(dllexport) +-# else +-# define ZEXTERN extern __declspec(dllimport) +-# endif +-# endif +-# endif /* ZLIB_DLL */ +- /* If building or using zlib with the WINAPI/WINAPIV calling convention, +- * define ZLIB_WINAPI. +- * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. +- */ +-# ifdef ZLIB_WINAPI +-# ifdef FAR +-# undef FAR +-# endif +-# include +- /* No need for _export, use ZLIB.DEF instead. */ +- /* For complete Windows compatibility, use WINAPI, not __stdcall. */ +-# define ZEXPORT WINAPI +-# ifdef WIN32 +-# define ZEXPORTVA WINAPIV +-# else +-# define ZEXPORTVA FAR CDECL +-# endif +-# endif +-#endif +- +-#if defined (__BEOS__) +-# ifdef ZLIB_DLL +-# ifdef ZLIB_INTERNAL +-# define ZEXPORT __declspec(dllexport) +-# define ZEXPORTVA __declspec(dllexport) +-# else +-# define ZEXPORT __declspec(dllimport) +-# define ZEXPORTVA __declspec(dllimport) +-# endif +-# endif +-#endif +- +-#ifndef ZEXTERN +-# define ZEXTERN extern +-#endif +-#ifndef ZEXPORT +-# define ZEXPORT +-#endif +-#ifndef ZEXPORTVA +-# define ZEXPORTVA +-#endif +- +-#ifndef FAR +-# define FAR +-#endif +- +-#if !defined(__MACTYPES__) +-typedef unsigned char Byte; /* 8 bits */ +-#endif +-typedef unsigned int uInt; /* 16 bits or more */ +-typedef unsigned long uLong; /* 32 bits or more */ +- +-#ifdef SMALL_MEDIUM +- /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ +-# define Bytef Byte FAR +-#else +- typedef Byte FAR Bytef; +-#endif +-typedef char FAR charf; +-typedef int FAR intf; +-typedef uInt FAR uIntf; +-typedef uLong FAR uLongf; +- +-#ifdef STDC +- typedef void const *voidpc; +- typedef void FAR *voidpf; +- typedef void *voidp; +-#else +- typedef Byte const *voidpc; +- typedef Byte FAR *voidpf; +- typedef Byte *voidp; +-#endif +- +-#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) +-# include +-# if (UINT_MAX == 0xffffffffUL) +-# define Z_U4 unsigned +-# elif (ULONG_MAX == 0xffffffffUL) +-# define Z_U4 unsigned long +-# elif (USHRT_MAX == 0xffffffffUL) +-# define Z_U4 unsigned short +-# endif +-#endif +- +-#ifdef Z_U4 +- typedef Z_U4 z_crc_t; +-#else +- typedef unsigned long z_crc_t; +-#endif +- +-#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ +-# define Z_HAVE_UNISTD_H +-#endif +- +-#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */ +-# define Z_HAVE_STDARG_H +-#endif +- +-#ifdef STDC +-# ifndef Z_SOLO +-# include /* for off_t */ +-# endif +-#endif +- +-#if defined(STDC) || defined(Z_HAVE_STDARG_H) +-# ifndef Z_SOLO +-# include /* for va_list */ +-# endif +-#endif +- +-#ifdef _WIN32 +-# ifndef Z_SOLO +-# include /* for wchar_t */ +-# endif +-#endif +- +-/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and +- * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even +- * though the former does not conform to the LFS document), but considering +- * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as +- * equivalently requesting no 64-bit operations +- */ +-#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 +-# undef _LARGEFILE64_SOURCE +-#endif +- +-#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) +-# define Z_HAVE_UNISTD_H +-#endif +-#ifndef Z_SOLO +-# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) +-# include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ +-# ifdef VMS +-# include /* for off_t */ +-# endif +-# ifndef z_off_t +-# define z_off_t off_t +-# endif +-# endif +-#endif +- +-#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0 +-# define Z_LFS64 +-#endif +- +-#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) +-# define Z_LARGE64 +-#endif +- +-#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64) +-# define Z_WANT64 +-#endif +- +-#if !defined(SEEK_SET) && !defined(Z_SOLO) +-# define SEEK_SET 0 /* Seek from beginning of file. */ +-# define SEEK_CUR 1 /* Seek from current position. */ +-# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +-#endif +- +-#ifndef z_off_t +-# define z_off_t long +-#endif +- +-#if !defined(_WIN32) && defined(Z_LARGE64) +-# define z_off64_t off64_t +-#else +-# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO) +-# define z_off64_t __int64 +-# else +-# define z_off64_t z_off_t +-# endif +-#endif +- +-/* MVS linker does not support external names larger than 8 bytes */ +-#if defined(__MVS__) +- #pragma map(deflateInit_,"DEIN") +- #pragma map(deflateInit2_,"DEIN2") +- #pragma map(deflateEnd,"DEEND") +- #pragma map(deflateBound,"DEBND") +- #pragma map(inflateInit_,"ININ") +- #pragma map(inflateInit2_,"ININ2") +- #pragma map(inflateEnd,"INEND") +- #pragma map(inflateSync,"INSY") +- #pragma map(inflateSetDictionary,"INSEDI") +- #pragma map(compressBound,"CMBND") +- #pragma map(inflate_table,"INTABL") +- #pragma map(inflate_fast,"INFA") +- #pragma map(inflate_copyright,"INCOPY") +-#endif +- +-#endif /* ZCONF_H */ diff --git a/patches/abseil-cpp-20200225.2.patch b/patches/abseil-cpp-20200225.2.patch new file mode 100644 index 0000000000..f580392bb6 --- /dev/null +++ b/patches/abseil-cpp-20200225.2.patch @@ -0,0 +1,26 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 48cb6eb..1cdaad2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -30,6 +30,9 @@ cmake_policy(SET CMP0057 NEW) + # Project version variables are the empty std::string if version is unspecified + cmake_policy(SET CMP0048 NEW) + ++# option() honor variables ++cmake_policy(SET CMP0077 NEW) ++ + project(absl CXX) + + # Output directory is correct by default for most build setups. However, when +@@ -41,9 +44,9 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + # when absl is included as subproject (i.e. using add_subdirectory(abseil-cpp)) + # in the source tree of a project that uses it, install rules are disabled. + if(NOT "^${CMAKE_SOURCE_DIR}$" STREQUAL "^${PROJECT_SOURCE_DIR}$") +- set(ABSL_ENABLE_INSTALL FALSE) ++ option(ABSL_ENABLE_INSTALL OFF) + else() +- set(ABSL_ENABLE_INSTALL TRUE) ++ option(ABSL_ENABLE_INSTALL ON) + endif() + + list(APPEND CMAKE_MODULE_PATH diff --git a/patches/gflags-v2.2.2.patch b/patches/gflags-v2.2.2.patch new file mode 100644 index 0000000000..22b224a5c9 --- /dev/null +++ b/patches/gflags-v2.2.2.patch @@ -0,0 +1,39 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 657a1f4..2b76d3f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -80,6 +80,11 @@ if (POLICY CMP0048) + cmake_policy (SET CMP0048 NEW) + endif () + ++# option() Honor variables ++if (POLICY CMP0077) ++ cmake_policy (SET CMP0077 NEW) ++endif () ++ + # ---------------------------------------------------------------------------- + # includes + include ("${CMAKE_CURRENT_SOURCE_DIR}/cmake/utils.cmake") +@@ -560,11 +565,6 @@ if (INSTALL_HEADERS) + NAMESPACE ${PACKAGE_NAME}:: + DESTINATION ${CONFIG_INSTALL_DIR} + ) +- install ( +- EXPORT ${EXPORT_NAME} +- FILE ${PACKAGE_NAME}-nonamespace-targets.cmake +- DESTINATION ${CONFIG_INSTALL_DIR} +- ) + if (UNIX) + install (PROGRAMS src/gflags_completions.sh DESTINATION ${RUNTIME_INSTALL_DIR}) + endif () +@@ -583,10 +583,6 @@ export ( + NAMESPACE ${PACKAGE_NAME}:: + FILE "${PROJECT_BINARY_DIR}/${EXPORT_NAME}.cmake" + ) +-export ( +- TARGETS ${TARGETS} +- FILE "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}-nonamespace-targets.cmake" +-) + if (REGISTER_BUILD_DIR) + export (PACKAGE ${PACKAGE_NAME}) + endif () diff --git a/patches/protobuf-v3.12.2.patch b/patches/protobuf-v3.12.2.patch index f1f39adaf9..f2825cebbd 100644 --- a/patches/protobuf-v3.12.2.patch +++ b/patches/protobuf-v3.12.2.patch @@ -1,8 +1,8 @@ diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt -index 8e5e68073..9f954e1a2 100644 +index 849679995..968e19cd5 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt -@@ -40,7 +40,7 @@ else (BUILD_SHARED_LIBS) +@@ -48,7 +48,7 @@ else (BUILD_SHARED_LIBS) endif (BUILD_SHARED_LIBS) option(protobuf_BUILD_SHARED_LIBS "Build Shared Libraries" ${protobuf_BUILD_SHARED_LIBS_DEFAULT}) include(CMakeDependentOption) @@ -11,3 +11,16 @@ index 8e5e68073..9f954e1a2 100644 "NOT protobuf_BUILD_SHARED_LIBS" OFF) set(protobuf_WITH_ZLIB_DEFAULT ON) option(protobuf_WITH_ZLIB "Build with zlib support" ${protobuf_WITH_ZLIB_DEFAULT}) +@@ -116,8 +116,10 @@ endif (CMAKE_USE_PTHREADS_INIT) + + set(_protobuf_FIND_ZLIB) + if (protobuf_WITH_ZLIB) +- find_package(ZLIB) +- if (ZLIB_FOUND) ++ if (NOT TARGET ZLIB::ZLIB) ++ find_package(ZLIB) ++ endif() ++ if (ZLIB_FOUND OR TARGET ZLIB::ZLIB) + set(HAVE_ZLIB 1) + # FindZLIB module define ZLIB_INCLUDE_DIRS variable + # Set ZLIB_INCLUDE_DIRECTORIES for compatible diff --git a/patches/scip-7.0.1.patch b/patches/scip-7.0.1.patch new file mode 100644 index 0000000000..37e8ed68dc --- /dev/null +++ b/patches/scip-7.0.1.patch @@ -0,0 +1,14 @@ +diff -uarN --label a --label b a b +--- a ++++ b +@@ -1,5 +1,10 @@ + cmake_minimum_required(VERSION 3.3) + ++# option() honors normal variables. ++if(POLICY CMP0077) ++ cmake_policy(SET CMP0077 NEW) ++endif() ++ + set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_DEBUG} ${CMAKE_C_FLAGS_RELEASE}") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_DEBUG} ${CMAKE_CXX_FLAGS_RELEASE}") +