diff --git a/CMakeLists.txt b/CMakeLists.txt index ab30845e5..246c828cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,23 +40,13 @@ # TODO:3.3: Require CMake 3.12 cmake_minimum_required( VERSION 3.3 FATAL_ERROR ) - -set( CALAMARES_VERSION 3.2.40 ) -set( CALAMARES_RELEASE_MODE OFF ) - -if ( CMAKE_SCRIPT_MODE_FILE ) - include( ${CMAKE_CURRENT_LIST_DIR}/CMakeModules/ExtendedVersion.cmake ) - set( CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR} ) - extend_version( ${CALAMARES_VERSION} OFF _vshort _vlong ) - message( "${_vlong}" ) - return() -endif() - project( CALAMARES - VERSION ${CALAMARES_VERSION} + VERSION 3.2.40 LANGUAGES C CXX ) +set( CALAMARES_VERSION_RC 1 ) # Set to 0 during release cycle, 1 during development + ### OPTIONS # option( INSTALL_CONFIG "Install configuration files" OFF ) @@ -190,7 +180,6 @@ include( FeatureSummary ) # Calamares Modules include( CMakeColors ) -include( ExtendedVersion ) ### C++ SETUP # @@ -505,21 +494,30 @@ add_feature_info( ExampleDistro ${mksquashfs_FOUND} "Create example-distro targe ### CALAMARES PROPER # -# -extend_version( "${CALAMARES_VERSION}" ${CALAMARES_RELEASE_MODE} CALAMARES_VERSION_SHORT CALAMARES_VERSION ) +set( CALAMARES_VERSION ${CALAMARES_VERSION_MAJOR}.${CALAMARES_VERSION_MINOR}.${CALAMARES_VERSION_PATCH} ) +# In rare cases we have hotfix-releases with a tweak +if( CALAMARES_VERSION_TWEAK ) + set( CALAMARES_VERSION "${CALAMARES_VERSION}.${CALAMARES_VERSION_TWEAK}" ) +endif() +set( CALAMARES_VERSION_SHORT "${CALAMARES_VERSION}" ) -# Special target for displaying the version. In RC (might-be-release) -# builds, use the short version (3.x.y), otherwise show the long version. -if ( CALAMARES_RELEASE_MODE ) +# Additional info for non-release builds. The "extended" version information +# with date and git information (commit, dirty status) is used only +# by CalamaresVersionX.h, which is included by consumers that need a full +# version number with all that information; normal consumers can include +# CalamaresVersion.h with more stable numbers. +if( NOT BUILD_RELEASE AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git/" ) + include( ExtendedVersion ) + extend_version( "${CALAMARES_VERSION}" OFF CALAMARES_VERSION_SHORT CALAMARES_VERSION ) +endif() + +# Special target for not-RC (e.g. might-be-release) builds. +# This is used by the release script to get the version. +if ( CALAMARES_VERSION_RC EQUAL 0 ) add_custom_target(show-version ${CMAKE_COMMAND} -E echo CALAMARES_VERSION=${CALAMARES_VERSION_SHORT} USES_TERMINAL ) -else() - add_custom_target(show-version - ${CMAKE_COMMAND} -E echo CALAMARES_VERSION=${CALAMARES_VERSION} - USES_TERMINAL - ) endif() # enforce using constBegin, constEnd for const-iterators