From 2341b69840a1d9f1c78a5f11b83270fda0201fc4 Mon Sep 17 00:00:00 2001 From: Simon Richter Date: Thu, 16 Apr 2020 17:26:49 +0200 Subject: [PATCH] Make sure that Ninja knows the version header (fixes #4209) This is required, because Ninja otherwise doesn't properly rebuild after updating the version string header file. Because BYPRODUCTS requires CMake 3.2, bump the minimum version and remove now unused compatibility code for older CMake versions. --- CMakeLists.txt | 27 +-------------------------- common/CMakeLists.txt | 1 + 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c93ad6d61..5020a2b88c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,14 +21,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA # -cmake_minimum_required( VERSION 3.0.2 FATAL_ERROR ) -# because of http://public.kitware.com/Bug/view.php?id=10395 - -# See https://gitlab.kitware.com/cmake/cmake/issues/15943 -# Remove as soon as 3.1 is minimum required version -if(POLICY CMP0025) - cmake_policy(SET CMP0025 NEW) # CMake 3.0 -endif() +cmake_minimum_required( VERSION 3.2 FATAL_ERROR ) # Default to CMAKE_BUILD_TYPE = Release unless overridden on command line # http://www.cmake.org/pipermail/cmake/2008-September/023808.html @@ -222,24 +215,6 @@ include( PerformFeatureChecks ) perform_feature_checks() -# Workaround: CMake < 3.1 does not support CMAKE_CXX_STANDARD -if( NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 3.1 ) - message( FATAL_ERROR "Remove compatibility code" ) -endif() - -if( CMAKE_VERSION VERSION_LESS 3.1 AND ( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) ) - include(CheckCXXCompilerFlag) - - CHECK_CXX_COMPILER_FLAG("-std=gnu++14" COMPILER_SUPPORTS_CXX14) - - if(COMPILER_SUPPORTS_CXX14) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++14") - else() - message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++14 support. Please use a different C++ compiler.") - endif() -endif() - - # Setup the compiler warnings include( ${CMAKE_MODULE_PATH}/Warnings.cmake ) diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 8daf045f28..683ad1ed3d 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -144,6 +144,7 @@ add_custom_target( -DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH} -P ${CMAKE_MODULE_PATH}/WriteVersionHeader.cmake WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + BYPRODUCTS ${CMAKE_BINARY_DIR}/kicad_build_version.h COMMENT "Generating version string header" )