Files
cmake-version/index.html
GitHub Actions dbb66abcca 3bef96bafa
2023-04-22 23:47:17 +00:00

165 lines
18 KiB
HTML

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>version &mdash; version 1.4.1 documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/sphinx_highlight.js"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="#" class="icon icon-home">
version
</a>
<div class="version">
1.4.1
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<!-- Local TOC -->
<div class="local-toc"><ul>
<li><a class="reference internal" href="#">version</a><ul>
<li><a class="reference internal" href="#synopsis">Synopsis</a></li>
<li><a class="reference internal" href="#parsing">Parsing</a></li>
<li><a class="reference internal" href="#generating">Generating</a></li>
<li><a class="reference internal" href="#modifying">Modifying</a></li>
<li><a class="reference internal" href="#comparing">Comparing</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="#">version</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="#" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item active">version</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/index.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="version">
<h1>version<a class="headerlink" href="#version" title="Permalink to this heading"></a></h1>
<p>Generate, parse and modify versions purely with CMake. Supports Semantic Versioning 2.0.0, 1.0.0 and other version formats.</p>
<section id="synopsis">
<h2>Synopsis<a class="headerlink" href="#synopsis" title="Permalink to this heading"></a></h2>
<pre class="literal-block">version(<a class="reference internal" href="#parse">PARSE</a> &lt;out-var&gt; [REQUIRE [PATCH|TWEAK][;...]] &lt;string&gt;)
version(<a class="reference internal" href="#generate">GENERATE</a> &lt;out-var&gt; [COMPRESS] [MAJOR &lt;major&gt;] [MINOR &lt;minor&gt;] [PATCH &lt;patch&gt;] [TWEAK &lt;tweak&gt;] [PRERELEASE &lt;prerelease&gt;] [BUILD &lt;build&gt;] [REQUIRE [PATCH|TWEAK][;...]])
version(<a class="reference internal" href="#modify">MODIFY</a> &lt;out-var&gt; &lt;string&gt; [COMPRESS] [MAJOR &lt;major&gt;] [MINOR &lt;minor] [PATCH &lt;patch&gt;] [TWEAK &lt;tweak&gt;] [PRERELEASE &lt;prerelease&gt;] [BUILD &lt;build&gt;] [REQUIRE [PATCH|TWEAK][;...]])
version(<a class="reference internal" href="#compare">COMPARE</a> &lt;out-var&gt; &lt;a&gt; &lt;b&gt;)</pre>
<p>The following version constructs are currently supported:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">&lt;</span><span class="n">major</span><span class="o">&gt;</span> <span class="s2">&quot;.&quot;</span> <span class="o">&lt;</span><span class="n">minor</span><span class="o">&gt;</span> <span class="p">[</span><span class="s2">&quot;.&quot;</span> <span class="o">&lt;</span><span class="n">patch</span><span class="o">&gt;</span> <span class="p">[</span><span class="s2">&quot;.&quot;</span> <span class="o">&lt;</span><span class="n">tweak</span><span class="o">&gt;</span><span class="p">]]</span> <span class="p">[[</span><span class="s2">&quot;-&quot;</span><span class="p">]</span> <span class="o">&lt;</span><span class="n">pre</span><span class="o">-</span><span class="n">release</span><span class="o">&gt;</span> <span class="p">[</span><span class="s2">&quot;.&quot;</span> <span class="o">&lt;</span><span class="n">pre</span><span class="o">-</span><span class="n">release</span><span class="o">&gt;</span> <span class="p">[</span><span class="o">...</span><span class="p">]]]</span> <span class="p">[</span><span class="s2">&quot;+&quot;</span> <span class="o">&lt;</span><span class="n">build</span><span class="o">&gt;</span> <span class="p">[</span><span class="s2">&quot;.&quot;</span> <span class="o">&lt;</span><span class="n">build</span><span class="o">&gt;</span> <span class="p">[</span><span class="o">...</span><span class="p">]]]</span>
</pre></div>
</div>
</section>
<section id="parsing">
<h2>Parsing<a class="headerlink" href="#parsing" title="Permalink to this heading"></a></h2>
<div class="highlight-cmake notranslate" id="parse"><div class="highlight"><pre><span></span><span class="nb">version</span><span class="p">(</span><span class="s">PARSE</span><span class="w"> </span><span class="s">&lt;out-var&gt;</span><span class="w"> </span><span class="s">[REQUIRE</span><span class="w"> </span><span class="s">[PATCH|TWEAK][;...]]</span><span class="w"> </span><span class="s">&lt;string&gt;</span><span class="p">)</span>
</pre></div>
</div>
<p>Attempts to parse the version in <code class="docutils literal notranslate"><span class="pre">&lt;string&gt;</span></code> and stores the individual compoents into <code class="docutils literal notranslate"><span class="pre">&lt;out-var&gt;_&lt;component&gt;</span></code>. If a component is not present in the given version, it will be set to a false constant. If an error occurred, <code class="docutils literal notranslate"><span class="pre">&lt;out-var&gt;_ERROR</span></code> will contain the error message otherwise it will be a false constant. The <code class="docutils literal notranslate"><span class="pre">PRERELEASE</span></code> and <code class="docutils literal notranslate"><span class="pre">BUILD</span></code> components support the dot-separation specifier and will be turned into a list if they are encountered. The optional <code class="docutils literal notranslate"><span class="pre">REQUIRE</span></code> allows forcing the components <code class="docutils literal notranslate"><span class="pre">PATCH</span></code> and <code class="docutils literal notranslate"><span class="pre">TWEAK</span></code> to always be defined.</p>
<p>It is necessary to include a <code class="docutils literal notranslate"><span class="pre">;</span></code> for the <code class="docutils literal notranslate"><span class="pre">REQUIRE</span></code> parameter, even if there is only one required part.</p>
</section>
<section id="generating">
<h2>Generating<a class="headerlink" href="#generating" title="Permalink to this heading"></a></h2>
<div class="highlight-cmake notranslate" id="generate"><div class="highlight"><pre><span></span><span class="nb">version</span><span class="p">(</span><span class="s">GENERATE</span><span class="w"> </span><span class="s">&lt;out-var&gt;</span><span class="w"> </span><span class="s">[COMPRESS]</span><span class="w"> </span><span class="s">[MAJOR</span><span class="w"> </span><span class="s">&lt;major&gt;]</span><span class="w"> </span><span class="s">[MINOR</span><span class="w"> </span><span class="s">&lt;minor&gt;]</span><span class="w"> </span><span class="s">[PATCH</span><span class="w"> </span><span class="s">&lt;patch&gt;]</span><span class="w"> </span><span class="s">[TWEAK</span><span class="w"> </span><span class="s">&lt;tweak&gt;]</span><span class="w"> </span><span class="s">[PRERELEASE</span><span class="w"> </span><span class="s">&lt;prerelease&gt;]</span><span class="w"> </span><span class="s">[BUILD</span><span class="w"> </span><span class="s">&lt;build&gt;]</span><span class="w"> </span><span class="s">[REQUIRE</span><span class="w"> </span><span class="s">[PATCH|TWEAK][;...]]</span><span class="p">)</span>
</pre></div>
</div>
<p>Generates a version from the components provided and stores the result in <code class="docutils literal notranslate"><span class="pre">&lt;out-var&gt;</span></code>. The components <code class="docutils literal notranslate"><span class="pre">&lt;major&gt;</span></code> and <code class="docutils literal notranslate"><span class="pre">&lt;minor&gt;</span></code> will default to <code class="docutils literal notranslate"><span class="pre">0</span></code> if not provided. If an error occurred, <code class="docutils literal notranslate"><span class="pre">&lt;out-var&gt;_ERROR</span></code> will contain the error message otherwise it will be a false constant. The <code class="docutils literal notranslate"><span class="pre">PRERELEASE</span></code> and <code class="docutils literal notranslate"><span class="pre">BUILD</span></code> components support the dot-separation specifier and will be converted from a list if encountered. The optional <code class="docutils literal notranslate"><span class="pre">REQUIRE</span></code> allows forcing the components <code class="docutils literal notranslate"><span class="pre">PATCH</span></code> and <code class="docutils literal notranslate"><span class="pre">TWEAK</span></code> to always be defined.</p>
<p>It is necessary to include a <code class="docutils literal notranslate"><span class="pre">;</span></code> for the <code class="docutils literal notranslate"><span class="pre">REQUIRE</span></code> parameter, even if there is only one required part.</p>
</section>
<section id="modifying">
<h2>Modifying<a class="headerlink" href="#modifying" title="Permalink to this heading"></a></h2>
<div class="highlight-cmake notranslate" id="modify"><div class="highlight"><pre><span></span><span class="nb">version</span><span class="p">(</span><span class="s">MODIFY</span><span class="w"> </span><span class="s">&lt;out-var&gt;</span><span class="w"> </span><span class="s">&lt;string&gt;</span><span class="w"> </span><span class="s">[COMPRESS]</span><span class="w"> </span><span class="s">[MAJOR</span><span class="w"> </span><span class="s">&lt;major&gt;]</span><span class="w"> </span><span class="s">[MINOR</span><span class="w"> </span><span class="s">&lt;minor]</span><span class="w"> </span><span class="s">[PATCH</span><span class="w"> </span><span class="s">&lt;patch&gt;]</span><span class="w"> </span><span class="s">[TWEAK</span><span class="w"> </span><span class="s">&lt;tweak&gt;]</span><span class="w"> </span><span class="s">[PRERELEASE</span><span class="w"> </span><span class="s">&lt;prerelease&gt;]</span><span class="w"> </span><span class="s">[BUILD</span><span class="w"> </span><span class="s">&lt;build&gt;]</span><span class="w"> </span><span class="s">[REQUIRE</span><span class="w"> </span><span class="s">[PATCH|TWEAK][;...]]</span><span class="p">)</span>
</pre></div>
</div>
<p>Modifies the version provided in <code class="docutils literal notranslate"><span class="pre">&lt;string&gt;</span></code> with the components provided. The components <code class="docutils literal notranslate"><span class="pre">&lt;major&gt;</span></code>, <code class="docutils literal notranslate"><span class="pre">&lt;minor&gt;</span></code>, <code class="docutils literal notranslate"><span class="pre">&lt;patch&gt;</span></code> and <code class="docutils literal notranslate"><span class="pre">&lt;tweak&gt;</span></code> may have a prefix of <code class="docutils literal notranslate"><span class="pre">+</span></code> or <code class="docutils literal notranslate"><span class="pre">-</span></code> to add and subtract the value, or no prefix to replace. The result of this operation will be stored as a string in <code class="docutils literal notranslate"><span class="pre">&lt;out-var&gt;</span></code>. If a component did not exist in the original, it will be added to the version as a replace operation. If an error occurred, <code class="docutils literal notranslate"><span class="pre">&lt;out-var&gt;_ERROR</span></code> will contain the error message otherwise it will be a false constant. The optional <code class="docutils literal notranslate"><span class="pre">REQUIRE</span></code> allows forcing the components <code class="docutils literal notranslate"><span class="pre">PATCH</span></code> and <code class="docutils literal notranslate"><span class="pre">TWEAK</span></code> to always be defined.</p>
<p>It is necessary to include a <code class="docutils literal notranslate"><span class="pre">;</span></code> for the <code class="docutils literal notranslate"><span class="pre">REQUIRE</span></code> parameter, even if there is only one required part.</p>
</section>
<section id="comparing">
<h2>Comparing<a class="headerlink" href="#comparing" title="Permalink to this heading"></a></h2>
<div class="highlight-cmake notranslate" id="compare"><div class="highlight"><pre><span></span><span class="nb">version</span><span class="p">(</span><span class="s">COMPARE</span><span class="w"> </span><span class="s">&lt;out-var&gt;</span><span class="w"> </span><span class="s">&lt;a&gt;</span><span class="w"> </span><span class="s">&lt;b&gt;</span><span class="p">)</span>
</pre></div>
</div>
<p>Compares the version <code class="docutils literal notranslate"><span class="pre">&lt;a&gt;</span></code> against <code class="docutils literal notranslate"><span class="pre">&lt;b&gt;</span></code> and stores the result in <code class="docutils literal notranslate"><span class="pre">&lt;out-var&gt;</span></code>. The provided version will be evaluated in the order MAJOR, MINOR, PATCH, TWEAK, PRERELEASE, and then BUILD. The following results should be expected:</p>
<ul class="simple">
<li><p>If a component is only in <code class="docutils literal notranslate"><span class="pre">&lt;a&gt;</span></code>, <code class="docutils literal notranslate"><span class="pre">&lt;out-var&gt;</span></code> will contain the componenent name prefixed by <code class="docutils literal notranslate"><span class="pre">+</span></code>.</p></li>
<li><p>If a component is only in <code class="docutils literal notranslate"><span class="pre">&lt;b&gt;</span></code>, <code class="docutils literal notranslate"><span class="pre">&lt;out-var&gt;</span></code> will contain the componenent name prefixed by <code class="docutils literal notranslate"><span class="pre">-</span></code>.</p></li>
<li><p>If a component is numerical and the value is larger in <code class="docutils literal notranslate"><span class="pre">&lt;a&gt;</span></code>, <code class="docutils literal notranslate"><span class="pre">&lt;out-var&gt;</span></code> will contain the componenent name prefixed by <code class="docutils literal notranslate"><span class="pre">&gt;</span></code>.</p></li>
<li><p>If a component is numerical and the value is larger in <code class="docutils literal notranslate"><span class="pre">&lt;b&gt;</span></code>, <code class="docutils literal notranslate"><span class="pre">&lt;out-var&gt;</span></code> will contain the componenent name prefixed by <code class="docutils literal notranslate"><span class="pre">&lt;</span></code>.</p></li>
<li><p>If a component is alphanumerical and the value is different in either, <code class="docutils literal notranslate"><span class="pre">&lt;out-var&gt;</span></code> will contain the component name with no prefix.</p></li>
<li><p>If an error occurred, <code class="docutils literal notranslate"><span class="pre">&lt;out-var&gt;_ERROR</span></code> will contain the error message otherwise it will be a false constant, and <code class="docutils literal notranslate"><span class="pre">&lt;out-var&gt;</span></code> will be a false constant.</p></li>
<li><p>In all other cases, <code class="docutils literal notranslate"><span class="pre">&lt;out-var&gt;</span></code> will be a false constant.</p></li>
</ul>
<p>There is no special handling for dot-separated <code class="docutils literal notranslate"><span class="pre">PRERELEASE</span></code> and <code class="docutils literal notranslate"><span class="pre">BUILD</span></code> component. They will be treated as if they were a string, as special handling for these is up to the application.</p>
</section>
</section>
</div>
</div>
<footer>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2022, Michael Fabian Dirks.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>