diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2022-05-20 20:56:04 +0900 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2022-06-19 12:28:27 +0200 |
commit | 088f3e3bdc452caa533533c16ee5b1133cfb0592 (patch) | |
tree | ff1781711ccc3d3dd44489056302445ccbcf276f | |
parent | 0321845582498e485e8646264414604025e445a1 (diff) | |
download | tde-cmake-088f3e3bdc452caa533533c16ee5b1133cfb0592.tar.gz tde-cmake-088f3e3bdc452caa533533c16ee5b1133cfb0592.zip |
Add macro to set project version at TDE-wide scope.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit 11a6934bbb70fd1dde99b77afcec2855c69699b6)
-rw-r--r-- | modules/TDEMacros.cmake | 1 | ||||
-rw-r--r-- | modules/TDEVersion.cmake | 29 |
2 files changed, 30 insertions, 0 deletions
diff --git a/modules/TDEMacros.cmake b/modules/TDEMacros.cmake index e8d639f..3d845f7 100644 --- a/modules/TDEMacros.cmake +++ b/modules/TDEMacros.cmake @@ -16,6 +16,7 @@ ################################################# include( CheckCXXCompilerFlag ) +include( TDEVersion ) ################################################# diff --git a/modules/TDEVersion.cmake b/modules/TDEVersion.cmake new file mode 100644 index 0000000..689eff6 --- /dev/null +++ b/modules/TDEVersion.cmake @@ -0,0 +1,29 @@ +################################################# +# +# (C) 2022 Michele Calgaro +# michele (DOT) calgaro (AT) yahoo (DOT) it +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +################################################# +##### +##### tde_set_project_version + +macro( tde_set_project_version ) + + set( DEFAULT_VERSION "3.5.13.3~[DEVELOPMENT]" ) + + unset( VERSION ) + + file( STRINGS ${CMAKE_SOURCE_DIR}/.tdescminfo VERSION_STRING REGEX "^Version:.+$" ) + string( REGEX REPLACE "^Version: ([0-9]+\.[0-9]+\.[0-9]+.*)$" "\\1" VERSION "${VERSION_STRING}" ) + if( NOT VERSION ) + set( VERSION "${DEFAULT_VERSION}" ) + endif() + +endmacro( ) + |