# 通过git获取版本宏 BUILD_TAG_VERSION
execute_process(COMMAND git describe --tags
TIMEOUT 5
OUTPUT_VARIABLE GIT_TAG_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message(STATUS "building from git tag ${GIT_TAG_VERSION}")
add_definitions(-DBUILD_TAG_VERSION=\"${GIT_TAG_VERSION}\")
# 通过git获取版本宏 BUILD_LOG_VERSION
execute_process(COMMAND git log -1 --pretty=format:%h
TIMEOUT 5
OUTPUT_VARIABLE BUILD_LOG_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message(STATUS "building from git log ${BUILD_LOG_VERSION}")
add_definitions(-DBUILD_LOG_VERSION=\"${BUILD_LOG_VERSION}\")
|