else()
if(NOT ICINGA2_GIT_VERSION_INFO OR GIT_VERSION MATCHES "-NOTFOUND$")
file(STRINGS icinga2.spec SPEC_VERSION REGEX "^Version:")
- string(SUBSTRING ${SPEC_VERSION} 9 -1 SPEC_VERSION)
- set(GIT_VERSION "r${SPEC_VERSION}")
+ string(LENGTH "${SPEC_VERSION}" SPEC_VERSION_LENGTH)
+ math(EXPR SPEC_VERSION_LENGTH "${SPEC_VERSION_LENGTH} - 9")
+ string(SUBSTRING ${SPEC_VERSION} 9 ${SPEC_VERSION_LENGTH} SPEC_VERSION)
+
+ file(STRINGS icinga2.spec SPEC_REVISION REGEX "^%define revision ")
+ string(LENGTH "${SPEC_REVISION}" SPEC_REVISION_LENGTH)
+ math(EXPR SPEC_REVISION_LENGTH "${SPEC_REVISION_LENGTH} - 17")
+ string(SUBSTRING ${SPEC_REVISION} 17 ${SPEC_REVISION_LENGTH} SPEC_REVISION)
+
+ set(GIT_VERSION "r${SPEC_VERSION}-${SPEC_REVISION}")
endif()
configure_file(icinga-version.h.cmake icinga-version.h)
endif()