Fixed getting the current time wrong in the script file (#712)

Co-authored-by: Yang Kun <13147081-ikspress@users.noreply.gitlab.com>
This commit is contained in:
Yang Kun 2024-02-16 21:30:38 +08:00 committed by GitHub
parent 1f77bcec17
commit d40cbef104
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -188,21 +188,7 @@ ENDIF(LIBUSB_INCLUDE_DIRS)
# version.rc for Windows
IF(WIN32)
# Date for filling in rc file information
IF (CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
MACRO (GET_CURRENT_YEAR RESULT)
EXECUTE_PROCESS(COMMAND "cmd" " /C date /T" OUTPUT_VARIABLE ${RESULT})
STRING(REGEX REPLACE "\n" "" ${RESULT} ${${RESULT}})
STRING(REGEX REPLACE ".*(..)/(..)/(....).*" "\\3" ${RESULT} ${${RESULT}})
ENDMACRO (GET_CURRENT_YEAR)
ELSE(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
MACRO (GET_CURRENT_YEAR RESULT)
EXECUTE_PROCESS(COMMAND "date" "+%Y" OUTPUT_VARIABLE ${RESULT})
STRING(REGEX REPLACE "\n" "" ${RESULT} ${${RESULT}})
ENDMACRO (GET_CURRENT_YEAR)
ENDIF(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
GET_CURRENT_YEAR(CURRENT_YEAR)
MESSAGE("Year for copyright is " ${CURRENT_YEAR})
STRING(TIMESTAMP CURRENT_YEAR %Y)
SET(prefix ${CMAKE_INSTALL_PREFIX})
SET(RC_COMMENT "${PACKAGE_NAME} library")
SET(RC_INTERNAL_NAME "${PACKAGE_NAME} ${WIN32_MODE}")