Skip to content

Commit

Permalink
Set versions for all internal libraries
Browse files Browse the repository at this point in the history
fixes #12552
  • Loading branch information
gunnarbeutner committed Aug 25, 2016
1 parent 092f2ee commit 0c82fe8
Show file tree
Hide file tree
Showing 24 changed files with 37 additions and 12 deletions.
20 changes: 10 additions & 10 deletions CMakeLists.txt
Expand Up @@ -70,22 +70,22 @@ 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)

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")
string(SUBSTRING ${SPEC_REVISION} 17 ${SPEC_REVISION_LENGTH} SPEC_REVISION)

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")
string(SUBSTRING ${SPEC_REVISION} 17 ${SPEC_REVISION_LENGTH} SPEC_REVISION)

set(GIT_VERSION "r${SPEC_VERSION}-${SPEC_REVISION}")
endif()
configure_file(icinga-version.h.cmake icinga-version.h)
Expand Down
1 change: 1 addition & 0 deletions icinga-version.h.cmake
@@ -1 +1,2 @@
#define VERSION "${GIT_VERSION}"
#define SPEC_VERSION "${SPEC_VERSION}"
1 change: 1 addition & 0 deletions lib/base/CMakeLists.txt
Expand Up @@ -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\")")
Expand Down
4 changes: 4 additions & 0 deletions lib/base/application-version.cpp
Expand Up @@ -27,3 +27,7 @@ String Application::GetAppVersion(void)
return VERSION;
}

String Application::GetAppSpecVersion(void)
{
return SPEC_VERSION;
}
1 change: 1 addition & 0 deletions lib/base/application.hpp
Expand Up @@ -132,6 +132,7 @@ class I2_BASE_API Application : public ObjectImpl<Application> {
static ThreadPool& GetTP(void);

static String GetAppVersion(void);
static String GetAppSpecVersion(void);

static double GetStartTime(void);
static void SetStartTime(double ts);
Expand Down
4 changes: 2 additions & 2 deletions lib/base/loader.cpp
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions lib/checker/CMakeLists.txt
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions lib/cli/CMakeLists.txt
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions lib/compat/CMakeLists.txt
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions lib/config/CMakeLists.txt
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions lib/db_ido/CMakeLists.txt
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions lib/db_ido_mysql/CMakeLists.txt
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions lib/db_ido_pgsql/CMakeLists.txt
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions lib/demo/CMakeLists.txt
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions lib/hello/CMakeLists.txt
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions lib/icinga/CMakeLists.txt
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions lib/livestatus/CMakeLists.txt
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions lib/methods/CMakeLists.txt
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions lib/notification/CMakeLists.txt
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions lib/perfdata/CMakeLists.txt
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions lib/remote/CMakeLists.txt
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions third-party/execvpe/CMakeLists.txt
Expand Up @@ -21,6 +21,7 @@ set_target_properties (
execvpe PROPERTIES
DEFINE_SYMBOL I2_EXECVPE_BUILD
FOLDER Lib
VERSION ${SPEC_VERSION}
)

install(
Expand Down
1 change: 1 addition & 0 deletions third-party/mmatch/CMakeLists.txt
Expand Up @@ -21,6 +21,7 @@ set_target_properties(
mmatch PROPERTIES
DEFINE_SYMBOL I2_MMATCH_BUILD
FOLDER Lib
VERSION ${SPEC_VERSION}
)

install(
Expand Down
1 change: 1 addition & 0 deletions third-party/socketpair/CMakeLists.txt
Expand Up @@ -21,6 +21,7 @@ set_target_properties (
socketpair PROPERTIES
DEFINE_SYMBOL I2_SOCKETPAIR_BUILD
FOLDER Lib
VERSION ${SPEC_VERSION}
)

if(WIN32)
Expand Down

0 comments on commit 0c82fe8

Please sign in to comment.