Skip to content

Commit

Permalink
Merge pull request #1662 from ANTsX/cmake_version_warn
Browse files Browse the repository at this point in the history
COMP: Fix some CMake warnings
  • Loading branch information
cookpa authored Jan 18, 2024
2 parents 7bef93f + 667d4bf commit b83c8fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMake/CCache.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Based on https://crascit.com/2016/04/09/using-ccache-with-cmake/
cmake_minimum_required(VERSION 3.4)
cmake_minimum_required(VERSION 3.16.3)

find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
Expand Down
5 changes: 3 additions & 2 deletions CMake/ProjectSourceVersion.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ if(_GIT_VERSION_HASH STREQUAL "GITDIR-NOTFOUND")
return()
endif()

if(_GIT_VERSION_HASH MATCHES "[a-fA-F0-9]+")
if(_GIT_VERSION_HASH MATCHES "^[a-fA-F0-9]+$")
# Get first seven chars of hash (git default for short hash)
# https://git-scm.com/book/en/v2/Git-Tools-Revision-Selection
string(SUBSTRING "${_GIT_VERSION_HASH}" 0 7 _GIT_VERSION_HASH)
Expand All @@ -53,7 +53,8 @@ set(VERSION_REGEX "^v([0-9]+)\\.([0-9]+)+(\\.([0-9]+))?(\\.([0-9]+))?((a|b|c|rc)
string(REGEX MATCH "${VERSION_REGEX}" _out "${_GIT_TAG}")

if("${_out}" STREQUAL "")
message(WARNING "git tag: \"${_GIT_TAG}\" does not match expected version format!")
message(NOTICE "Could not parse most recent version from git tag: \"${_GIT_TAG}\"")
set(_GIT_VERSION "GITVERSION-NOTFOUND")
return()
endif()

Expand Down

0 comments on commit b83c8fe

Please sign in to comment.