1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-12-26 18:19:53 +03:00

CMake: fix date/time leading 0 removal regex and print both during configuration

The previous regex expression removed all the 0s present in the input string, meaning that it caused the build to fail in case one of the date/time values was effectively 0.
This commit is contained in:
Davide Beatrici 2018-09-13 22:54:03 +02:00
parent 8e3927f27c
commit 39858d7017

View File

@ -42,12 +42,15 @@ string(TIMESTAMP BUILD_MINUTE "%M" UTC)
string(TIMESTAMP BUILD_SECOND "%S" UTC)
## Remove leading 0
string(REGEX REPLACE "^0" "" BUILD_DAY "${BUILD_DAY}")
string(REGEX REPLACE "^0" "" BUILD_MONTH "${BUILD_MONTH}")
string(REGEX REPLACE "^0" "" BUILD_YEAR "${BUILD_YEAR}")
string(REGEX REPLACE "^0" "" BUILD_HOUR "${BUILD_HOUR}")
string(REGEX REPLACE "^0" "" BUILD_MINUTE "${BUILD_MINUTE}")
string(REGEX REPLACE "^0" "" BUILD_SECOND "${BUILD_SECOND}")
string(REGEX REPLACE "^0([^ ]*)" "\\1" BUILD_DAY "${BUILD_DAY}")
string(REGEX REPLACE "^0([^ ]*)" "\\1" BUILD_MONTH "${BUILD_MONTH}")
string(REGEX REPLACE "^0([^ ]*)" "\\1" BUILD_YEAR "${BUILD_YEAR}")
string(REGEX REPLACE "^0([^ ]*)" "\\1" BUILD_HOUR "${BUILD_HOUR}")
string(REGEX REPLACE "^0([^ ]*)" "\\1" BUILD_MINUTE "${BUILD_MINUTE}")
string(REGEX REPLACE "^0([^ ]*)" "\\1" BUILD_SECOND "${BUILD_SECOND}")
message(STATUS "Build date: ${BUILD_DAY}/${BUILD_MONTH}/${BUILD_YEAR}")
message(STATUS "Build time: ${BUILD_HOUR}:${BUILD_MINUTE}:${BUILD_SECOND}")
add_definitions(-DBUILD_DATE_D=${BUILD_DAY} -DBUILD_DATE_M=${BUILD_MONTH} -DBUILD_DATE_Y=${BUILD_YEAR})
add_definitions(-DBUILD_DATE_HO=${BUILD_HOUR} -DBUILD_DATE_MI=${BUILD_MINUTE} -DBUILD_DATE_SE=${BUILD_SECOND})