CMake: review minimum required CMake version.

It turns out that using cmake_policy(VERSION) is effectively same as
using cmake_minimum_required(VERSION) because it is a hard error
if the CMake running the script is too old. As such, replace 22525e65
with two changes:
  * Set the minimum required version to 3.7.2 (Debian stretch),
    which also configures policies.
  * If CMake is at least as new as 3.11.0, then set the policies
    according to that version.
This should actually have the intended behavior.
This commit is contained in:
whitequark 2019-12-02 18:51:46 +00:00
parent 0472b9ea60
commit 0b786e6e2b

View File

@ -7,8 +7,10 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
" mkdir build && cd build && cmake ..")
endif()
cmake_minimum_required(VERSION 3.2.0 FATAL_ERROR)
cmake_policy(VERSION 3.11)
cmake_minimum_required(VERSION 3.7.2 FATAL_ERROR)
if(NOT CMAKE_VERSION VERSION_LESS 3.11.0)
cmake_policy(VERSION 3.11.0)
endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
"${CMAKE_SOURCE_DIR}/cmake/")
set(CMAKE_CXX_STANDARD 11)