diff --git a/CMakeLists.txt b/CMakeLists.txt index a5199e10..a45e7fc1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.1.0) +cmake_minimum_required(VERSION 3.1...3.18) -# Use newer policies if available, up to most recent tested version of CMake. -if(${CMAKE_VERSION} VERSION_LESS 3.11) +# Fallback for using newer policies on CMake <3.12. +if(${CMAKE_VERSION} VERSION_LESS 3.12) cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) -else() - cmake_policy(VERSION 3.11) endif() # Determine if fmt is built as a subproject (using add_subdirectory) diff --git a/test/add-subdirectory-test/CMakeLists.txt b/test/add-subdirectory-test/CMakeLists.txt index db7054bd..9cc4b0e9 100644 --- a/test/add-subdirectory-test/CMakeLists.txt +++ b/test/add-subdirectory-test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1.0) +cmake_minimum_required(VERSION 3.1...3.18) project(fmt-test) diff --git a/test/compile-error-test/CMakeLists.txt b/test/compile-error-test/CMakeLists.txt index 75a0c5a5..8202f279 100644 --- a/test/compile-error-test/CMakeLists.txt +++ b/test/compile-error-test/CMakeLists.txt @@ -1,6 +1,6 @@ # Test if compile errors are produced where necessary. -cmake_minimum_required(VERSION 3.1.0) +cmake_minimum_required(VERSION 3.1...3.18) include(CheckCXXSourceCompiles) include(CheckCXXCompilerFlag) diff --git a/test/find-package-test/CMakeLists.txt b/test/find-package-test/CMakeLists.txt index 51357557..93d686e6 100644 --- a/test/find-package-test/CMakeLists.txt +++ b/test/find-package-test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1.0) +cmake_minimum_required(VERSION 3.1...3.18) project(fmt-test)