From c8d31372f7342707d8c6e40c814ce1b64fe36086 Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Tue, 12 Jul 2022 11:46:03 -0400 Subject: [PATCH] Bump CMake requirement to 3.8. CMake 3.8 was released April 10, 2017, which puts it past our five year horizon. (CMake 3.9 is just a few days short of it, so using 3.8 for now.) In particular, depending on 3.7+ gets us some nice features like VERSION_GREATER_EQUAL. Change-Id: I90457ad41e7add3c6b2dd3664da964c4b6ede499 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/53345 Commit-Queue: Adam Langley Auto-Submit: David Benjamin Reviewed-by: Adam Langley Commit-Queue: David Benjamin --- BUILDING.md | 2 +- CMakeLists.txt | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index e7dfd6ea9..73bc29c1e 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -10,7 +10,7 @@ Unless otherwise noted, build tools must at most five years old, matching [Abseil guidelines](https://abseil.io/about/compatibility). If in doubt, use the most recent stable version of each tool. - * [CMake](https://cmake.org/download/) 3.5 or later is required. + * [CMake](https://cmake.org/download/) 3.8 or later is required. * A recent version of Perl is required. On Windows, [Active State Perl](http://www.activestate.com/activeperl/) has been diff --git a/CMakeLists.txt b/CMakeLists.txt index 766c83977..0864958aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.8) # Defer enabling C and CXX languages. project(BoringSSL NONE) @@ -160,7 +160,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CLANG) set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wno-free-nonheap-object") endif() - if(CLANG OR NOT "7.0.0" VERSION_GREATER CMAKE_C_COMPILER_VERSION) + if(CLANG OR CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "7.0.0") set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wimplicit-fallthrough") endif() @@ -406,10 +406,13 @@ endif() function(go_executable dest package) set(godeps "${CMAKE_SOURCE_DIR}/util/godeps.go") - if(CMAKE_VERSION VERSION_LESS "3.7" OR NOT CMAKE_GENERATOR STREQUAL "Ninja") - # The DEPFILE parameter to add_custom_command is new as of CMake 3.7 and - # only works with Ninja. Query the sources at configure time. Additionally, - # everything depends on go.mod. That affects what external packages to use. + if(NOT CMAKE_GENERATOR STREQUAL "Ninja") + # The DEPFILE parameter to add_custom_command only works with Ninja. Query + # the sources at configure time. Additionally, everything depends on go.mod. + # That affects what external packages to use. + # + # TODO(davidben): Starting CMake 3.20, it also works with Make. Starting + # 3.21, it works with Visual Studio and Xcode too. execute_process(COMMAND ${GO_EXECUTABLE} run ${godeps} -format cmake -pkg ${package} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}