diff --git a/src/Corrade/CMakeLists.txt b/src/Corrade/CMakeLists.txt index 83c90e6ae..a5394956e 100644 --- a/src/Corrade/CMakeLists.txt +++ b/src/Corrade/CMakeLists.txt @@ -44,10 +44,12 @@ if(Git_FOUND) OUTPUT_VARIABLE CORRADE_VERSION_STRING RESULT_VARIABLE _CORRADE_VERSION_RESULT ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) - if(CORRADE_VERSION_STRING MATCHES "^v([0-9][0-9][0-9][0-9])\\.0?([0-9][0-9])-([0-9]+)-g([a-f0-9]+)$") + if(CORRADE_VERSION_STRING MATCHES "^v([0-9][0-9][0-9][0-9])\\.0?([0-9][0-9]?)-([0-9]+)-g([a-f0-9]+)$") set(CORRADE_VERSION_YEAR ${CMAKE_MATCH_1}) set(CORRADE_VERSION_MONTH ${CMAKE_MATCH_2}) set(CORRADE_VERSION_COMMIT ${CMAKE_MATCH_3}) + # Otherwise if commit is 0, it would #undef the variable + set(CORRADE_VERSION_COMMIT " ${CORRADE_VERSION_COMMIT}") set(CORRADE_VERSION_HASH ${CMAKE_MATCH_4}) elseif(_CORRADE_VERSION_RESULT EQUAL 0) message(WARNING "Can't match Git version from ${CORRADE_VERSION_STRING}") diff --git a/src/Corrade/version.h.cmake b/src/Corrade/version.h.cmake index a74cfd07b..9bb00419b 100644 --- a/src/Corrade/version.h.cmake +++ b/src/Corrade/version.h.cmake @@ -31,7 +31,7 @@ #define CORRADE_VERSION_YEAR ${CORRADE_VERSION_YEAR} #define CORRADE_VERSION_MONTH ${CORRADE_VERSION_MONTH} -#cmakedefine CORRADE_VERSION_COMMIT ${CORRADE_VERSION_COMMIT} +#cmakedefine CORRADE_VERSION_COMMIT${CORRADE_VERSION_COMMIT} #cmakedefine CORRADE_VERSION_HASH 0x${CORRADE_VERSION_HASH} #cmakedefine CORRADE_VERSION_STRING "${CORRADE_VERSION_STRING}"