mirror of
https://github.com/NGSolve/netgen.git
synced 2025-05-07 11:10:50 +05:00
cmake/generate_version_file: catch errors at the end
The directory-based extraction can fail if the directory was renamed before netgen was configured (e.g., CMake's ExternalProject will generally rename the top-level directory to `src` for consistency). If the directory name extraction failed, an empty string ended up in the binary which causes runtime failures when trying to parse as an integer.
This commit is contained in:
parent
9d94294f30
commit
1020b99948
@ -15,12 +15,14 @@ if(status AND NOT status EQUAL 0)
|
||||
get_filename_component(git_version_string ${CMAKE_CURRENT_LIST_DIR}/.. NAME)
|
||||
string(REGEX REPLACE "^netgen(.*)" "\\1" git_version_string "${git_version_string}")
|
||||
endif()
|
||||
else()
|
||||
MESSAGE(WARNING "Could not determine git-version from source code - assuming 6.2.0.0")
|
||||
set(git_version_string "v6.2.0.0")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT git_version_string)
|
||||
message(WARNING "Could not determine git-version from source code - assuming 6.2.0.0")
|
||||
set(git_version_string "v6.2.0.0")
|
||||
endif ()
|
||||
|
||||
string(REGEX REPLACE "^v([0-9]+)\\..*" "\\1" NETGEN_VERSION_MAJOR "${git_version_string}")
|
||||
string(REGEX REPLACE "^v[0-9]+\\.([0-9]+).*" "\\1" NETGEN_VERSION_MINOR "${git_version_string}")
|
||||
string(REGEX REPLACE "^v[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" NETGEN_VERSION_PATCH "${git_version_string}")
|
||||
|
Loading…
x
Reference in New Issue
Block a user