]> granicus.if.org Git - icinga2/commitdiff
Fix compatibility with older versions of CMake.
authorGunnar Beutner <gunnar.beutner@netways.de>
Tue, 20 May 2014 06:30:26 +0000 (08:30 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Tue, 20 May 2014 06:30:26 +0000 (08:30 +0200)
Fixes #6240

CMakeLists.txt

index b46ca827dcbdbe5219c48f4ef5af2e1489c97e51..f8a47f6c478fdbbda4751c740f8a3dc8d2b4097e 100644 (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)