Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set HAVE_GIT_VERSION to TRUE if it is a git repository #1876

Merged
merged 2 commits into from
Oct 22, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions cmake/modules/ConfigCMake.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,14 @@ endif (NOT CMAKE_BUILD_TYPE)

# Here we change it to add the git commit hash for non-public releases
set (GMT_PACKAGE_VERSION_WITH_GIT_REVISION ${GMT_PACKAGE_VERSION})

# Check if it's a git repository of not
seisman marked this conversation as resolved.
Show resolved Hide resolved
if (EXISTS ${GMT_SOURCE_DIR}/.git)
set (HAVE_GIT_VERSION TRUE)
endif (EXISTS ${GMT_SOURCE_DIR}/.git)

# Add the last git commit hash and date to the package version if this is a non-public release.
# A non-public release has a FALSE 'GMT_PUBLIC_RELEASE' variable in 'ConfigDefault.cmake'.
#set (HAVE_GIT_VERSION)
if (GIT_FOUND AND NOT GMT_PUBLIC_RELEASE)
# Get the last git commit hash
execute_process (
Expand All @@ -55,7 +60,6 @@ if (GIT_FOUND AND NOT GMT_PUBLIC_RELEASE)
message (STATUS "Unable to determine git commit hash for non-public release - ignoring.")
else (GIT_RETURN_CODE)
if (GIT_COMMIT_HASH)
set (HAVE_GIT_VERSION TRUE)
# For non-public release, add the last git commit hash and date
execute_process (
COMMAND ${GIT_EXECUTABLE} log -1 --date=short --pretty=format:%cd
Expand Down