diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index a76f89e..7e09b83 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,14 +46,21 @@ endif (UseLibCpp) # detect version and commit from mercurial if (MercurialRepo AND EXISTS "${PROJECT_SOURCE_DIR}/.hg") - execute_process(COMMAND hg log -r '.' --template={latesttag} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VcsVersion OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND hg log -r '.' --template={bookmarks} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VcsBookmark OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND hg log -r '.' --template={latesttag}.{latesttagdistance} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerInfo OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND hg log -r '.' --template={bookmarks} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerBookmark OUTPUT_STRIP_TRAILING_WHITESPACE) + # remove bookmark if it's not set if(VcsBookmark STREQUAL "") unset(VcsBookmark) endif() - execute_process(COMMAND hg identify --id WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VcsCommit OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND hg identify --num WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VcsRevision OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND hg identify --branch WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VcsBranch OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND hg identify --id WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerCommit OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND hg identify --num WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerRevision OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND hg identify --branch WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE VerBranch OUTPUT_STRIP_TRAILING_WHITESPACE) +else() + set(VerInfo "0.0.0.0") + set(VerBookmark "unknown") + set(VerCommit "00000000") + set(VerRevision "0") + set(VerBranch "default") endif() # configure a header file to pass version information @@ -82,8 +89,7 @@ if (Tests) add_subdirectory(test) endif() -if(NOT VcsVersion STREQUAL "") - message("VCS latesttag='${VcsVersion}' bookmark='${VcsBookmark}' commit='${VcsCommit}'") -endif() +message("Version='${VerInfo}' bookmark='${VerBookmark}' commit='${VerCommit}'") + feature_summary(WHAT ALL) |