diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f8ef396a..0b1921ca2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,15 @@ cmake_minimum_required(VERSION 3.12) +# Set CMake policies to handle compatibility with older dependencies +if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.27") + cmake_policy(SET CMP0144 NEW) +endif() + +# Set policy to handle older CMake requirements in dependencies +if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.5") + cmake_policy(SET CMP0000 NEW) +endif() + if (PACKAGE_MANAGER) if(NOT PACKAGE_MANAGER MATCHES "^(hunter|vcpkg)$") message(FATAL_ERROR "PACKAGE_MANAGER must be set to 'hunter', 'vcpkg' or isn't set") @@ -16,10 +26,6 @@ else () endif () message(STATUS "Selected package manager: ${PACKAGE_MANAGER}") -if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.27") - cmake_policy(SET CMP0144 NEW) -endif() - find_program(CCACHE_FOUND ccache) if (CCACHE_FOUND) set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) diff --git a/cmake/Hunter/config.cmake b/cmake/Hunter/config.cmake index 6549e8f29..4b81bb6c9 100644 --- a/cmake/Hunter/config.cmake +++ b/cmake/Hunter/config.cmake @@ -15,6 +15,44 @@ # CMAKE_ARGS "CMAKE_VARIABLE=value" # ) +# Fix for Protobuf CMake compatibility issue with modern CMake versions +hunter_config( + Protobuf + VERSION 3.19.4-p0 + CMAKE_ARGS + CMAKE_POLICY_VERSION_MINIMUM=3.5 + protobuf_BUILD_TESTS=OFF + protobuf_BUILD_SHARED_LIBS=OFF + KEEP_PACKAGE_SOURCES +) + +# Fix for c-ares CMake compatibility issue with modern CMake versions +hunter_config( + c-ares + VERSION 1.14.0-p0 + CMAKE_ARGS + CMAKE_POLICY_VERSION_MINIMUM=3.5 + KEEP_PACKAGE_SOURCES +) + +# Fix for yaml-cpp CMake compatibility issue with modern CMake versions +hunter_config( + yaml-cpp + VERSION 0.6.2-0f9a586-p1 + CMAKE_ARGS + CMAKE_POLICY_VERSION_MINIMUM=3.5 + KEEP_PACKAGE_SOURCES +) + +# Fix for Boost.DI CMake compatibility issue with modern CMake versions +hunter_config( + Boost.DI + VERSION 1.1.0-p1 + CMAKE_ARGS + CMAKE_POLICY_VERSION_MINIMUM=3.5 + KEEP_PACKAGE_SOURCES +) + hunter_config( soralog VERSION 0.2.5