From aaee7793bb9bbadd80f1b37e3d33696e45def651 Mon Sep 17 00:00:00 2001 From: Valerio Mariani <valerio.mariani@unibas.ch> Date: Wed, 27 Jul 2011 14:26:14 +0200 Subject: [PATCH] Support for library versioning Version is now defined only in the CMakeList.txt at the top level. Everything in OpenStructure picks it up from there --- CMakeLists.txt | 4 ++++ cmake_support/OST.cmake | 3 +++ modules/config/CMakeLists.txt | 5 +++++ modules/config/{version.hh => version.hh.in} | 8 ++++---- 4 files changed, 16 insertions(+), 4 deletions(-) rename modules/config/{version.hh => version.hh.in} (85%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 12e52f7c6..68594813e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,10 @@ cmake_minimum_required(VERSION 2.6.4 FATAL_ERROR) project(OpenStructure CXX C) +set (OST_VERSION_MAJOR 1) +set (OST_VERSION_MINOR 2) +set (OST_VERSION_PATCH 0) +set (OST_VERSION_STRING ${OST_VERSION_MAJOR}.${OST_VERSION_MINOR}.${OST_VERSION_PATCH} ) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake_support) include(OST) diff --git a/cmake_support/OST.cmake b/cmake_support/OST.cmake index f392eb87e..1eac2a349 100644 --- a/cmake_support/OST.cmake +++ b/cmake_support/OST.cmake @@ -187,6 +187,9 @@ macro(module) get_target_property(_DEFS ${_LIB_NAME} COMPILE_DEFINITIONS) set_target_properties(${_LIB_NAME} PROPERTIES COMPILE_DEFINITIONS OST_MODULE_${_UPPER_LIB_NAME}) + set_target_properties(${_LIB_NAME} PROPERTIES + VERSION ${OST_VERSION_STRING} + SOVERSION ${OST_VERSION_MAJOR}) set_target_properties(${_LIB_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${LIB_STAGE_PATH} ARCHIVE_OUTPUT_DIRECTORY ${LIB_STAGE_PATH} diff --git a/modules/config/CMakeLists.txt b/modules/config/CMakeLists.txt index 65c9ca6be..753a98190 100644 --- a/modules/config/CMakeLists.txt +++ b/modules/config/CMakeLists.txt @@ -1,3 +1,6 @@ +set(SUBST_DICT OST_VERSION_MAJOR=${OST_VERSION_MAJOR} OST_VERSION_MINOR=${OST_VERSION_MINOR} + OST_VERSION_PATCH=${OST_VERSION_PATCH}) + set(OST_CONFIG_HEADERS base.hh config.hh @@ -57,7 +60,9 @@ endif() set(config_hh_generator "CMake") set(CONFIG_HH_FILE "${CMAKE_CURRENT_SOURCE_DIR}/config.hh") +set(VERSION_HH_FILE "${CMAKE_CURRENT_SOURCE_DIR}/version.hh") configure_file(config.hh.in ${CONFIG_HH_FILE}) +configure_file(version.hh.in ${VERSION_HH_FILE}) add_custom_target(ost_config) stage_headers("${OST_CONFIG_HEADERS}" "ost" "ost_config" "" "ost") diff --git a/modules/config/version.hh b/modules/config/version.hh.in similarity index 85% rename from modules/config/version.hh rename to modules/config/version.hh.in index c2c019aed..94948475f 100644 --- a/modules/config/version.hh +++ b/modules/config/version.hh.in @@ -19,9 +19,9 @@ #ifndef OST_VERSION_HH_ #define OST_VERSION_HH_ -#define OST_VERSION_MAJOR 1 -#define OST_VERSION_MINOR 2 -#define OST_VERSION_PATCH 0 -#define OST_VERSION_STRING "1.2.0" +#define OST_VERSION_MAJOR @OST_VERSION_MAJOR@ +#define OST_VERSION_MINOR @OST_VERSION_MINOR@ +#define OST_VERSION_PATCH @OST_VERSION_PATCH@ +#define OST_VERSION_STRING "@OST_VERSION_STRING@" #endif /* OST_VERSION_HH_ */ -- GitLab