diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2024-03-13 12:46:59 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2024-03-14 23:32:11 +0900 |
commit | 4af11cf947c2949ff4c7035c48f59439f1420bc8 (patch) | |
tree | 0d554bb33df8a9892982d9153c18a9e8457375e6 | |
parent | 10b018766921803a73a6cabdf4784b4ac7f162c9 (diff) | |
download | tde-cmake-4af11cf947c2949ff4c7035c48f59439f1420bc8.tar.gz tde-cmake-4af11cf947c2949ff4c7035c48f59439f1420bc8.zip |
Set cmake minimum version in a centralized place
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit a8c01019d7aaa2e9e9165504cfdf76b05ec128dc)
-rw-r--r-- | CMakeLists.txt | 8 | ||||
-rw-r--r-- | modules/TDEMacros.cmake | 12 | ||||
-rw-r--r-- | modules/TDEVersion.cmake | 5 |
3 files changed, 21 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 783616d..2e95052 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,13 @@ if( "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}" ) ##### general package setup ##################### - cmake_minimum_required( VERSION 3.5 ) + # building tde-cmake requires reading the minimum required version + # from the source files, because there may be a different version + # of tde-cmake already installed in the system. Trying to build + # tde-cmake with a lower minimum version would not be allowed then. + + include( ${CMAKE_SOURCE_DIR}/modules/TDEVersion.cmake ) + cmake_minimum_required( VERSION ${TDE_CMAKE_MINIMUM_VERSION} ) project( tde-cmake-rules ) diff --git a/modules/TDEMacros.cmake b/modules/TDEMacros.cmake index de51342..3012ec9 100644 --- a/modules/TDEMacros.cmake +++ b/modules/TDEMacros.cmake @@ -18,11 +18,18 @@ ################################################# ##### +##### Need cmake minimum version + +include( TDEVersion ) + + +################################################# +##### ##### initialization... if( NOT TDE_CMAKE_ROOT ) - if( "${CMAKE_VERSION}" VERSION_LESS "3.5" ) - message( FATAL_ERROR "CMake >= 3.5.0 required" ) + if( "${CMAKE_VERSION}" VERSION_LESS "${TDE_CMAKE_MINIMUM_VERSION}" ) + message( FATAL_ERROR "CMake >= ${TDE_CMAKE_MINIMUM_VERSION} required" ) endif() if( ${CMAKE_CURRENT_LIST_DIR} STREQUAL ${CMAKE_ROOT}/Modules ) @@ -83,7 +90,6 @@ include( CheckCXXSourceCompiles ) include( CheckLinkerFlag OPTIONAL ) include( CheckSymbolExists ) include( CheckTypeSize ) -include( TDEVersion ) ################################################# diff --git a/modules/TDEVersion.cmake b/modules/TDEVersion.cmake index b8a83a8..7afb0f5 100644 --- a/modules/TDEVersion.cmake +++ b/modules/TDEVersion.cmake @@ -9,6 +9,11 @@ # ################################################# +# Centralized place where to set the minimum cmake version required in TDE + +set( TDE_CMAKE_MINIMUM_VERSION 3.5 ) + + ################################################# ##### ##### tde_set_project_version |