Implement the ICINGA2_GIT_VERSION_INFO option.

Refs #5410
This commit is contained in:
Gunnar Beutner 2014-05-18 14:33:38 +02:00
parent a05348acd2
commit 497e58e4d6
2 changed files with 4 additions and 1 deletions

View File

@ -34,6 +34,7 @@ set(ICINGA2_USER "icinga" CACHE STRING "Icinga 2 user")
set(ICINGA2_GROUP "icinga" CACHE STRING "Icinga 2 group") set(ICINGA2_GROUP "icinga" CACHE STRING "Icinga 2 group")
set(ICINGA2_COMMAND_USER "icinga" CACHE STRING "Icinga 2 command user") set(ICINGA2_COMMAND_USER "icinga" CACHE STRING "Icinga 2 command user")
set(ICINGA2_COMMAND_GROUP "icingacmd" CACHE STRING "Icinga 2 command group") set(ICINGA2_COMMAND_GROUP "icingacmd" CACHE STRING "Icinga 2 command group")
set(ICINGA2_GIT_VERSION_INFO ON CACHE BOOL "Whether to use git describe")
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/COPYING" ICINGA2_LICENSE_GPL) file(READ "${CMAKE_CURRENT_SOURCE_DIR}/COPYING" ICINGA2_LICENSE_GPL)
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.Exceptions" ICINGA2_LICENSE_ADDITIONS) file(READ "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.Exceptions" ICINGA2_LICENSE_ADDITIONS)
@ -45,7 +46,7 @@ git_describe(GIT_VERSION --tags)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/icinga-version.h.force) if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/icinga-version.h.force)
configure_file(icinga-version.h.force ${CMAKE_CURRENT_BINARY_DIR}/icinga-version.h COPYONLY) configure_file(icinga-version.h.force ${CMAKE_CURRENT_BINARY_DIR}/icinga-version.h COPYONLY)
else() else()
if(GIT_VERSION MATCHES "-NOTFOUND$") if(NOT ICINGA2_GIT_VERSION_INFO OR GIT_VERSION MATCHES "-NOTFOUND$")
file(STRINGS icinga2.spec SPEC_VERSION REGEX "^Version:") file(STRINGS icinga2.spec SPEC_VERSION REGEX "^Version:")
string(SUBSTRING ${SPEC_VERSION} 9 -1 SPEC_VERSION) string(SUBSTRING ${SPEC_VERSION} 9 -1 SPEC_VERSION)
set(GIT_VERSION "r${SPEC_VERSION}") set(GIT_VERSION "r${SPEC_VERSION}")

View File

@ -81,6 +81,8 @@ Note: CMake determines the Icinga 2 version number using "git describe" if the
source directory is contained in a Git repository. Otherwise the version number source directory is contained in a Git repository. Otherwise the version number
is extracted from the icinga2.spec file. This behavior can be overridden by is extracted from the icinga2.spec file. This behavior can be overridden by
creating a file called "icinga-version.h.force" in the source directory. creating a file called "icinga-version.h.force" in the source directory.
Alternatively the -DICINGA2_GIT_VERSION_INFO=ON option for CMake can be used to
disable the usage of "git describe".
Use "git archive" to build the release tarball: Use "git archive" to build the release tarball: