From a9cae5e31489a7359669e91b06a688669a442869 Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Tue, 3 Aug 2021 17:17:22 +0300 Subject: [PATCH] mdbx-cmake: avoid CMake warning about compatibility with 3.8.2 --- CMakeLists.txt | 8 ++++++-- cmake/compiler.cmake | 9 +++++++-- cmake/profile.cmake | 9 +++++++-- cmake/utils.cmake | 9 +++++++-- 4 files changed, 27 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e74432b0..87b69424 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,10 +34,14 @@ ## The Future will (be) Positive. Всё будет хорошо. ## -cmake_minimum_required(VERSION 3.8.2) +if(CMAKE_VERSION VERSION_LESS 3.12) + cmake_minimum_required(VERSION 3.8.2) +else() + cmake_minimum_required(VERSION 3.12) +endif() cmake_policy(PUSH) -cmake_policy(VERSION 3.8.2) +cmake_policy(VERSION ${CMAKE_MINIMUM_REQUIRED_VERSION}) if(NOT CMAKE_VERSION VERSION_LESS 3.15) cmake_policy(SET CMP0091 NEW) endif() diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake index 8ab05b52..7f27d4dd 100644 --- a/cmake/compiler.cmake +++ b/cmake/compiler.cmake @@ -13,9 +13,14 @@ ## limitations under the License. ## -cmake_minimum_required(VERSION 3.8.2) +if(CMAKE_VERSION VERSION_LESS 3.12) + cmake_minimum_required(VERSION 3.8.2) +else() + cmake_minimum_required(VERSION 3.12) +endif() + cmake_policy(PUSH) -cmake_policy(VERSION 3.8.2) +cmake_policy(VERSION ${CMAKE_MINIMUM_REQUIRED_VERSION}) if(CMAKE_VERSION MATCHES ".*MSVC.*" AND CMAKE_VERSION VERSION_LESS 3.16) message(FATAL_ERROR "CMake from MSVC kit is unfit! " diff --git a/cmake/profile.cmake b/cmake/profile.cmake index 66f4ed87..0d028d32 100644 --- a/cmake/profile.cmake +++ b/cmake/profile.cmake @@ -13,9 +13,14 @@ ## limitations under the License. ## -cmake_minimum_required(VERSION 3.8.2) +if(CMAKE_VERSION VERSION_LESS 3.12) + cmake_minimum_required(VERSION 3.8.2) +else() + cmake_minimum_required(VERSION 3.12) +endif() + cmake_policy(PUSH) -cmake_policy(VERSION 3.8.2) +cmake_policy(VERSION ${CMAKE_MINIMUM_REQUIRED_VERSION}) include(CheckLibraryExists) check_library_exists(gcov __gcov_flush "" HAVE_GCOV) diff --git a/cmake/utils.cmake b/cmake/utils.cmake index fcfcb5b6..cbd723f5 100644 --- a/cmake/utils.cmake +++ b/cmake/utils.cmake @@ -13,9 +13,14 @@ ## limitations under the License. ## -cmake_minimum_required(VERSION 3.8.2) +if(CMAKE_VERSION VERSION_LESS 3.12) + cmake_minimum_required(VERSION 3.8.2) +else() + cmake_minimum_required(VERSION 3.12) +endif() + cmake_policy(PUSH) -cmake_policy(VERSION 3.8.2) +cmake_policy(VERSION ${CMAKE_MINIMUM_REQUIRED_VERSION}) macro(add_compile_flags languages) foreach(_lang ${languages})