Skip to content

Commit

Permalink
fix: DynamicVersion (#423)
Browse files Browse the repository at this point in the history
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
  • Loading branch information
LecrisUT committed Feb 7, 2024
1 parent 383d1ff commit 62843bc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
2 changes: 2 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ GitHub release pages and in the git history.

### Fixes

- [\[#423\]] - Update DynamicVersion to v0.4.1. Fixes CMake build when git repository does not have a tag
- [\[#426\]] - Fix Windows installation path

### CI
Expand Down Expand Up @@ -2130,4 +2131,5 @@ in bravais.c.
[setuptools-scm]: https://setuptools-scm.readthedocs.io/en/latest/extending/#available-implementations
[\[#421\]]: https://github.com/spglib/spglib/pull/421
[\[#422\]]: https://github.com/spglib/spglib/pull/422
[\[#423\]]: https://github.com/spglib/spglib/pull/423
[\[#426\]]: https://github.com/spglib/spglib/pull/426
22 changes: 19 additions & 3 deletions cmake/DynamicVersion.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Retrieved from https://github.com/LecrisUT/CMakeExtraUtils/blob/v0.4.0/cmake/DynamicVersion.cmake
# Retrieved from https://github.com/LecrisUT/CMakeExtraUtils/blob/v0.4.1/cmake/DynamicVersion.cmake

#[===[.md:
# DynamicVersion
Expand Down Expand Up @@ -526,7 +526,15 @@ function(get_dynamic_version)
WORKING_DIRECTORY ${ARGS_PROJECT_SOURCE}
OUTPUT_VARIABLE describe-name
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ERROR_IS_FATAL ANY)
RESULT_VARIABLE git_describe_result
)
if (NOT git_status_result EQUAL 0)
message(${error_message_type}
"Git describe failed:\n"
" Source: ${ARGS_PROJECT_SOURCE}"
)
return()
endif ()
# Match any part containing digits and periods (strips out rc and so on)
if (NOT describe-name MATCHES "^(v?([0-9\\.]+)(-?[a-zA-z0-9]*)?(-([0-9]+)-g([a-f0-9]+))?)$")
message(${error_message_type}
Expand Down Expand Up @@ -556,7 +564,15 @@ function(get_dynamic_version)
WORKING_DIRECTORY ${ARGS_PROJECT_SOURCE}
OUTPUT_VARIABLE commit
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ERROR_IS_FATAL ANY)
RESULT_VARIABLE git_rev_parser_result
)
if (NOT git_rev_parser_result EQUAL 0)
message(${error_message_type}
"Could not get current git commit:\n"
" Source: ${ARGS_PROJECT_SOURCE}"
)
return()
endif ()
message(DEBUG "Found version git repo")
endif ()

Expand Down

0 comments on commit 62843bc

Please sign in to comment.