Change version scheme to use only two components for feature levels

Historically CMake used three version components for the feature level.
We released new features while incrementing only the third version
component.  Since commit v2.8.2~105^2~4 (New version scheme to support
branchy workflow, 2010-04-23) we used the fourth version component for
bug-fix releases and the development date:

 <major>.<minor>.<patch>[.<tweak>][-rc<n>] = Release
 <major>.<minor>.<patch>.<date>[-<id>]     = Development

This solidified use of three components for the feature level, and was
necessary to continue releasing 2.x versions because:

* Some existing projects performed floating-point comparisons of
  ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} to 2.x numbers
  so ``x`` could never be higher than 9.

* Version 2.9.<date> was used briefly in post-2.8.0 development in
  CVS prior to the transition to Git, so using it in releases may
  have caused confusion.

Now that we are moving to 3.x versions, these two restrictions go away.
Therefore we now change to use only two components for the feature
level and use the scheme:

 <major>.<minor>.<patch>[-rc<n>] = Release
 <major>.<minor>.<date>[-<id>]   = Development
This commit is contained in:
Brad King 2014-02-19 09:15:42 -05:00
parent 4bb80396e0
commit 7cbab17871
13 changed files with 45 additions and 42 deletions

View File

@ -58,13 +58,11 @@ if("${CPACK_GENERATOR}" STREQUAL "WIX")
endif()
set(CPACK_PACKAGE_VERSION
"@CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@.@CMake_VERSION_PATCH@")
"@CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@")
# WIX installers require at most a 4 component version number, where
# each component is an integer between 0 and 65534 inclusive
set(tweak "@CMake_VERSION_TWEAK@")
if(tweak MATCHES "^[0-9]+$")
if(tweak GREATER 0 AND tweak LESS 65535)
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}.${tweak}")
endif()
set(patch "@CMake_VERSION_PATCH@")
if(patch MATCHES "^[0-9]+$" AND patch LESS 65535)
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}.${patch}")
endif()
endif()

View File

@ -390,6 +390,11 @@ Deprecated and Removed Features
Other Changes
=============
* The version scheme was changed to use only two components for
the feature level instead of three. The third component will
now be used for bug-fix releases or the date of development versions.
See the :variable:`CMAKE_VERSION` variable documentation for details.
* The default install locations of CMake itself on Windows and
OS X no longer contain the CMake version number. This allows
for easy replacement without re-generating local build trees

View File

@ -1,5 +1,11 @@
CMAKE_TWEAK_VERSION
-------------------
Fourth version number component of the :variable:`CMAKE_VERSION`
variable.
Defined to ``0`` for compatibility with code written for older
CMake versions that may have defined higher values.
.. note::
In CMake versions 2.8.2 through 2.8.12, this variable holds
the fourth version number component of the
:variable:`CMAKE_VERSION` variable.

View File

@ -1,24 +1,23 @@
CMAKE_VERSION
-------------
The CMake version string as up to four non-negative integer components
The CMake version string as three non-negative integer components
separated by ``.`` and possibly followed by ``-`` and other information.
The first three components represent the feature level and the fourth
The first two components represent the feature level and the third
component represents either a bug-fix level or development date.
Release versions and release candidate versions of CMake use the format::
<major>.<minor>.<patch>[.<tweak>][-rc<n>]
<major>.<minor>.<patch>[-rc<n>]
where the ``<tweak>`` component is less than ``20000000``. Development
where the ``<patch>`` component is less than ``20000000``. Development
versions of CMake use the format::
<major>.<minor>.<patch>.<date>[-<id>]
<major>.<minor>.<date>[-<id>]
where the ``<date>`` component is of format ``CCYYMMDD`` and ``<id>``
may contain arbitrary text. This represents development as of a
particular date following the ``<major>.<minor>.<patch>`` feature
release.
particular date following the ``<major>.<minor>`` feature release.
Individual component values are also available in variables:
@ -35,6 +34,12 @@ strings as floating-point numbers.
.. note::
CMake versions 2.8.2 through 2.8.12 used three components for the
feature level. Release versions represented the bug-fix level in a
fourth component, i.e. ``<major>.<minor>.<patch>[.<tweak>][-rc<n>]``.
Development versions represented the development date in the fourth
component, i.e. ``<major>.<minor>.<patch>.<date>[-<id>]``.
CMake versions prior to 2.8.2 used three components for the
feature level and had no bug-fix component. Release versions
used an even-valued second component, i.e.

View File

@ -1,15 +1,15 @@
# Keep formatting here consistent with bootstrap script expectations.
if(BEOS)
set(CMAKE_DATA_DIR_DEFAULT "share/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}") # HAIKU
set(CMAKE_DATA_DIR_DEFAULT "share/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") # HAIKU
set(CMAKE_MAN_DIR_DEFAULT "documentation/man") # HAIKU
set(CMAKE_DOC_DIR_DEFAULT "documentation/doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}") # HAIKU
set(CMAKE_DOC_DIR_DEFAULT "documentation/doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") # HAIKU
elseif(CYGWIN)
set(CMAKE_DATA_DIR_DEFAULT "share/cmake-${CMake_VERSION}") # CYGWIN
set(CMAKE_DOC_DIR_DEFAULT "share/doc/cmake-${CMake_VERSION}") # CYGWIN
set(CMAKE_MAN_DIR_DEFAULT "share/man") # CYGWIN
else()
set(CMAKE_DATA_DIR_DEFAULT "share/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}") # OTHER
set(CMAKE_DOC_DIR_DEFAULT "doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}") # OTHER
set(CMAKE_DATA_DIR_DEFAULT "share/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") # OTHER
set(CMAKE_DOC_DIR_DEFAULT "doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") # OTHER
set(CMAKE_MAN_DIR_DEFAULT "man") # OTHER
endif()

