Fix compatibility with older versions of CMake.

Fixes 
This commit is contained in:
Gunnar Beutner 2014-05-20 08:30:26 +02:00
parent 6c0b8db4bf
commit c5e3d5de9d
1 changed files with 3 additions and 1 deletions

View File

@ -48,7 +48,9 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/icinga-version.h.force)
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)
string(LENGTH "${SPEC_VERSION}" SPEC_LENGTH)
math(EXPR SPEC_LENGTH "${SPEC_LENGTH} - 9")
string(SUBSTRING ${SPEC_VERSION} 9 ${SPEC_LENGTH} SPEC_VERSION)
set(GIT_VERSION "r${SPEC_VERSION}")
endif()
configure_file(icinga-version.h.cmake icinga-version.h)