From 989ae9700076070ed66756fa3b0406b6f29d4062 Mon Sep 17 00:00:00 2001 From: Elena Ceseracciu Date: Wed, 19 Jun 2013 10:25:35 +0200 Subject: [PATCH 1/2] Using cmake macros to create the Version.cmake file (cherry picked from commit aa52a96f5d506b2b85d16f6b30d45ad6215bd5f9) Conflicts: conf/YarpDescribe.cmake --- conf/YarpDescribe.cmake | 11 ++++- conf/template/YARPConfigVersion.cmake.in | 62 ------------------------ 2 files changed, 9 insertions(+), 64 deletions(-) delete mode 100644 conf/template/YARPConfigVersion.cmake.in diff --git a/conf/YarpDescribe.cmake b/conf/YarpDescribe.cmake index 48c0bc71552..2ec9e15da2e 100644 --- a/conf/YarpDescribe.cmake +++ b/conf/YarpDescribe.cmake @@ -29,8 +29,15 @@ set(YARP_DEPENDENCY_FILENAME YARPDependencies.cmake) set(YARP_BINDINGS ${CMAKE_SOURCE_DIR}/bindings) configure_file(${YARP_MODULE_DIR}/template/YARPConfig.cmake.in ${CMAKE_BINARY_DIR}/YARPConfig.cmake @ONLY IMMEDIATE) -configure_file(${YARP_MODULE_DIR}/template/YARPConfigVersion.cmake.in - ${CMAKE_BINARY_DIR}/YARPConfigVersion.cmake @ONLY IMMEDIATE) +if (${CMAKE_VERSION} VERSION_LESS 2.8.8) # -> version is 2.8.7 (oldest supported) + include(WriteBasicConfigVersionFile ) + write_basic_config_version_file(${CMAKE_BINARY_DIR}/YARPConfigVersion.cmake + VERSION ${YARP_GENERIC_VERSION} + COMPATIBILITY AnyNewerVersion ) +else() + include(CMakePackageConfigHelpers) + WRITE_BASIC_PACKAGE_VERSION_FILE(${CMAKE_BINARY_DIR}/YARPConfigVersion.cmake VERSION ${YARP_GENERIC_VERSION} COMPATIBILITY AnyNewerVersion ) +endif() export(TARGETS ${YARP_LIBRARIES} FILE ${YARP_DEPENDENCY_FILE}) set(VERSIONED_LIB lib${LIB_SUFFIX}/YARP-${YARP_GENERIC_VERSION}) diff --git a/conf/template/YARPConfigVersion.cmake.in b/conf/template/YARPConfigVersion.cmake.in deleted file mode 100644 index 08adb08d333..00000000000 --- a/conf/template/YARPConfigVersion.cmake.in +++ /dev/null @@ -1,62 +0,0 @@ -# Check if a requested version of YARP is compatible with this version. -# As specified in: -# http://www.cmake.org/cmake/help/cmake2.6docs.html#command:find_package - -SET(_YARP_VERSION_MAJOR "@YARP_VERSION_MAJOR@") -SET(_YARP_VERSION_MINOR "@YARP_VERSION_MINOR@") -SET(_YARP_VERSION_PATCH "@YARP_VERSION_PATCH@") -SET(_YARP_VERSION_MODIFIER "@YARP_VERSION_MODIFIER@") -SET(_YARP_VERSION_TWEAK "@YARP_VERSION_TWEAK@") -SET(_YARP_VERSION_ABI "@YARP_VERSION_ABI@") -SET(_YARP_VERSION_API "${_YARP_VERSION_MAJOR}.${_YARP_VERSION_MINOR}") - -if(NOT _YARP_VERSION_TWEAK) - set(PACKAGE_VERSION "${_YARP_VERSION_MAJOR}.${_YARP_VERSION_MINOR}.${_YARP_VERSION_PATCH}${_YARP_VERSION_MODIFIER}") -else(NOT _YARP_VERSION_TWEAK) - set(PACKAGE_VERSION "${_YARP_VERSION_MAJOR}.${_YARP_VERSION_MINOR}.${_YARP_VERSION_PATCH}.${_YARP_VERSION_TWEAK}${_YARP_VERSION_MODIFIER}") -endif(NOT _YARP_VERSION_TWEAK) - -IF (PACKAGE_FIND_VERSION_COUNT EQUAL 0) - SET (PACKAGE_VERSION_COMPATIBLE TRUE) - SET (PACKAGE_VERSION_EXACT TRUE) -ENDIF () - -IF (PACKAGE_FIND_VERSION_COUNT EQUAL 1) - IF (PACKAGE_FIND_VERSION_MAJOR EQUAL _YARP_VERSION_MAJOR) - SET (PACKAGE_VERSION_COMPATIBLE TRUE) - SET (PACKAGE_VERSION_EXACT TRUE) - ENDIF () -ENDIF () - -IF (PACKAGE_FIND_VERSION_COUNT EQUAL 2) - IF (PACKAGE_FIND_VERSION_MAJOR EQUAL _YARP_VERSION_MAJOR) - IF (PACKAGE_FIND_VERSION_MINOR EQUAL _YARP_VERSION_MINOR) - SET (PACKAGE_VERSION_COMPATIBLE TRUE) - SET (PACKAGE_VERSION_EXACT TRUE) - ENDIF () - ENDIF () -ENDIF () - -IF (PACKAGE_FIND_VERSION_COUNT GREATER 2) - IF (PACKAGE_FIND_VERSION_MAJOR EQUAL _YARP_VERSION_MAJOR) - IF (PACKAGE_FIND_VERSION_MINOR EQUAL _YARP_VERSION_MINOR) - IF (PACKAGE_VERSION VERSION_EQUAL PACKAGE_FIND_VERSION) - SET (PACKAGE_VERSION_EXACT TRUE) - SET (PACKAGE_VERSION_COMPATIBLE TRUE) - ENDIF () - IF (PACKAGE_FIND_VERSION_PATCH LESS _YARP_VERSION_PATCH) - SET (PACKAGE_VERSION_COMPATIBLE TRUE) - ENDIF () - ENDIF () - ENDIF () -ENDIF () - -IF (NOT PACKAGE_VERSION_EXACT) - SET (PACKAGE_VERSION_EXACT FALSE) -ENDIF () - -IF (NOT PACKAGE_VERSION_COMPATIBLE) - SET (PACKAGE_VERSION_COMPATIBLE FALSE) -ENDIF () - -SET (PACKAGE_VERSION_UNSUITABLE FALSE) From ef94dbafe961567201db509d87fe57a71d5afb02 Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Sat, 6 Jul 2013 00:51:16 +0200 Subject: [PATCH 2/2] Cleanup version stuff * Rename YARP_GENERIC_VERSION to YARP_VERSION and define it only once * Add YARP_VERSION_STRING * Remove YARP_VERSION_MODIFIER * Better handling of YARP_VERSION_TWEAK --- conf/YarpDescribe.cmake | 8 +++--- conf/YarpPackage.cmake | 6 +++++ conf/YarpVersion.cmake | 35 ++++++++++++-------------- conf/template/YARPConfig.cmake.in | 11 +++----- conf/template/yarp_config_version.h.in | 26 +++---------------- scripts/admin/make-source-package-svn | 2 +- src/doc/yarp_build_structure.dox | 7 ++++-- 7 files changed, 38 insertions(+), 57 deletions(-) diff --git a/conf/YarpDescribe.cmake b/conf/YarpDescribe.cmake index 2ec9e15da2e..64d783fc256 100644 --- a/conf/YarpDescribe.cmake +++ b/conf/YarpDescribe.cmake @@ -32,15 +32,15 @@ configure_file(${YARP_MODULE_DIR}/template/YARPConfig.cmake.in if (${CMAKE_VERSION} VERSION_LESS 2.8.8) # -> version is 2.8.7 (oldest supported) include(WriteBasicConfigVersionFile ) write_basic_config_version_file(${CMAKE_BINARY_DIR}/YARPConfigVersion.cmake - VERSION ${YARP_GENERIC_VERSION} + VERSION ${YARP_VERSION} COMPATIBILITY AnyNewerVersion ) else() include(CMakePackageConfigHelpers) - WRITE_BASIC_PACKAGE_VERSION_FILE(${CMAKE_BINARY_DIR}/YARPConfigVersion.cmake VERSION ${YARP_GENERIC_VERSION} COMPATIBILITY AnyNewerVersion ) + WRITE_BASIC_PACKAGE_VERSION_FILE(${CMAKE_BINARY_DIR}/YARPConfigVersion.cmake VERSION ${YARP_VERSION} COMPATIBILITY AnyNewerVersion ) endif() export(TARGETS ${YARP_LIBRARIES} FILE ${YARP_DEPENDENCY_FILE}) -set(VERSIONED_LIB lib${LIB_SUFFIX}/YARP-${YARP_GENERIC_VERSION}) +set(VERSIONED_LIB lib${LIB_SUFFIX}/YARP-${YARP_VERSION}) # Set up a configuration file for installed use of YARP set(YARP_DEPENDENCY_FILE ${CMAKE_INSTALL_PREFIX}/${VERSIONED_LIB}/YARP.cmake) @@ -56,6 +56,6 @@ install(FILES ${CMAKE_BINARY_DIR}/YARPConfigVersion.cmake COMPONENT configuratio install(EXPORT YARP COMPONENT configuration DESTINATION ${VERSIONED_LIB}) foreach(lib ${YARP_LIBRARIES}) - set_target_properties(${lib} PROPERTIES VERSION ${YARP_GENERIC_VERSION} + set_target_properties(${lib} PROPERTIES VERSION ${YARP_VERSION} SOVERSION ${YARP_GENERIC_SOVERSION}) endforeach(lib) diff --git a/conf/YarpPackage.cmake b/conf/YarpPackage.cmake index 1114842f780..9a0b0c25296 100644 --- a/conf/YarpPackage.cmake +++ b/conf/YarpPackage.cmake @@ -16,6 +16,12 @@ set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING") set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") +set(CPACK_PACKAGE_VERSION_MAJOR "${YARP_VERSION_MAJOR}") +set(CPACK_PACKAGE_VERSION_MINOR "${YARP_VERSION_MINOR}") +set(CPACK_PACKAGE_VERSION_PATCH "${YARP_VERSION_PATCH}") +#set(CPACK_PACKAGE_VERSION_TWEAK "${YARP_VERSION_TWEAK}") +set(CPACK_PACKAGE_VERSION "${YARP_VERSION}") + #if you are making debian packages, this is useful, but not otherwise #configure_file(${YARP_MODULE_DIR}/template/control.in diff --git a/conf/YarpVersion.cmake b/conf/YarpVersion.cmake index 5341e155cb9..f6c7e7a522b 100644 --- a/conf/YarpVersion.cmake +++ b/conf/YarpVersion.cmake @@ -4,31 +4,28 @@ # This file is the official location of the current YARP version number. -## We use subversion to indentify current revision number (optional) -# the FindSubversion.cmake module is part of the standard distribution - -# 29/8/12: Lorenzo Natale: Commenting out use of svn since it did not work with -# default installation of tortoise on Windows. Moving from YARP_SVN_REVISION to YARO_VERSION_TWEAK -# with similar usage. - +## manually increase tweak number when required. Set to zero when +# bumping VERSION_PATCH set(YARP_VERSION_MAJOR "2") set(YARP_VERSION_MINOR "3") set(YARP_VERSION_PATCH "20") -set(YARP_VERSION_MODIFIER "") +set(YARP_VERSION_TWEAK "") +set(YARP_VERSION_STRING "") -## manually increase tweak number when required. Set to zero when -# bumping VERSION_PATCH -set(YARP_VERSION_TWEAK "6") set(YARP_VERSION_ABI "1") -set(CPACK_PACKAGE_VERSION_MAJOR "${YARP_VERSION_MAJOR}") -set(CPACK_PACKAGE_VERSION_MINOR "${YARP_VERSION_MINOR}") -if(NOT YARP_VERSION_TWEAK) - set(CPACK_PACKAGE_VERSION_PATCH "${YARP_VERSION_PATCH}${YARP_VERSION_MODIFIER}") -else(NOT YARP_VERSION_TWEAK) - set(CPACK_PACKAGE_VERSION_PATCH "${YARP_VERSION_PATCH}.${YARP_VERSION_TWEAK}${YARP_VERSION_MODIFIER}") -endif(NOT YARP_VERSION_TWEAK) +# Generate YARP_VERSION +if(YARP_VERSION_TWEAK) + set(YARP_VERSION "${YARP_VERSION_MAJOR}.${YARP_VERSION_MINOR}.${YARP_VERSION_PATCH}.${YARP_VERSION_TWEAK}") +else() + set(YARP_VERSION "${YARP_VERSION_MAJOR}.${YARP_VERSION_MINOR}.${YARP_VERSION_PATCH}") +endif() + +# Generate YARP_VERSION_STRING if not set +set(YARP_VERSION_STRING "${YARP_VERSION}") +if(NOT YARP_VERSION_STRING) + set(YARP_VERSION_STRING "${YARP_VERSION}") +endif() -set(YARP_GENERIC_VERSION "${YARP_VERSION_MAJOR}.${YARP_VERSION_MINOR}.${YARP_VERSION_PATCH}") set(YARP_GENERIC_SOVERSION "${YARP_VERSION_ABI}") diff --git a/conf/template/YARPConfig.cmake.in b/conf/template/YARPConfig.cmake.in index 745eba4e547..32f938dfca9 100644 --- a/conf/template/YARPConfig.cmake.in +++ b/conf/template/YARPConfig.cmake.in @@ -20,15 +20,10 @@ if(NOT YARP_FOUND) set(YARP_VERSION_MAJOR "@YARP_VERSION_MAJOR@") set(YARP_VERSION_MINOR "@YARP_VERSION_MINOR@") set(YARP_VERSION_PATCH "@YARP_VERSION_PATCH@") - set(YARP_VERSION_MODIFIER "@YARP_VERSION_MODIFIER@") - set(YARP_VERSION_ABI "@YARP_VERSION_ABI@") set(YARP_VERSION_TWEAK "@YARP_VERSION_TWEAK@") - - if(NOT YARP_VERSION_TWEAK) - set(YARP_VERSION "${YARP_VERSION_MAJOR}.${YARP_VERSION_MINOR}.${YARP_VERSION_PATCH}${YARP_VERSION_MODIFIER}") - else(NOT YARP_VERSION_TWEAK) - set(PACKAGE_VERSION "${YARP_VERSION_MAJOR}.${YARP_VERSION_MINOR}.${YARP_VERSION_PATCH}.${YARP_VERSION_TWEAK}${YARP_VERSION_MODIFIER}") - endif(NOT YARP_VERSION_TWEAK) + set(YARP_VERSION "@YARP_VERSION@") + set(YARP_VERSION_STRING "@YARP_VERSION_STRING@") + set(YARP_VERSION_ABI "@YARP_VERSION_ABI@") # Pull in any dependencies that YARP libraries may have. get_filename_component(YARP_CMAKE ${CMAKE_CURRENT_LIST_FILE} PATH) diff --git a/conf/template/yarp_config_version.h.in b/conf/template/yarp_config_version.h.in index a969597aecb..319dbc8c785 100644 --- a/conf/template/yarp_config_version.h.in +++ b/conf/template/yarp_config_version.h.in @@ -6,35 +6,15 @@ * CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT */ + #ifndef YARP_CONFIG_VERSION_H #define YARP_CONFIG_VERSION_H -#ifdef YARP_VERSION_MAJOR -#undef YARP_VERSION_MAJOR -#endif -#ifdef YARP_VERSION_MINOR -#undef YARP_VERSION_MINOR -#endif -#ifdef YARP_VERSION_PATCH -#undef YARP_VERSION_PATCH -#endif -#ifdef YARP_VERSION_TWEAK -#undef YARP_VERSION_TWEAK -#endif -#ifdef YARP_VERSION -#undef YARP_VERSION -#endif - #define YARP_VERSION_MAJOR ${YARP_VERSION_MAJOR} #define YARP_VERSION_MINOR ${YARP_VERSION_MINOR} #define YARP_VERSION_PATCH ${YARP_VERSION_PATCH} #define YARP_VERSION_TWEAK ${YARP_VERSION_TWEAK} -#define YARP_VERSION_MODIFIER "${YARP_VERSION_MODIFIER}" - -#if ( YARP_VERSION_TWEAK > 0 ) -#define YARP_VERSION "${YARP_VERSION_MAJOR}.${YARP_VERSION_MINOR}.${YARP_VERSION_PATCH}.${YARP_VERSION_TWEAK}${YARP_VERSION_MODIFIER}" -#else -#define YARP_VERSION "${YARP_VERSION_MAJOR}.${YARP_VERSION_MINOR}.${YARP_VERSION_PATCH}${YARP_VERSION_MODIFIER}" -#endif +#define YARP_VERSION "${YARP_VERSION}" +#define YARP_VERSION_STRING "${YARP_VERSION_STRING}" #endif diff --git a/scripts/admin/make-source-package-svn b/scripts/admin/make-source-package-svn index 3cd67bfe5ea..00df0357eb3 100755 --- a/scripts/admin/make-source-package-svn +++ b/scripts/admin/make-source-package-svn @@ -46,7 +46,7 @@ if [ "k$1" = "k" ] ; then PROJECT(test) SET(CMAKE_MODULE_PATH \${PROJECT_SOURCE_DIR}) INCLUDE(YarpVersion) - MESSAGE(STATUS "Version is \${YARP_VERSION_MAJOR}.\${YARP_VERSION_MINOR}.\${YARP_VERSION_PATCH}\${YARP_VERSION_MODIFIER}") + MESSAGE(STATUS "Version is \${YARP_VERSION}") EOF ) > CMakeLists.txt YARP_VERSION=`cmake . | grep "Version is " | sed "s/.*Version is //"` diff --git a/src/doc/yarp_build_structure.dox b/src/doc/yarp_build_structure.dox index e5d9cf59b55..186935aa038 100644 --- a/src/doc/yarp_build_structure.dox +++ b/src/doc/yarp_build_structure.dox @@ -184,8 +184,11 @@ YARP versioning is as follows: \li YARP_VERSION_MAJOR - has only changed once or twice, ever. \li YARP_VERSION_MINOR - changes perhaps once every year or two. \li YARP_VERSION_PATCH - changes with every release. -\li YARP_VERSION_TWEAK - rarely used, changes with very small fixes. -\li YARP_VERSION_MODIFIER - rarely used, other than to signal unofficial release candidates. +\li YARP_VERSION_TWEAK - Used for bugfix releases, and in development branches + to pinpoint new features. +\li YARP_VERSION - The full version number (generated) +\li YARP_VERSION_STRING - A readable version (i.e. 2.4.0 beta1) (= YARP_VERSION + if not set explicitly)) @section yarp_build_structure_system_check conf/YarpSystemCheck.cmake