OCT 1. 更新打包文件名称

This commit is contained in:
黄昕 2022-12-23 15:08:30 +08:00
parent c7c4975983
commit a0cefa14ba
2 changed files with 10 additions and 6 deletions

View File

@ -44,26 +44,25 @@ IF (GIT_FOUND)
ERROR_QUIET ERROR_QUIET
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
) )
EXECUTE_PROCESS( EXECUTE_PROCESS(
COMMAND ${GIT_EXECUTABLE} describe --tags --always --dirty=-dev COMMAND ${GIT_EXECUTABLE} describe --tags --always --dirty=-dev
OUTPUT_VARIABLE GIT_TAG OUTPUT_VARIABLE VERSION_GIT_TAG
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET ERROR_QUIET
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
) )
ENDIF () ENDIF ()
IF ("${GIT_TAG}" STREQUAL "") IF ("${VERSION_GIT_TAG}" STREQUAL "")
STRING(TIMESTAMP COMPILE_TIME %Y-%m-%d_%H:%M:%S) STRING(TIMESTAMP COMPILE_TIME %Y-%m-%d_%H:%M:%S)
SET(VERSION_GIT_TAG ${COMPILE_TIME}) SET(VERSION_GIT_TAG ${COMPILE_TIME})
ELSE () ELSE ()
SET(VERSION_GIT_TAG ${GIT_TAG}) SET(VERSION_GIT_TAG ${VERSION_GIT_TAG})
ENDIF () ENDIF ()
CONFIGURE_FILE(prj_config.h.in prj_config.h) CONFIGURE_FILE(prj_config.h.in prj_config.h)
MESSAGE("Version: " ${VERSION_GIT_TAG}) MESSAGE("Git Tag: " ${VERSION_GIT_TAG})
IF (USED_LWIP) IF (USED_LWIP)
LIST(APPEND COMMON_DEFINE "-DLWIP_ON") LIST(APPEND COMMON_DEFINE "-DLWIP_ON")

View File

@ -83,5 +83,10 @@ INSTALL(TARGETS ${PROJECT_TARGET}
RUNTIME DESTINATION bin) RUNTIME DESTINATION bin)
SET(CPACK_GENERATOR "TGZ") SET(CPACK_GENERATOR "TGZ")
SET(CPACK_PACKAGE_FILE_NAME "vCPE-${VCPE_VERSION}-linux-amd64_${VERSION_GIT_HASH_SHORT}") IF ("${VERSION_GIT_HASH_SHORT}" STREQUAL "")
SET(CPACK_PACKAGE_FILE_NAME "vCPE-${VCPE_VERSION}-linux-amd64_${VERSION_GIT_TAG}")
ELSE ()
SET(CPACK_PACKAGE_FILE_NAME "vCPE-${VCPE_VERSION}-linux-amd64_${VERSION_GIT_HASH_SHORT}")
ENDIF ()
INCLUDE(CPack) INCLUDE(CPack)