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.
This commit is contained in:
Simon Richter 2020-04-16 17:26:49 +02:00 committed by Ian McInerney
parent b29f55c1ca
commit 2341b69840
2 changed files with 2 additions and 26 deletions

View File

@ -21,14 +21,7 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
# #
cmake_minimum_required( VERSION 3.0.2 FATAL_ERROR ) cmake_minimum_required( VERSION 3.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()
# Default to CMAKE_BUILD_TYPE = Release unless overridden on command line # Default to CMAKE_BUILD_TYPE = Release unless overridden on command line
# http://www.cmake.org/pipermail/cmake/2008-September/023808.html # http://www.cmake.org/pipermail/cmake/2008-September/023808.html
@ -222,24 +215,6 @@ include( PerformFeatureChecks )
perform_feature_checks() 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 # Setup the compiler warnings
include( ${CMAKE_MODULE_PATH}/Warnings.cmake ) include( ${CMAKE_MODULE_PATH}/Warnings.cmake )

View File

@ -144,6 +144,7 @@ add_custom_target(
-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH} -DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}
-P ${CMAKE_MODULE_PATH}/WriteVersionHeader.cmake -P ${CMAKE_MODULE_PATH}/WriteVersionHeader.cmake
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
BYPRODUCTS ${CMAKE_BINARY_DIR}/kicad_build_version.h
COMMENT "Generating version string header" COMMENT "Generating version string header"
) )