diff --git a/CMakeLists.txt b/CMakeLists.txt index 490262796..3076851ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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") diff --git a/icinga-spec-version.h.cmake b/icinga-spec-version.h.cmake new file mode 100644 index 000000000..60a77bf60 --- /dev/null +++ b/icinga-spec-version.h.cmake @@ -0,0 +1 @@ +#define SPEC_VERSION "${SPEC_VERSION}" diff --git a/lib/base/CMakeLists.txt b/lib/base/CMakeLists.txt index fed2c5632..3eebeabca 100644 --- a/lib/base/CMakeLists.txt +++ b/lib/base/CMakeLists.txt @@ -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\")") diff --git a/lib/base/application-version.cpp b/lib/base/application-version.cpp index ed632b844..c216ced7b 100644 --- a/lib/base/application-version.cpp +++ b/lib/base/application-version.cpp @@ -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; +} diff --git a/lib/base/application.hpp b/lib/base/application.hpp index b732378ca..a5cfcb640 100644 --- a/lib/base/application.hpp +++ b/lib/base/application.hpp @@ -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); diff --git a/lib/base/loader.cpp b/lib/base/loader.cpp index 9900bbe27..0724779c0 100644 --- a/lib/base/loader.cpp +++ b/lib/base/loader.cpp @@ -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") diff --git a/lib/checker/CMakeLists.txt b/lib/checker/CMakeLists.txt index 0ba4cf0a9..4ba6a510b 100644 --- a/lib/checker/CMakeLists.txt +++ b/lib/checker/CMakeLists.txt @@ -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( diff --git a/lib/cli/CMakeLists.txt b/lib/cli/CMakeLists.txt index 74156d5dc..271fe2f30 100644 --- a/lib/cli/CMakeLists.txt +++ b/lib/cli/CMakeLists.txt @@ -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( diff --git a/lib/compat/CMakeLists.txt b/lib/compat/CMakeLists.txt index a3a3675da..e44d2e56d 100644 --- a/lib/compat/CMakeLists.txt +++ b/lib/compat/CMakeLists.txt @@ -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( diff --git a/lib/config/CMakeLists.txt b/lib/config/CMakeLists.txt index c687ba214..3304020f2 100644 --- a/lib/config/CMakeLists.txt +++ b/lib/config/CMakeLists.txt @@ -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( diff --git a/lib/db_ido/CMakeLists.txt b/lib/db_ido/CMakeLists.txt index 25d295262..d2ac1f2e1 100644 --- a/lib/db_ido/CMakeLists.txt +++ b/lib/db_ido/CMakeLists.txt @@ -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( diff --git a/lib/db_ido_mysql/CMakeLists.txt b/lib/db_ido_mysql/CMakeLists.txt index 4f45eb7d5..418175342 100644 --- a/lib/db_ido_mysql/CMakeLists.txt +++ b/lib/db_ido_mysql/CMakeLists.txt @@ -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( diff --git a/lib/db_ido_pgsql/CMakeLists.txt b/lib/db_ido_pgsql/CMakeLists.txt index fd792b190..f029218f2 100644 --- a/lib/db_ido_pgsql/CMakeLists.txt +++ b/lib/db_ido_pgsql/CMakeLists.txt @@ -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( diff --git a/lib/demo/CMakeLists.txt b/lib/demo/CMakeLists.txt index ab8533d39..8e4356189 100644 --- a/lib/demo/CMakeLists.txt +++ b/lib/demo/CMakeLists.txt @@ -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( diff --git a/lib/hello/CMakeLists.txt b/lib/hello/CMakeLists.txt index fb40ad354..36df66f59 100644 --- a/lib/hello/CMakeLists.txt +++ b/lib/hello/CMakeLists.txt @@ -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( diff --git a/lib/icinga/CMakeLists.txt b/lib/icinga/CMakeLists.txt index 8ef9e97e3..927233458 100644 --- a/lib/icinga/CMakeLists.txt +++ b/lib/icinga/CMakeLists.txt @@ -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( diff --git a/lib/livestatus/CMakeLists.txt b/lib/livestatus/CMakeLists.txt index 40d56b928..716e8dad9 100644 --- a/lib/livestatus/CMakeLists.txt +++ b/lib/livestatus/CMakeLists.txt @@ -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( diff --git a/lib/methods/CMakeLists.txt b/lib/methods/CMakeLists.txt index e0c6d5e2d..d701d5c3d 100644 --- a/lib/methods/CMakeLists.txt +++ b/lib/methods/CMakeLists.txt @@ -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( diff --git a/lib/notification/CMakeLists.txt b/lib/notification/CMakeLists.txt index b94408317..bb5fc9c3c 100644 --- a/lib/notification/CMakeLists.txt +++ b/lib/notification/CMakeLists.txt @@ -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( diff --git a/lib/perfdata/CMakeLists.txt b/lib/perfdata/CMakeLists.txt index 91cc5fa3c..e654367d7 100644 --- a/lib/perfdata/CMakeLists.txt +++ b/lib/perfdata/CMakeLists.txt @@ -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( diff --git a/lib/remote/CMakeLists.txt b/lib/remote/CMakeLists.txt index 1d557a7a7..d74ad9ff4 100644 --- a/lib/remote/CMakeLists.txt +++ b/lib/remote/CMakeLists.txt @@ -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( diff --git a/third-party/execvpe/CMakeLists.txt b/third-party/execvpe/CMakeLists.txt index e8146c1d9..9ad12ad73 100644 --- a/third-party/execvpe/CMakeLists.txt +++ b/third-party/execvpe/CMakeLists.txt @@ -21,6 +21,7 @@ set_target_properties ( execvpe PROPERTIES DEFINE_SYMBOL I2_EXECVPE_BUILD FOLDER Lib + VERSION ${SPEC_VERSION} ) install( diff --git a/third-party/mmatch/CMakeLists.txt b/third-party/mmatch/CMakeLists.txt index d46e1180e..cb49b43c4 100644 --- a/third-party/mmatch/CMakeLists.txt +++ b/third-party/mmatch/CMakeLists.txt @@ -21,6 +21,7 @@ set_target_properties( mmatch PROPERTIES DEFINE_SYMBOL I2_MMATCH_BUILD FOLDER Lib + VERSION ${SPEC_VERSION} ) install( diff --git a/third-party/socketpair/CMakeLists.txt b/third-party/socketpair/CMakeLists.txt index 625301cb4..7eb9ebb61 100644 --- a/third-party/socketpair/CMakeLists.txt +++ b/third-party/socketpair/CMakeLists.txt @@ -21,6 +21,7 @@ set_target_properties ( socketpair PROPERTIES DEFINE_SYMBOL I2_SOCKETPAIR_BUILD FOLDER Lib + VERSION ${SPEC_VERSION} ) if(WIN32)