cmake: Use the actual GIT_VERSION for ICINGA2_VERSION

And use a safe version with dots only for Windows.
This commit is contained in:
Markus Frosch 2019-04-04 12:55:52 +02:00
parent 1ab23c20fb
commit 9f82faa439
4 changed files with 12 additions and 8 deletions

View File

@ -27,9 +27,6 @@ option (USE_SYSTEMD
set(HAVE_SYSTEMD ${USE_SYSTEMD})
file(STRINGS VERSION VERSION_LINE REGEX "^Version: ")
string(REPLACE "Version: " "" ICINGA2_VERSION ${VERSION_LINE})
include(GNUInstallDirs)
include(InstallConfig)
include(SetFullDir)
@ -104,10 +101,17 @@ else()
string(SUBSTRING ${SPEC_REVISION} 10 ${SPEC_REVISION_LENGTH} SPEC_REVISION)
set(GIT_VERSION "r${SPEC_VERSION}-${SPEC_REVISION}")
set(ICINGA2_VERSION "${SPEC_VERSION}")
else()
# use GIT version as ICINGA2_VERSION
string(REGEX REPLACE "^[rv]" "" ICINGA2_VERSION "${GIT_VERSION}")
endif()
configure_file(icinga-version.h.cmake icinga-version.h)
endif()
# NuGet on Windows requires a semantic versioning, example: 2.10.4.123 (only 4 element, only numeric)
string(REGEX REPLACE "-([0-9]+).*$" ".\\1" ICINGA2_VERSION_SAFE "${ICINGA2_VERSION}")
if(WIN32)
set(Boost_USE_STATIC_LIBS ON)
# Disabled for linking issues for newer Boost versions, they link against Windows SDKs
@ -391,7 +395,7 @@ endif()
set(CPACK_PACKAGE_NAME "Icinga 2")
set(CPACK_PACKAGE_VENDOR "Icinga GmbH")
set(CPACK_PACKAGE_VERSION ${ICINGA2_VERSION})
set(CPACK_PACKAGE_VERSION ${ICINGA2_VERSION_SAFE})
set(CPACK_PACKAGE_INSTALL_DIRECTORY "ICINGA2")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/icinga-app\\\\icinga.ico")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt")

View File

@ -8,7 +8,7 @@ if(WIN32)
add_custom_target(choco-pkg ALL
COMMAND choco pack
COMMAND ${CMAKE_COMMAND} -E rename ${CMAKE_CURRENT_BINARY_DIR}/icinga2.${SPEC_VERSION}.nupkg ${CMAKE_CURRENT_BINARY_DIR}/icinga2.nupkg
COMMAND ${CMAKE_COMMAND} -E rename ${CMAKE_CURRENT_BINARY_DIR}/icinga2.${ICINGA2_VERSION_SAFE}.nupkg ${CMAKE_CURRENT_BINARY_DIR}/icinga2.nupkg
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/icinga2.nuspec ${CMAKE_CURRENT_BINARY_DIR}/chocolateyInstall.ps1 chocolateyUninstall.ps1
)
endif()

View File

@ -1,7 +1,7 @@
$packageName = 'icinga2'
$installerType = 'msi'
$url32 = 'https://packages.icinga.com/windows/Icinga2-v${SPEC_VERSION}-x86.msi'
$url64 = 'https://packages.icinga.com/windows/Icinga2-v${SPEC_VERSION}-x86_64.msi'
$url32 = 'https://packages.icinga.com/windows/Icinga2-v${ICINGA2_VERSION_SAFE}-x86.msi'
$url64 = 'https://packages.icinga.com/windows/Icinga2-v${ICINGA2_VERSION_SAFE}-x86_64.msi'
$silentArgs = '/qn /norestart'
$validExitCodes = @(0)

View File

@ -6,7 +6,7 @@
<!-- Read this before publishing packages to chocolatey.org: https://github.com/chocolatey/chocolatey/wiki/CreatePackages -->
<id>icinga2</id>
<title>Icinga 2</title>
<version>${SPEC_VERSION}</version>
<version>${ICINGA2_VERSION_SAFE}</version>
<authors>Icinga GmbH</authors>
<owners>Icinga GmbH</owners>
<summary>icinga2 - Monitoring Agent for Windows</summary>