Linux: set version explicitly in CMakeLists.txt instead of relying on parsing of Tcdefs.h which can be erroneous

This commit is contained in:
Mounir IDRASSI 2019-10-23 23:49:51 +02:00
parent 2b65a14301
commit 692e2c3455
No known key found for this signature in database
GPG Key ID: 02C30AE90FAE4A6F
1 changed files with 5 additions and 15 deletions

View File

@ -10,6 +10,11 @@ elseif ( NOT DEFINED NOGUI )
MESSAGE(FATAL_ERROR "NOGUI variable MUST BE set to TRUE if building 'Console' version, 'FALSE' otherwise")
endif()
# - Set version of the package
set( FULL_VERSION "1.24" )
set( VERSION "1.24.6" )
set( RELEASE "1" )
# - Set PROJECT_NAME and CONFLICT_PACKAGE values
if (NOGUI)
set( PROJECT_NAME "veracrypt-console" )
@ -206,21 +211,6 @@ set(CPACK_PACKAGING_INSTALL_PREFIX "/usr")
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Packaging) # creates the Packaging directory under build directory when CMake generates the build system
# - We excute 'grep VERSION_STRING ../../Common/Tcdefs.h | head -n 1' to get the line which include 'VERSION_STRING'
# Then we delete all first characters from the beginning of the line until the first '"' to get the version in the format : "X.YYY..."
# Then, we remove the leading and trailing '"' characters
# Then, we retrieve the 'version' and the 'release'
# Finally, we replace '-' in the release if it exists with a '.' because CPack does not like '-' in the release
execute_process(COMMAND grep VERSION_STRING "$ENV{SOURCEPATH}/Common/Tcdefs.h"
COMMAND head -n 1
OUTPUT_VARIABLE FULL_VERSION_LINE OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REGEX REPLACE "^[^\"]+" "" FULL_VERSION ${FULL_VERSION_LINE})
string(REGEX REPLACE "\"" "" FULL_VERSION ${FULL_VERSION})
string(REPLACE "." ";" FULL_VERSION_LIST ${FULL_VERSION})
list(GET FULL_VERSION_LIST 0 VERSION)
list(GET FULL_VERSION_LIST 1 RELEASE)
string(REPLACE "-" "." RELEASE ${RELEASE})
set( VENDOR "IDRIX" )
set( LICENSE "VeraCrypt License" )
set( CONTACT "VeraCrypt Team <veracrypt@idrix.fr>" )