-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmake: set CMAKE_PROJECT_VERSION from git, add it back to thisepic.sh (…
…#758) ### Briefly, what does this PR introduce? This uses same code as in EICrecon. This partially undoes of #733, geometry version is useful. ### What kind of change does this PR introduce? - [ ] Bug fix (issue #__) - [x] New feature (issue #__) - [ ] Documentation update - [ ] Other: __ ### Please check if this PR fulfills the following: - [ ] Tests for the changes have been added - [ ] Documentation has been added / updated - [ ] Changes have been communicated to collaborators ### Does this PR introduce breaking changes? What changes might users need to make to their code? No ### Does this PR change default behavior? No --------- Co-authored-by: Wouter Deconinck <[email protected]>
- Loading branch information
Showing
5 changed files
with
47 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Determine version from git describe cmake-lint: disable=C0103 | ||
macro(set_git_version VERSION) | ||
if(NOT Git_Found) | ||
find_package(Git) | ||
endif() | ||
|
||
if(GIT_EXECUTABLE) | ||
# Generate a git-describe version string from Git repository tags | ||
execute_process( | ||
COMMAND ${GIT_EXECUTABLE} describe --tags --dirty --match "v*" | ||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | ||
OUTPUT_VARIABLE GIT_DESCRIBE_VERSION | ||
RESULT_VARIABLE GIT_DESCRIBE_ERROR_CODE | ||
OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
if(NOT GIT_DESCRIBE_ERROR_CODE) | ||
set(${VERSION} ${GIT_DESCRIBE_VERSION}) | ||
endif() | ||
endif() | ||
|
||
# Final fallback: Just use a bogus version string that is semantically older | ||
# than anything else and spit out a warning to the developer. | ||
if(NOT DEFINED ${VERSION}) | ||
set(${VERSION} v0.0.0-unknown) | ||
message( | ||
WARNING | ||
"Failed to determine VERSION from Git tags. Using default version \"${${VERSION}}\"." | ||
) | ||
endif() | ||
endmacro() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<!-- SPDX-License-Identifier: LGPL-3.0-or-later --> | ||
<!-- Copyright (C) 2024 Dmitry Kalinkin --> | ||
|
||
<constant name="epic_version" value="@CMAKE_PROJECT_VERSION@" /> |