diff options
author | Jonathan White <support@dmapps.us> | 2019-01-30 23:00:47 +0300 |
---|---|---|
committer | Jonathan White <support@dmapps.us> | 2019-01-30 23:03:03 +0300 |
commit | 21d1e981ca4f38a07d4621ef4f4168d1576c96e7 (patch) | |
tree | 3b4bceb8f80843bb4503f36903e220299229ed4b /CMakeLists.txt | |
parent | 7f3ce65d96d298704be96945be74789a6cf469b7 (diff) |
Cleanup CMakeFiles prior to release
* Remove Git revision finding code in favor of a simple command call: git rev-parse --short=7 HEAD
* Added GIT_HEAD_OVERRIDE to explicitly define the hash for the current commit in case git is not available
* Made WIX default over NSIS in release tool
* Rename version.h to git-info.h
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 85f27b871..658548f70 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,11 +84,25 @@ set(KEEPASSXC_VERSION "${KEEPASSXC_VERSION_MAJOR}.${KEEPASSXC_VERSION_MINOR}.${K set(KEEPASSXC_BUILD_TYPE "Snapshot" CACHE STRING "Set KeePassXC build type to distinguish between stable releases and snapshots") set_property(CACHE KEEPASSXC_BUILD_TYPE PROPERTY STRINGS Snapshot Release PreRelease) +# Retrieve git HEAD revision hash +set(GIT_HEAD_OVERRIDE "" CACHE STRING "Manually set the Git HEAD hash when missing (eg, when no .git folder exists)") +execute_process(COMMAND git rev-parse --short=7 HEAD + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE GIT_HEAD + ERROR_QUIET) +string(STRIP "${GIT_HEAD}" GIT_HEAD) +if(GIT_HEAD STREQUAL "") + string(SUBSTRING "${GIT_HEAD_OVERRIDE}" 0 7 GIT_HEAD) +endif() +message(STATUS "Found Git HEAD Revision: ${GIT_HEAD}\n") + # Check if on a tag, if so build as a release execute_process(COMMAND git tag --points-at HEAD WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_VARIABLE GIT_TAG) + OUTPUT_VARIABLE GIT_TAG + ERROR_QUIET) if(GIT_TAG) + string(STRIP "${GIT_TAG}" GIT_TAG) set(OVERRIDE_VERSION ${GIT_TAG}) elseif(EXISTS ${CMAKE_SOURCE_DIR}/.version) file(READ ${CMAKE_SOURCE_DIR}/.version OVERRIDE_VERSION) |