From a0cefa14ba0962f81fc3f7e0d12851c0b09bbdef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=98=95?= Date: Fri, 23 Dec 2022 15:08:30 +0800 Subject: [PATCH] =?UTF-8?q?OCT=201.=20=E6=9B=B4=E6=96=B0=E6=89=93=E5=8C=85?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 9 ++++----- srcs/CMakeLists.txt | 7 ++++++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b119dee..a6f17b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,26 +44,25 @@ IF (GIT_FOUND) ERROR_QUIET WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) - EXECUTE_PROCESS( COMMAND ${GIT_EXECUTABLE} describe --tags --always --dirty=-dev - OUTPUT_VARIABLE GIT_TAG + OUTPUT_VARIABLE VERSION_GIT_TAG OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) ENDIF () -IF ("${GIT_TAG}" STREQUAL "") +IF ("${VERSION_GIT_TAG}" STREQUAL "") STRING(TIMESTAMP COMPILE_TIME %Y-%m-%d_%H:%M:%S) SET(VERSION_GIT_TAG ${COMPILE_TIME}) ELSE () - SET(VERSION_GIT_TAG ${GIT_TAG}) + SET(VERSION_GIT_TAG ${VERSION_GIT_TAG}) ENDIF () CONFIGURE_FILE(prj_config.h.in prj_config.h) -MESSAGE("Version: " ${VERSION_GIT_TAG}) +MESSAGE("Git Tag: " ${VERSION_GIT_TAG}) IF (USED_LWIP) LIST(APPEND COMMON_DEFINE "-DLWIP_ON") diff --git a/srcs/CMakeLists.txt b/srcs/CMakeLists.txt index 9eb6ceb..748ae82 100644 --- a/srcs/CMakeLists.txt +++ b/srcs/CMakeLists.txt @@ -83,5 +83,10 @@ INSTALL(TARGETS ${PROJECT_TARGET} RUNTIME DESTINATION bin) 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) \ No newline at end of file