Set versions for all internal libraries

fixes #12552
This commit is contained in:
Gunnar Beutner 2016-08-25 17:32:20 +02:00
parent 092f2ee099
commit 30762e5330
24 changed files with 35 additions and 7 deletions

View File

@ -70,17 +70,19 @@ file(READ "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.Exceptions" ICINGA2_LICENSE_ADDIT
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.spec 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)
configure_file(icinga-spec-version.h.cmake icinga-spec-version.h)
include(GetGitRevisionDescription)
git_describe(GIT_VERSION --tags)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/icinga-version.h.force)
configure_file(icinga-version.h.force ${CMAKE_CURRENT_BINARY_DIR}/icinga-version.h COPYONLY)
else()
if(NOT ICINGA2_GIT_VERSION_INFO OR GIT_VERSION MATCHES "-NOTFOUND$")
file(STRINGS icinga2.spec 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)
file(STRINGS icinga2.spec SPEC_REVISION REGEX "^%define revision ")
string(LENGTH "${SPEC_REVISION}" SPEC_REVISION_LENGTH)
math(EXPR SPEC_REVISION_LENGTH "${SPEC_REVISION_LENGTH} - 17")

View File

@ -0,0 +1 @@
#define SPEC_VERSION "${SPEC_VERSION}"

View File

@ -77,6 +77,7 @@ set_target_properties (
INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
DEFINE_SYMBOL I2_BASE_BUILD
FOLDER Lib
VERSION ${SPEC_VERSION}
)
install(CODE "file(MAKE_DIRECTORY \"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/cache/icinga2\")")

View File

@ -19,6 +19,7 @@
#include "base/application.hpp"
#include "icinga-version.h"
#include "icinga-spec-version.h"
using namespace icinga;
@ -27,3 +28,7 @@ String Application::GetAppVersion(void)
return VERSION;
}
String Application::GetAppSpecVersion(void)
{
return SPEC_VERSION;
}

View File

@ -132,6 +132,7 @@ public:
static ThreadPool& GetTP(void);
static String GetAppVersion(void);
static String GetAppSpecVersion(void);
static double GetStartTime(void);
static void SetStartTime(double ts);

View File

@ -34,9 +34,9 @@ void Loader::LoadExtensionLibrary(const String& library)
#if defined(_WIN32)
path = library + ".dll";
#elif defined(__APPLE__)
path = "lib" + library + ".dylib";
path = "lib" + library + "." + Application::GetAppSpecVersion() + ".dylib";
#else /* __APPLE__ */
path = "lib" + library + ".so";
path = "lib" + library + ".so." + Application::GetAppSpecVersion();
#endif /* _WIN32 */
Log(LogNotice, "Loader")

View File

@ -34,6 +34,7 @@ set_target_properties (
INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
DEFINE_SYMBOL I2_CHECKER_BUILD
FOLDER Components
VERSION ${SPEC_VERSION}
)
install_if_not_exists(

View File

@ -54,6 +54,7 @@ set_target_properties (
INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
DEFINE_SYMBOL I2_CLI_BUILD
FOLDER Lib
VERSION ${SPEC_VERSION}
)
install(

View File

@ -39,6 +39,7 @@ set_target_properties (
INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
DEFINE_SYMBOL I2_COMPAT_BUILD
FOLDER Components
VERSION ${SPEC_VERSION}
)
install_if_not_exists(

View File

@ -53,6 +53,7 @@ set_target_properties (
INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
DEFINE_SYMBOL I2_CONFIG_BUILD
FOLDER Lib
VERSION ${SPEC_VERSION}
)
install(

View File

@ -42,6 +42,7 @@ set_target_properties (
INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
DEFINE_SYMBOL I2_DB_IDO_BUILD
FOLDER Lib
VERSION ${SPEC_VERSION}
)
install(

View File

@ -38,6 +38,7 @@ if(MYSQL_FOUND)
INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
DEFINE_SYMBOL I2_DB_IDO_MYSQL_BUILD
FOLDER Components
VERSION ${SPEC_VERSION}
)
install_if_not_exists(

View File

@ -40,6 +40,7 @@ if(PostgreSQL_FOUND)
INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
DEFINE_SYMBOL I2_DB_IDO_PGSQL_BUILD
FOLDER Components
VERSION ${SPEC_VERSION}
)
install_if_not_exists(

View File

@ -34,6 +34,7 @@ set_target_properties (
INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
DEFINE_SYMBOL I2_DEMO_BUILD
FOLDER Components
VERSION ${SPEC_VERSION}
)
install(

View File

@ -34,6 +34,7 @@ set_target_properties (
INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
DEFINE_SYMBOL I2_HELLO_BUILD
FOLDER Lib
VERSION ${SPEC_VERSION}
)
install(

View File

@ -66,6 +66,7 @@ set_target_properties (
INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
DEFINE_SYMBOL I2_ICINGA_BUILD
FOLDER Lib
VERSION ${SPEC_VERSION}
)
install(

View File

@ -44,6 +44,7 @@ set_target_properties (
INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
DEFINE_SYMBOL I2_LIVESTATUS_BUILD
FOLDER Components
VERSION ${SPEC_VERSION}
)
install_if_not_exists(

View File

@ -43,6 +43,7 @@ set_target_properties (
INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
DEFINE_SYMBOL I2_METHODS_BUILD
FOLDER Lib
VERSION ${SPEC_VERSION}
)
install(

View File

@ -34,6 +34,7 @@ set_target_properties (
INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
DEFINE_SYMBOL I2_NOTIFICATION_BUILD
FOLDER Components
VERSION ${SPEC_VERSION}
)
install_if_not_exists(

View File

@ -38,6 +38,7 @@ set_target_properties (
INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
DEFINE_SYMBOL I2_PERFDATA_BUILD
FOLDER Components
VERSION ${SPEC_VERSION}
)
install_if_not_exists(

View File

@ -47,6 +47,7 @@ set_target_properties (
INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR}/icinga2
DEFINE_SYMBOL I2_REMOTE_BUILD
FOLDER Lib
VERSION ${SPEC_VERSION}
)
install(

View File

@ -21,6 +21,7 @@ set_target_properties (
execvpe PROPERTIES
DEFINE_SYMBOL I2_EXECVPE_BUILD
FOLDER Lib
VERSION ${SPEC_VERSION}
)
install(

View File

@ -21,6 +21,7 @@ set_target_properties(
mmatch PROPERTIES
DEFINE_SYMBOL I2_MMATCH_BUILD
FOLDER Lib
VERSION ${SPEC_VERSION}
)
install(

View File

@ -21,6 +21,7 @@ set_target_properties (
socketpair PROPERTIES
DEFINE_SYMBOL I2_SOCKETPAIR_BUILD
FOLDER Lib
VERSION ${SPEC_VERSION}
)
if(WIN32)