mdbx-cmake: sync/refine cmake policy.

This commit is contained in:
Леонид Юрьев (Leonid Yuriev) 2022-06-01 15:13:03 +03:00
parent d9407ee648
commit 7260db2e74
2 changed files with 29 additions and 2 deletions

View File

@ -42,6 +42,12 @@ endif()
cmake_policy(PUSH) cmake_policy(PUSH)
cmake_policy(VERSION ${CMAKE_MINIMUM_REQUIRED_VERSION}) cmake_policy(VERSION ${CMAKE_MINIMUM_REQUIRED_VERSION})
if(NOT CMAKE_VERSION VERSION_LESS 3.21)
cmake_policy(SET CMP0126 NEW)
endif()
if(NOT CMAKE_VERSION VERSION_LESS 3.17)
cmake_policy(SET CMP0102 NEW)
endif()
if(NOT CMAKE_VERSION VERSION_LESS 3.15) if(NOT CMAKE_VERSION VERSION_LESS 3.15)
cmake_policy(SET CMP0091 NEW) cmake_policy(SET CMP0091 NEW)
endif() endif()
@ -52,6 +58,7 @@ if(NOT CMAKE_VERSION VERSION_LESS 3.12)
cmake_policy(SET CMP0075 NEW) cmake_policy(SET CMP0075 NEW)
endif() endif()
if(NOT CMAKE_VERSION VERSION_LESS 3.9) if(NOT CMAKE_VERSION VERSION_LESS 3.9)
cmake_policy(SET CMP0068 NEW)
cmake_policy(SET CMP0069 NEW) cmake_policy(SET CMP0069 NEW)
include(CheckIPOSupported) include(CheckIPOSupported)
check_ipo_supported(RESULT CMAKE_INTERPROCEDURAL_OPTIMIZATION_AVAILABLE) check_ipo_supported(RESULT CMAKE_INTERPROCEDURAL_OPTIMIZATION_AVAILABLE)
@ -184,8 +191,9 @@ if(CMAKE_C_COMPILER_ID STREQUAL "MSVC" AND MSVC_VERSION LESS 1900)
" At least 'Microsoft Visual Studio 2015' is required.") " At least 'Microsoft Visual Studio 2015' is required.")
endif() endif()
set(CMAKE_THREAD_PREFER_PTHREAD TRUE) if(NOT DEFINED THREADS_PREFER_PTHREAD_FLAG)
set(THREADS_PREFER_PTHREAD_FLAG TRUE) set(THREADS_PREFER_PTHREAD_FLAG TRUE)
endif()
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
include(cmake/utils.cmake) include(cmake/utils.cmake)

View File

@ -21,6 +21,25 @@ endif()
cmake_policy(PUSH) cmake_policy(PUSH)
cmake_policy(VERSION ${CMAKE_MINIMUM_REQUIRED_VERSION}) cmake_policy(VERSION ${CMAKE_MINIMUM_REQUIRED_VERSION})
if(NOT CMAKE_VERSION VERSION_LESS 3.21)
cmake_policy(SET CMP0126 NEW)
endif()
if(NOT CMAKE_VERSION VERSION_LESS 3.17)
cmake_policy(SET CMP0102 NEW)
endif()
if(NOT CMAKE_VERSION VERSION_LESS 3.15)
cmake_policy(SET CMP0091 NEW)
endif()
if(NOT CMAKE_VERSION VERSION_LESS 3.13)
cmake_policy(SET CMP0077 NEW)
endif()
if(NOT CMAKE_VERSION VERSION_LESS 3.12)
cmake_policy(SET CMP0075 NEW)
endif()
if(NOT CMAKE_VERSION VERSION_LESS 3.9)
cmake_policy(SET CMP0068 NEW)
cmake_policy(SET CMP0069 NEW)
endif()
if(CMAKE_VERSION MATCHES ".*MSVC.*" AND CMAKE_VERSION VERSION_LESS 3.16) if(CMAKE_VERSION MATCHES ".*MSVC.*" AND CMAKE_VERSION VERSION_LESS 3.16)
message(FATAL_ERROR "CMake from MSVC kit is unfit! " message(FATAL_ERROR "CMake from MSVC kit is unfit! "