gnucash/cmake/version-info2env.cmake
Geert Janssens c4a21bc9d4 Extract a few cmake commands to dedicated files rather than generating them on the fly
This simplifies a number of escape sequences.

The generated file to configure the man page was split up a bit further:
- code that extracted the GNC_VCS_REV_Y_M from gnc-vcs-info.h was spun out
  into its own function that now sets all parameters in gnc-vcs-info.h
  as environment variables.
- this function is now invoked by configure-manpage.cmake to extract
  the date to insert into the manpage.
- the manpage in addition now shows the full date rather than only
  yyyy-mm. This is how man itself does it as well.
2019-08-24 17:05:03 +02:00

14 lines
504 B
CMake

# Extract the parameters set in _VCS_INFO_FILE and export them as environment variables
# _VCS_INFO_FILE should be the full path to gnc-vcs-info.h
function (versioninfo2env _VCS_INFO_FILE)
file(STRINGS ${_VCS_INFO_FILE} lines REGEX "#define")
foreach(line ${lines})
string(REGEX REPLACE "^.* (.*) \"(.*)\"" "\\1;\\2" _param_val ${line})
list(GET _param_val 0 _param)
list(GET _param_val 1 _val)
set(${_param} ${_val} PARENT_SCOPE)
endforeach()
endfunction()