Skip to content

Commit

Permalink
Make ICINGA2_VERSION a CMake file
Browse files Browse the repository at this point in the history
not to parse it.
  • Loading branch information
Al2Klimov committed Feb 22, 2023
1 parent 222724f commit 4e52b82
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,8 @@ file(READ "${CMAKE_CURRENT_SOURCE_DIR}/COPYING" ICINGA2_LICENSE_GPL)
set(ICINGA2_LICENSE "${ICINGA2_LICENSE_GPL}\n\n---\n\n${ICINGA2_LICENSE_ADDITIONS}")
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt" ${ICINGA2_LICENSE})

file(STRINGS ICINGA2_VERSION SPEC_VERSION REGEX "^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)
include(ICINGA2_VERSION.cmake)
set(SPEC_VERSION "${ICINGA2_VERSION}")

configure_file(icinga-spec-version.h.cmake icinga-spec-version.h)

Expand All @@ -112,10 +110,9 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/icinga-version.h.force)
else()
if(NOT ICINGA2_GIT_VERSION_INFO OR GIT_VERSION MATCHES "-NOTFOUND$")
set(GIT_VERSION "v${SPEC_VERSION}")
set(ICINGA2_VERSION "${SPEC_VERSION}")
else()
if(GIT_VERSION MATCHES "-g")
# Override v2.13.0-555-g11e37a0bd from git describe with 2.13.7 from ./ICINGA2_VERSION -> v2.13.7-555-g11e37a0bd
# Override v2.13.0-555-g11e37a0bd from git describe with 2.13.7 from ./ICINGA2_VERSION.cmake -> v2.13.7-555-g11e37a0bd
string(REGEX REPLACE ^[v0-9.]+ "v${SPEC_VERSION}" GIT_VERSION "${GIT_VERSION}")
endif()
# use GIT version as ICINGA2_VERSION
Expand Down
1 change: 0 additions & 1 deletion ICINGA2_VERSION

This file was deleted.

1 change: 1 addition & 0 deletions ICINGA2_VERSION.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
set(ICINGA2_VERSION "2.13.0")

0 comments on commit 4e52b82

Please sign in to comment.