Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 16bfa9568c | |||
| e442dea08d | |||
| 2494a2b6c8 | |||
| e240967c27 |
+3
-3
@@ -20,8 +20,8 @@
|
|||||||
project = 'version'
|
project = 'version'
|
||||||
copyright = "2022, Michael Fabian Dirks"
|
copyright = "2022, Michael Fabian Dirks"
|
||||||
author = "Michael Fabian 'Xaymar' Dirks"
|
author = "Michael Fabian 'Xaymar' Dirks"
|
||||||
version = "1.2.2"
|
version = "1.4.0"
|
||||||
release = "1.2.2"
|
release = "1.4.0"
|
||||||
|
|
||||||
|
|
||||||
# -- General configuration ---------------------------------------------------
|
# -- General configuration ---------------------------------------------------
|
||||||
@@ -53,4 +53,4 @@ html_theme = 'sphinx_rtd_theme'
|
|||||||
# Add any paths that contain custom static files (such as style sheets) here,
|
# Add any paths that contain custom static files (such as style sheets) here,
|
||||||
# relative to this directory. They are copied after the builtin static files,
|
# relative to this directory. They are copied after the builtin static files,
|
||||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||||
html_static_path = []
|
html_static_path = []
|
||||||
|
|||||||
+11
-11
@@ -8,9 +8,9 @@ Synopsis
|
|||||||
|
|
||||||
.. parsed-literal::
|
.. parsed-literal::
|
||||||
|
|
||||||
version(`PARSE`_ <out-var> <string>)
|
version(`PARSE`_ <out-var> [REQUIRE [PATCH|TWEAK][;...]] <string>)
|
||||||
version(`GENERATE`_ <out-var> [COMPRESS] [MAJOR <major>] [MINOR <minor>] [PATCH <patch>] [TWEAK <tweak>] [PRERELEASE <prerelease>] [BUILD <build>])
|
version(`GENERATE`_ <out-var> [COMPRESS] [MAJOR <major>] [MINOR <minor>] [PATCH <patch>] [TWEAK <tweak>] [PRERELEASE <prerelease>] [BUILD <build>] [REQUIRE [PATCH|TWEAK][;...]])
|
||||||
version(`MODIFY`_ <out-var> <string> [COMPRESS] [MAJOR <major>] [MINOR <minor] [PATCH <patch>] [TWEAK <tweak>] [PRERELEASE <prerelease>] [BUILD <build>])
|
version(`MODIFY`_ <out-var> <string> [COMPRESS] [MAJOR <major>] [MINOR <minor] [PATCH <patch>] [TWEAK <tweak>] [PRERELEASE <prerelease>] [BUILD <build>] [REQUIRE [PATCH|TWEAK][;...]])
|
||||||
version(`COMPARE`_ <out-var> <a> <b>)
|
version(`COMPARE`_ <out-var> <a> <b>)
|
||||||
|
|
||||||
|
|
||||||
@@ -27,9 +27,9 @@ Parsing
|
|||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
version(PARSE <out-var> <string>)
|
version(PARSE <out-var> [REQUIRE [PATCH|TWEAK][;...]] <string>)
|
||||||
|
|
||||||
Attempts to parse the version in ``<string>`` and stores the individual compoents into ``<out-var>_<component>``. If a component is not present in the given version, it will be set to a false constant. If an error occurred, ``<out-var>_ERROR`` will contain the error message otherwise it will be a false constant. The ``PRERELEASE`` and ``BUILD`` components support the dot-separation specifier and will be turned into a list if they are encountered.
|
Attempts to parse the version in ``<string>`` and stores the individual compoents into ``<out-var>_<component>``. If a component is not present in the given version, it will be set to a false constant. If an error occurred, ``<out-var>_ERROR`` will contain the error message otherwise it will be a false constant. The ``PRERELEASE`` and ``BUILD`` components support the dot-separation specifier and will be turned into a list if they are encountered. The optional ``REQUIRE`` allows forcing the components ``PATCH`` and ``TWEAK`` to always be defined.
|
||||||
|
|
||||||
Generating
|
Generating
|
||||||
^^^^^^^^^^
|
^^^^^^^^^^
|
||||||
@@ -38,9 +38,9 @@ Generating
|
|||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
version(GENERATE <out-var> [COMPRESS] [MAJOR <major>] [MINOR <minor>] [PATCH <patch>] [TWEAK <tweak>] [PRERELEASE <prerelease>] [BUILD <build>])
|
version(GENERATE <out-var> [COMPRESS] [MAJOR <major>] [MINOR <minor>] [PATCH <patch>] [TWEAK <tweak>] [PRERELEASE <prerelease>] [BUILD <build>] [REQUIRE [PATCH|TWEAK][;...]])
|
||||||
|
|
||||||
Generates a version from the components provided and stores the result in ``<out-var>``. The components ``<major>`` and ``<minor>`` will default to ``0`` if not provided. If an error occurred, ``<out-var>_ERROR`` will contain the error message otherwise it will be a false constant. The ``PRERELEASE`` and ``BUILD`` components support the dot-separation specifier and will be converted from a list if encountered.
|
Generates a version from the components provided and stores the result in ``<out-var>``. The components ``<major>`` and ``<minor>`` will default to ``0`` if not provided. If an error occurred, ``<out-var>_ERROR`` will contain the error message otherwise it will be a false constant. The ``PRERELEASE`` and ``BUILD`` components support the dot-separation specifier and will be converted from a list if encountered. The optional ``REQUIRE`` allows forcing the components ``PATCH`` and ``TWEAK`` to always be defined.
|
||||||
|
|
||||||
Modifying
|
Modifying
|
||||||
^^^^^^^^^
|
^^^^^^^^^
|
||||||
@@ -49,9 +49,9 @@ Modifying
|
|||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
version(MODIFY <out-var> <string> [COMPRESS] [MAJOR <major>] [MINOR <minor] [PATCH <patch>] [TWEAK <tweak>] [PRERELEASE <prerelease>] [BUILD <build>])
|
version(MODIFY <out-var> <string> [COMPRESS] [MAJOR <major>] [MINOR <minor] [PATCH <patch>] [TWEAK <tweak>] [PRERELEASE <prerelease>] [BUILD <build>] [REQUIRE [PATCH|TWEAK][;...]])
|
||||||
|
|
||||||
Modifies the version provided in ``<string>`` with the components provided. The components ``<major>``, ``<minor>``, ``<patch>`` and ``<tweak>`` may have a prefix of ``+`` or ``-`` to add and subtract the value, or no prefix to replace. The result of this operation will be stored as a string in ``<out-var>``. If a component did not exist in the original, it will be added to the version as a replace operation. If an error occurred, ``<out-var>_ERROR`` will contain the error message otherwise it will be a false constant.
|
Modifies the version provided in ``<string>`` with the components provided. The components ``<major>``, ``<minor>``, ``<patch>`` and ``<tweak>`` may have a prefix of ``+`` or ``-`` to add and subtract the value, or no prefix to replace. The result of this operation will be stored as a string in ``<out-var>``. If a component did not exist in the original, it will be added to the version as a replace operation. If an error occurred, ``<out-var>_ERROR`` will contain the error message otherwise it will be a false constant. The optional ``REQUIRE`` allows forcing the components ``PATCH`` and ``TWEAK`` to always be defined.
|
||||||
|
|
||||||
Comparing
|
Comparing
|
||||||
^^^^^^^^^
|
^^^^^^^^^
|
||||||
@@ -59,7 +59,7 @@ Comparing
|
|||||||
.. _COMPARE:
|
.. _COMPARE:
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
version(COMPARE <out-var> <a> <b>)
|
version(COMPARE <out-var> <a> <b>)
|
||||||
|
|
||||||
Compares the version ``<a>`` against ``<b>`` and stores the result in ``<out-var>``. The provided version will be evaluated in the order MAJOR, MINOR, PATCH, TWEAK, PRERELEASE, and then BUILD. The following results should be expected:
|
Compares the version ``<a>`` against ``<b>`` and stores the result in ``<out-var>``. The provided version will be evaluated in the order MAJOR, MINOR, PATCH, TWEAK, PRERELEASE, and then BUILD. The following results should be expected:
|
||||||
@@ -69,7 +69,7 @@ Compares the version ``<a>`` against ``<b>`` and stores the result in ``<out-var
|
|||||||
- If a component is numerical and the value is larger in ``<a>``, ``<out-var>`` will contain the componenent name prefixed by ``>``.
|
- If a component is numerical and the value is larger in ``<a>``, ``<out-var>`` will contain the componenent name prefixed by ``>``.
|
||||||
- If a component is numerical and the value is larger in ``<b>``, ``<out-var>`` will contain the componenent name prefixed by ``<``.
|
- If a component is numerical and the value is larger in ``<b>``, ``<out-var>`` will contain the componenent name prefixed by ``<``.
|
||||||
- If a component is alphanumerical and the value is different in either, ``<out-var>`` will contain the component name with no prefix.
|
- If a component is alphanumerical and the value is different in either, ``<out-var>`` will contain the component name with no prefix.
|
||||||
- If an error occurred, ``<out-var>_ERROR`` will contain the error message otherwise it will be a false constant, and ``<out-var>`` will be a false constant.
|
- If an error occurred, ``<out-var>_ERROR`` will contain the error message otherwise it will be a false constant, and ``<out-var>`` will be a false constant.
|
||||||
- In all other cases, ``<out-var>`` will be a false constant.
|
- In all other cases, ``<out-var>`` will be a false constant.
|
||||||
|
|
||||||
There is no special handling for dot-separated ``PRERELEASE`` and ``BUILD`` component. They will be treated as if they were a string, as special handling for these is up to the application.
|
There is no special handling for dot-separated ``PRERELEASE`` and ``BUILD`` component. They will be treated as if they were a string, as special handling for these is up to the application.
|
||||||
|
|||||||
+41
-96
@@ -10,86 +10,8 @@
|
|||||||
#
|
#
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#[=======================================================================[.rst:
|
|
||||||
version
|
|
||||||
-------
|
|
||||||
|
|
||||||
Generate, parse and modify versions purely with CMake. Supports Semantic Versioning 2.0.0, 1.0.0 and other version formats.
|
|
||||||
|
|
||||||
Synopsis
|
|
||||||
^^^^^^^^
|
|
||||||
|
|
||||||
.. parsed-literal::
|
|
||||||
|
|
||||||
version(`PARSE`_ <out-var> <string>)
|
|
||||||
version(`GENERATE`_ <out-var> [COMPRESS] [MAJOR <major>] [MINOR <minor>] [PATCH <patch>] [TWEAK <tweak>] [PRERELEASE <prerelease>] [BUILD <build>])
|
|
||||||
version(`MODIFY`_ <out-var> <string> [COMPRESS] [MAJOR <major>] [MINOR <minor] [PATCH <patch>] [TWEAK <tweak>] [PRERELEASE <prerelease>] [BUILD <build>])
|
|
||||||
version(`COMPARE`_ <out-var> <a> <b>)
|
|
||||||
|
|
||||||
|
|
||||||
The following version constructs are currently supported:
|
|
||||||
|
|
||||||
.. code-block::
|
|
||||||
|
|
||||||
<major> "." <minor> ["." <patch> ["." <tweak>]]
|
|
||||||
<major> "." <minor> ["." <patch> ["." <tweak>]] [["-"] <pre-release>] ["+" <build>]
|
|
||||||
|
|
||||||
|
|
||||||
Parsing
|
|
||||||
^^^^^^^
|
|
||||||
|
|
||||||
.. _PARSE:
|
|
||||||
|
|
||||||
.. code-block:: cmake
|
|
||||||
|
|
||||||
version(PARSE <out-var> <string>)
|
|
||||||
|
|
||||||
Attempts to parse the version in ``<string>`` and stores the individual compoents into ``<out-var>_<component>``. If a component is not present in the given version, it will be undefined. If an error occurred, ``<out-var>_ERROR`` will be defined and contain the error message.
|
|
||||||
|
|
||||||
Generating
|
|
||||||
^^^^^^^^^^
|
|
||||||
|
|
||||||
.. _GENERATE:
|
|
||||||
|
|
||||||
.. code-block:: cmake
|
|
||||||
|
|
||||||
version(GENERATE <out-var> [COMPRESS] [MAJOR <major>] [MINOR <minor>] [PATCH <patch>] [TWEAK <tweak>] [PRERELEASE <prerelease>] [BUILD <build>])
|
|
||||||
|
|
||||||
Generates a version from the components provided and stores the result in ``<out-var>``. The components ``<major>`` and ``<minor>`` will default to ``0`` if not provided. If an error occurred, ``<out-var>_ERROR`` will be defined and contain the error message.
|
|
||||||
|
|
||||||
Modifying
|
|
||||||
^^^^^^^^^
|
|
||||||
|
|
||||||
.. _MODIFY:
|
|
||||||
|
|
||||||
.. code-block:: cmake
|
|
||||||
|
|
||||||
version(MODIFY <out-var> <string> [COMPRESS] [MAJOR <major>] [MINOR <minor] [PATCH <patch>] [TWEAK <tweak>] [PRERELEASE <prerelease>] [BUILD <build>])
|
|
||||||
|
|
||||||
Modifies the version provided in ``<string>`` with the components provided. The components ``<major>``, ``<minor>``, ``<patch>`` and ``<tweak>`` may have a prefix of ``+`` or ``-`` to add and subtract the value, or no prefix to replace. The result of this operation will be stored as a string in ``<out-var>``. If a component did not exist in the original, it will be added to the version as a replace operation. If an error occurred, ``<out-var>_ERROR`` will be defined and contain the error message.
|
|
||||||
|
|
||||||
Comparing
|
|
||||||
^^^^^^^^^
|
|
||||||
|
|
||||||
.. _COMPARE:
|
|
||||||
|
|
||||||
.. code-block:: cmake
|
|
||||||
|
|
||||||
version(COMPARE <out-var> <a> <b>)
|
|
||||||
|
|
||||||
Compares the version ``<a>`` against ``<b>`` and stores the result in ``<out-var>``. The provided version will be evaluated in the order MAJOR, MINOR, PATCH, TWEAK, PRERELEASE, and then BUILD. The following results should be expected:
|
|
||||||
|
|
||||||
- If a component is only in ``<a>``, ``<out-var>`` will contain the componenent name prefixed by ``+``.
|
|
||||||
- If a component is only in ``<b>``, ``<out-var>`` will contain the componenent name prefixed by ``-``.
|
|
||||||
- If a component is numerical and the value is larger in ``<a>``, ``<out-var>`` will contain the componenent name prefixed by ``>``.
|
|
||||||
- If a component is numerical and the value is larger in ``<b>``, ``<out-var>`` will contain the componenent name prefixed by ``<``.
|
|
||||||
- If a component is alphanumerical and the value is different in either, ``<out-var>`` will contain the component name with no prefix.
|
|
||||||
- In all other cases, ``<out-var>`` will be empty.
|
|
||||||
- If an error occurred, ``<out-var>_ERROR`` will be defined and contain the error message, and ``<out-var>`` will be undefined.
|
|
||||||
#]=======================================================================]
|
|
||||||
|
|
||||||
function(version)
|
function(version)
|
||||||
# CMake functions do not have their own proper scope, they act more
|
# CMake functions do not have their own proper scope, they act more
|
||||||
|
|
||||||
set(OUT_VAR "${ARGV1}")
|
set(OUT_VAR "${ARGV1}")
|
||||||
|
|
||||||
@@ -98,12 +20,19 @@ function(version)
|
|||||||
|
|
||||||
string(TOUPPER "${ARGV0}" ARGV0)
|
string(TOUPPER "${ARGV0}" ARGV0)
|
||||||
if(ARGV0 STREQUAL "PARSE")
|
if(ARGV0 STREQUAL "PARSE")
|
||||||
|
cmake_parse_arguments(
|
||||||
|
PARSE_ARGV 2
|
||||||
|
_992ae727
|
||||||
|
""
|
||||||
|
""
|
||||||
|
"REQUIRE"
|
||||||
|
)
|
||||||
# <major> "." <minor> ["." <patch> ["." <tweak>]]
|
# <major> "." <minor> ["." <patch> ["." <tweak>]]
|
||||||
# <major> "." <minor> ["." <patch> ["." <tweak>]] [["-"] <pre-release>] ["+" <build>]
|
# <major> "." <minor> ["." <patch> ["." <tweak>]] [["-"] <pre-release>] ["+" <build>]
|
||||||
|
|
||||||
# One regex to rule them all...
|
# One regex to rule them all...
|
||||||
if(NOT (ARGV2 MATCHES [[^([0-9]+)\.([0-9]+)(\.[0-9]+|)(\.[0-9]+|)(-?[a-zA-Z0-9]+[a-zA-Z0-9\.\-]*|)(\+[a-zA-Z0-9]+[a-zA-Z0-9\.\-]*|)$]]))
|
if(NOT (_992ae727_UNPARSED_ARGUMENTS MATCHES [[^([0-9]+)\.([0-9]+)(\.[0-9]+|)(\.[0-9]+|)(-?[a-zA-Z0-9]+[a-zA-Z0-9\.\-]*|)(\+[a-zA-Z0-9]+[a-zA-Z0-9\.\-]*|)$]]))
|
||||||
set(${OUT_VAR}_ERROR "Version format not supported: '${ARGV2}'" PARENT_SCOPE)
|
set(${OUT_VAR}_ERROR "Version format not supported: '${_992ae727_UNPARSED_ARGUMENTS}'" PARENT_SCOPE)
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -116,14 +45,22 @@ function(version)
|
|||||||
string(SUBSTRING "${CMAKE_MATCH_3}" 1 -1 _TMP)
|
string(SUBSTRING "${CMAKE_MATCH_3}" 1 -1 _TMP)
|
||||||
set(${OUT_VAR}_PATCH "${_TMP}" PARENT_SCOPE)
|
set(${OUT_VAR}_PATCH "${_TMP}" PARENT_SCOPE)
|
||||||
else()
|
else()
|
||||||
set(${OUT_VAR}_PATCH "" PARENT_SCOPE)
|
if("PATCH" IN_LIST _992ae727_REQUIRE)
|
||||||
|
set(${OUT_VAR}_PATCH "0" PARENT_SCOPE)
|
||||||
|
else()
|
||||||
|
set(${OUT_VAR}_PATCH "" PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
# {4} = Tweak
|
# {4} = Tweak
|
||||||
if((DEFINED CMAKE_MATCH_4) AND (NOT "${CMAKE_MATCH_4}" STREQUAL ""))
|
if((DEFINED CMAKE_MATCH_4) AND (NOT "${CMAKE_MATCH_4}" STREQUAL ""))
|
||||||
string(SUBSTRING "${CMAKE_MATCH_4}" 1 -1 _TMP)
|
string(SUBSTRING "${CMAKE_MATCH_4}" 1 -1 _TMP)
|
||||||
set(${OUT_VAR}_TWEAK "${_TMP}" PARENT_SCOPE)
|
set(${OUT_VAR}_TWEAK "${_TMP}" PARENT_SCOPE)
|
||||||
else()
|
else()
|
||||||
set(${OUT_VAR}_TWEAK "" PARENT_SCOPE)
|
if("TWEAK" IN_LIST _992ae727_REQUIRE)
|
||||||
|
set(${OUT_VAR}_TWEAK "0" PARENT_SCOPE)
|
||||||
|
else()
|
||||||
|
set(${OUT_VAR}_TWEAK "" PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
# {5} = PreRelease
|
# {5} = PreRelease
|
||||||
if((DEFINED CMAKE_MATCH_5) AND (NOT "${CMAKE_MATCH_5}" STREQUAL ""))
|
if((DEFINED CMAKE_MATCH_5) AND (NOT "${CMAKE_MATCH_5}" STREQUAL ""))
|
||||||
@@ -156,12 +93,13 @@ function(version)
|
|||||||
set(_32070faa_PRERELEASE "")
|
set(_32070faa_PRERELEASE "")
|
||||||
set(_32070faa_BUILD "")
|
set(_32070faa_BUILD "")
|
||||||
set(_32070faa_ERROR "")
|
set(_32070faa_ERROR "")
|
||||||
|
set(_32070faa_REQUIRE "")
|
||||||
cmake_parse_arguments(
|
cmake_parse_arguments(
|
||||||
PARSE_ARGV 2
|
PARSE_ARGV 2
|
||||||
_32070faa
|
_32070faa
|
||||||
"COMPRESS"
|
"COMPRESS"
|
||||||
"MAJOR;MINOR;PATCH;TWEAK;PRERELEASE;BUILD"
|
"MAJOR;MINOR;PATCH;TWEAK;PRERELEASE;BUILD"
|
||||||
""
|
"REQUIRE"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Do we have the major component, and is it valid?
|
# Do we have the major component, and is it valid?
|
||||||
@@ -195,22 +133,26 @@ function(version)
|
|||||||
# Do we have the patch component, and is it valid?
|
# Do we have the patch component, and is it valid?
|
||||||
if(NOT "${_32070faa_PATCH}" STREQUAL "")
|
if(NOT "${_32070faa_PATCH}" STREQUAL "")
|
||||||
string(STRIP "${_32070faa_PATCH}" _32070faa_PATCH)
|
string(STRIP "${_32070faa_PATCH}" _32070faa_PATCH)
|
||||||
if("${_32070faa_PATCH}" STREQUAL "")
|
if(("${_32070faa_PATCH}" STREQUAL "") AND ("PATCH" IN_LIST _32070faa_REQUIRE))
|
||||||
set(_32070faa_PATCH "")
|
set(_32070faa_PATCH "0")
|
||||||
elseif(_32070faa_PATCH MATCHES [[^[0-9]+$]])
|
endif()
|
||||||
|
if(_32070faa_PATCH MATCHES [[^[0-9]+$]])
|
||||||
set(_feeb1eff "${_feeb1eff}.${_32070faa_PATCH}")
|
set(_feeb1eff "${_feeb1eff}.${_32070faa_PATCH}")
|
||||||
else()
|
else()
|
||||||
set(${OUT_VAR}_ERROR "PATCH component must be a numeric identifier, but is: '${_32070faa_PATCH}'" PARENT_SCOPE)
|
set(${OUT_VAR}_ERROR "PATCH component must be a numeric identifier, but is: '${_32070faa_PATCH}'" PARENT_SCOPE)
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
elseif("PATCH" IN_LIST _32070faa_REQUIRE)
|
||||||
|
set(_feeb1eff "${_feeb1eff}.0")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Do we have the tweak component, and is it valid?
|
# Do we have the tweak component, and is it valid?
|
||||||
if(NOT "${_32070faa_TWEAK}" STREQUAL "")
|
if(NOT "${_32070faa_TWEAK}" STREQUAL "")
|
||||||
string(STRIP "${_32070faa_TWEAK}" _32070faa_TWEAK)
|
string(STRIP "${_32070faa_TWEAK}" _32070faa_TWEAK)
|
||||||
if("${_32070faa_TWEAK}" STREQUAL "")
|
if(("${_32070faa_TWEAK}" STREQUAL "") AND ("TWEAK" IN_LIST _32070faa_REQUIRE))
|
||||||
set(_32070faa_TWEAK "")
|
set(_32070faa_TWEAK "0")
|
||||||
elseif(_32070faa_TWEAK MATCHES [[^[0-9]+$]])
|
endif()
|
||||||
|
if(_32070faa_TWEAK MATCHES [[^[0-9]+$]])
|
||||||
if("${_32070faa_PATCH}" STREQUAL "")
|
if("${_32070faa_PATCH}" STREQUAL "")
|
||||||
# Patch did not exist, so it is zero.
|
# Patch did not exist, so it is zero.
|
||||||
set(_feeb1eff "${_feeb1eff}.0")
|
set(_feeb1eff "${_feeb1eff}.0")
|
||||||
@@ -270,7 +212,7 @@ function(version)
|
|||||||
_fe7bcddd
|
_fe7bcddd
|
||||||
"COMPRESS"
|
"COMPRESS"
|
||||||
"MAJOR;MINOR;PATCH;TWEAK;PRERELEASE;BUILD"
|
"MAJOR;MINOR;PATCH;TWEAK;PRERELEASE;BUILD"
|
||||||
""
|
"REQUIRE"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Helpers
|
# Helpers
|
||||||
@@ -282,7 +224,7 @@ function(version)
|
|||||||
else()
|
else()
|
||||||
math(EXPR ${ARGV0} "${${ARGV0}} ${CMAKE_MATCH_1} ${CMAKE_MATCH_2}")
|
math(EXPR ${ARGV0} "${${ARGV0}} ${CMAKE_MATCH_1} ${CMAKE_MATCH_2}")
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
set(${ARGV0} "${${ARGV1}}")
|
set(${ARGV0} "${${ARGV1}}")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
@@ -297,7 +239,7 @@ function(version)
|
|||||||
set(_df8abcce_PRERELEASE "")
|
set(_df8abcce_PRERELEASE "")
|
||||||
set(_df8abcce_BUILD "")
|
set(_df8abcce_BUILD "")
|
||||||
set(_df8abcce_ERROR "")
|
set(_df8abcce_ERROR "")
|
||||||
version(PARSE _df8abcce "${ARGV2}")
|
version(PARSE _df8abcce "${ARGV2}" REQUIRE "${_df8abcce_REQUIRE}")
|
||||||
if(_df8abcce_ERROR)
|
if(_df8abcce_ERROR)
|
||||||
set(${OUT_VAR}_ERROR ${_df8abcce_ERROR} PARENT_SCOPE)
|
set(${OUT_VAR}_ERROR ${_df8abcce_ERROR} PARENT_SCOPE)
|
||||||
return()
|
return()
|
||||||
@@ -340,6 +282,9 @@ function(version)
|
|||||||
if(_fe7bcddd_COMPRESS)
|
if(_fe7bcddd_COMPRESS)
|
||||||
set(_fe7bcddd_GEN "${_fe7bcddd_GEN} COMPRESS")
|
set(_fe7bcddd_GEN "${_fe7bcddd_GEN} COMPRESS")
|
||||||
endif()
|
endif()
|
||||||
|
if(_fe7bcddd_REQUIRE)
|
||||||
|
set(_fe7bcddd_GEN "${_fe7bcddd_GEN} REQUIRE \"${_df8abcce_REQUIRE}\"")
|
||||||
|
endif()
|
||||||
cmake_language(EVAL CODE "version(GENERATE _df8abcce ${_fe7bcddd_GEN})")
|
cmake_language(EVAL CODE "version(GENERATE _df8abcce ${_fe7bcddd_GEN})")
|
||||||
if(_df8abcce_ERROR)
|
if(_df8abcce_ERROR)
|
||||||
set(${OUT_VAR}_ERROR ${_df8abcce_ERROR} PARENT_SCOPE)
|
set(${OUT_VAR}_ERROR ${_df8abcce_ERROR} PARENT_SCOPE)
|
||||||
@@ -442,7 +387,7 @@ function(version)
|
|||||||
endif()
|
endif()
|
||||||
elseif(NOT (_00fdeadb_PRERELEASE STREQUAL _ca75feel_PRERELEASE))
|
elseif(NOT (_00fdeadb_PRERELEASE STREQUAL _ca75feel_PRERELEASE))
|
||||||
set(${OUT_VAR} "PRERELEASE" PARENT_SCOPE)
|
set(${OUT_VAR} "PRERELEASE" PARENT_SCOPE)
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Build
|
# Build
|
||||||
@@ -456,7 +401,7 @@ function(version)
|
|||||||
endif()
|
endif()
|
||||||
elseif(NOT (_00fdeadb_BUILD STREQUAL _ca75feel_BUILD))
|
elseif(NOT (_00fdeadb_BUILD STREQUAL _ca75feel_BUILD))
|
||||||
set(${OUT_VAR} "BUILD" PARENT_SCOPE)
|
set(${OUT_VAR} "BUILD" PARENT_SCOPE)
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Both are exactly the same.
|
# Both are exactly the same.
|
||||||
@@ -465,4 +410,4 @@ function(version)
|
|||||||
message(FATAL_ERROR "Unknown command '${ARGV0}'")
|
message(FATAL_ERROR "Unknown command '${ARGV0}'")
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|||||||
Reference in New Issue
Block a user