Browse Source

Fix generation of the version.h header when inside a Git submodule.

pull/459/head
Vladimír Vondruš 6 years ago
parent
commit
b05a7ce3b7
  1. 2
      doc/changelog.dox
  2. 3
      src/Magnum/CMakeLists.txt

2
doc/changelog.dox

@ -89,6 +89,8 @@ See also:
assumed macOS is always desktop GL (see [mosra/magnum#452](https://github.com/mosra/magnum/issues/452)) assumed macOS is always desktop GL (see [mosra/magnum#452](https://github.com/mosra/magnum/issues/452))
- Avoiding conflicts of Magnum's own GL headers with `GLES3/gl32.h` (see - Avoiding conflicts of Magnum's own GL headers with `GLES3/gl32.h` (see
[mosra/magnum#460](https://github.com/mosra/magnum/issues/460)) [mosra/magnum#460](https://github.com/mosra/magnum/issues/460))
- The `version.h` header now gets populated from Git correctly also when
inside a CMake subproject
@subsection changelog-latest-bugfixes Bug fixes @subsection changelog-latest-bugfixes Bug fixes

3
src/Magnum/CMakeLists.txt

@ -37,6 +37,9 @@ if(Git_FOUND)
execute_process(COMMAND ${GIT_EXECUTABLE} describe --match "v*" --long execute_process(COMMAND ${GIT_EXECUTABLE} describe --match "v*" --long
OUTPUT_VARIABLE MAGNUM_VERSION_STRING OUTPUT_VARIABLE MAGNUM_VERSION_STRING
RESULT_VARIABLE _MAGNUM_VERSION_RESULT RESULT_VARIABLE _MAGNUM_VERSION_RESULT
# Otherwise this gets executed in the build dir, which might be inside
# a totally different Git working copy
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if(MAGNUM_VERSION_STRING MATCHES "^v([0-9][0-9][0-9][0-9])\\.0?([0-9][0-9]?)-([0-9]+)-g([a-f0-9]+)$") if(MAGNUM_VERSION_STRING MATCHES "^v([0-9][0-9][0-9][0-9])\\.0?([0-9][0-9]?)-([0-9]+)-g([a-f0-9]+)$")
set(MAGNUM_VERSION_YEAR ${CMAKE_MATCH_1}) set(MAGNUM_VERSION_YEAR ${CMAKE_MATCH_1})

Loading…
Cancel
Save