View File

@ -3,5 +3,5 @@
if test "x$1" = "x-f"; then shift ; n='*' ; else n='\{8\}' ; fi
if test "$#" -gt 0; then echo 1>&2 "usage: CMakeVersion.bash [-f]"; exit 1; fi
sed -i -e '
s/\(^set(CMake_VERSION_TWEAK\) [0-9]'"$n"'\(.*\)/\1 '"$(date +%Y%m%d)"'\2/
s/\(^set(CMake_VERSION_PATCH\) [0-9]'"$n"'\(.*\)/\1 '"$(date +%Y%m%d)"'\2/
' "${BASH_SOURCE%/*}/CMakeVersion.cmake"

View File

@ -2,5 +2,4 @@
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 0)
set(CMake_VERSION_PATCH 0)
set(CMake_VERSION_TWEAK 0)
set(CMake_VERSION_RC 1)

View File

@ -1,8 +1,8 @@
# Load version number components.
include(${CMake_SOURCE_DIR}/Source/CMakeVersion.cmake)
# Releases define a small tweak level.
if("${CMake_VERSION_TWEAK}" VERSION_LESS 20000000)
# Releases define a small patch level.
if("${CMake_VERSION_PATCH}" VERSION_LESS 20000000)
set(CMake_VERSION_IS_RELEASE 1)
set(CMake_VERSION_SOURCE "")
else()
@ -12,9 +12,6 @@ endif()
# Compute the full version string.
set(CMake_VERSION ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH})
if(${CMake_VERSION_TWEAK} GREATER 0)
set(CMake_VERSION ${CMake_VERSION}.${CMake_VERSION_TWEAK})
endif()
if(CMake_VERSION_RC)
set(CMake_VERSION ${CMake_VERSION}-rc${CMake_VERSION_RC})
endif()

View File

@ -21,14 +21,13 @@
#define STRINGIFY_HELPER(X) #X
#define STRINGIFY(X) STRINGIFY_HELPER(X)
#define DEVEL_CMAKE_VERSION(maj, min, patch) \
(CMake_VERSION_ENCODE(maj, min, patch) > \
CMake_VERSION_ENCODE(CMake_VERSION_MAJOR, CMake_VERSION_MINOR, \
CMake_VERSION_PATCH) \
) ? \
#define DEVEL_CMAKE_VERSION(major, minor) ( \
CMake_VERSION_ENCODE(major, minor, 0) > \
CMake_VERSION_ENCODE(CMake_VERSION_MAJOR, CMake_VERSION_MINOR, 0) ? \
STRINGIFY(CMake_VERSION_MAJOR) "." STRINGIFY(CMake_VERSION_MINOR) "." \
STRINGIFY(CMake_VERSION_PATCH) "." STRINGIFY(CMake_VERSION_TWEAK) \
: #maj "." #min "." #patch
STRINGIFY(CMake_VERSION_PATCH) \
: #major "." #minor ".0" \
)
class cmTargetExport;

View File

@ -16,7 +16,7 @@
unsigned int cmVersion::GetMajorVersion() { return CMake_VERSION_MAJOR; }
unsigned int cmVersion::GetMinorVersion() { return CMake_VERSION_MINOR; }
unsigned int cmVersion::GetPatchVersion() { return CMake_VERSION_PATCH; }
unsigned int cmVersion::GetTweakVersion() { return CMake_VERSION_TWEAK; }
unsigned int cmVersion::GetTweakVersion() { return 0; }
const char* cmVersion::GetCMakeVersion()
{

View File

@ -12,5 +12,4 @@
#define CMake_VERSION_MAJOR @CMake_VERSION_MAJOR@
#define CMake_VERSION_MINOR @CMake_VERSION_MINOR@
#define CMake_VERSION_PATCH @CMake_VERSION_PATCH@
#define CMake_VERSION_TWEAK @CMake_VERSION_TWEAK@
#define CMake_VERSION "@CMake_VERSION@"

View File

@ -14,8 +14,8 @@
#include "cmVersionConfig.h"
#define CMake_VERSION_TWEAK_IS_RELEASE(tweak) ((tweak) < 20000000)
#if CMake_VERSION_TWEAK_IS_RELEASE(CMake_VERSION_TWEAK)
#define CMake_VERSION_PATCH_IS_RELEASE(patch) ((patch) < 20000000)
#if CMake_VERSION_PATCH_IS_RELEASE(CMake_VERSION_PATCH)
# define CMake_VERSION_IS_RELEASE 1
#endif

View File

@ -53,10 +53,6 @@ cmake_version_major="`cmake_version_component MAJOR`"
cmake_version_minor="`cmake_version_component MINOR`"
cmake_version_patch="`cmake_version_component PATCH`"
cmake_version="${cmake_version_major}.${cmake_version_minor}.${cmake_version_patch}"
cmake_version_tweak="`cmake_version_component TWEAK`"
if [ "$cmake_version_tweak" != "0" ]; then
cmake_version="${cmake_version}.${cmake_version_tweak}"
fi
cmake_version_rc="`cmake_version_component RC`"
if [ "$cmake_version_rc" != "" ]; then
cmake_version="${cmake_version}-rc${cmake_version_rc}"
@ -1464,7 +1460,6 @@ fi
cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MAJOR ${cmake_version_major}"
cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MINOR ${cmake_version_minor}"
cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_PATCH ${cmake_version_patch}"
cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_TWEAK ${cmake_version_tweak}"
cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION \"${cmake_version}\""
cmake_report cmConfigure.h${_tmp} "#define CMAKE_ROOT_DIR \"${cmake_root_dir}\""
cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"/bootstrap-not-insalled\""