Verified Commit 497a0697 authored by Jellby's avatar Jellby

Try to get correct version tag when not using git

If the code is downloaded as a package (zip/tar), and it comes from
"git archive", it should now contain the appropriate sha and tag in
the .tags file, from which the version string can be generated.
parent fce3e890
Pipeline #14088616 (#) passed with stage
in 41 seconds
.tags export-subst
$Format:%H%+d$
......@@ -372,7 +372,29 @@ if (EXISTS ${GIT})
if (NOT ${GIT_BRANCH} STREQUAL "")
string(STRIP ${GIT_BRANCH} GIT_BRANCH)
endif ()
endif ()
if (DEFINED OPENMOLCAS_VERSION)
# Read the version from the .tags file, which should be populated when the code
# has been obtained from "git archive". Since there's no way to know if the
# code has been modified, add a question mark
elseif (EXISTS ${OPENMOLCAS_DIR}/.tags)
file (STRINGS ${OPENMOLCAS_DIR}/.tags LINES)
foreach (line ${LINES})
string (FIND "${line}" "(" has_paren)
string (FIND "${line}" "%" has_percent)
string (REGEX MATCH "tag: (v[^,]*)," match ${line})
# Parse the tag if present
if (has_paren GREATER -1)
if (NOT ${match} STREQUAL "")
set (OPENMOLCAS_VERSION "${CMAKE_MATCH_1} ?")
endif ()
# Or just use the commit sha, making sure this is not the raw file
elseif (has_percent EQUAL -1)
string (SUBSTRING ${line} 0 14 OPENMOLCAS_VERSION)
set (OPENMOLCAS_VERSION "o${OPENMOLCAS_VERSION} ?")
endif ()
endforeach ()
elseif (EXISTS ${MOLCAS_VERSION_FILE})
file (STRINGS ${MOLCAS_VERSION_FILE} LINES)
foreach (line ${LINES})
......@@ -2754,7 +2776,9 @@ string(REGEX REPLACE "([^;]+)" "-D\\1" defargs "${defs}")
message("Definitions: ${defargs}")
foreach (BASE_DIR ${basedirs})
file (GLOB source RELATIVE ${BASE_DIR}/src/Driver ${BASE_DIR}/src/Driver/*.prgm.src)
list (REVERSE external_prgm)
if (DEFINED external_prgm)
list (REVERSE external_prgm)
endif ()
foreach (prgmsrc ${external_prgm})
file (GLOB ext_source RELATIVE ${BASE_DIR}/src/Driver ${prgmsrc})
list (INSERT source 0 ${ext_source})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment