blob: 2e78a3c962a9515af5186ef1c26807503b474178 [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>FindBISON &mdash; CMake 3.23.1 Documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../_static/cmake.css" />
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<link rel="shortcut icon" href="../_static/cmake-favicon.ico"/>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="FindBLAS" href="FindBLAS.html" />
<link rel="prev" title="FindBacktrace" href="FindBacktrace.html" />
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="FindBLAS.html" title="FindBLAS"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="FindBacktrace.html" title="FindBacktrace"
accesskey="P">previous</a> |</li>
<li>
<img src="../_static/cmake-logo-16.png" alt=""
style="vertical-align: middle; margin-top: -2px" />
</li>
<li>
<a href="https://cmake.org/">CMake</a> &#187;
</li>
<li>
<a href="../index.html">3.23.1 Documentation</a> &#187;
</li>
<li class="nav-item nav-item-1"><a href="../manual/cmake-modules.7.html" accesskey="U">cmake-modules(7)</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">FindBISON</a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="findbison">
<span id="module:FindBISON"></span><h1>FindBISON<a class="headerlink" href="#findbison" title="Permalink to this headline">ΒΆ</a></h1>
<p>Find <code class="docutils literal notranslate"><span class="pre">bison</span></code> executable and provide a macro to generate custom build rules.</p>
<p>The module defines the following variables:</p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">BISON_EXECUTABLE</span></code></dt><dd><p>path to the <code class="docutils literal notranslate"><span class="pre">bison</span></code> program</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">BISON_VERSION</span></code></dt><dd><p>version of <code class="docutils literal notranslate"><span class="pre">bison</span></code></p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">BISON_FOUND</span></code></dt><dd><p>&quot;True&quot; if the program was found</p>
</dd>
</dl>
<p>The minimum required version of <code class="docutils literal notranslate"><span class="pre">bison</span></code> can be specified using the
standard CMake syntax, e.g. <span class="target" id="index-0-command:find_package"></span><a class="reference internal" href="../command/find_package.html#command:find_package" title="find_package"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">find_package(BISON</span> <span class="pre">2.1.3)</span></code></a>.</p>
<p>If <code class="docutils literal notranslate"><span class="pre">bison</span></code> is found, the module defines the macro:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>BISON_TARGET(&lt;Name&gt; &lt;YaccInput&gt; &lt;CodeOutput&gt;
[COMPILE_FLAGS &lt;flags&gt;]
[DEFINES_FILE &lt;file&gt;]
[VERBOSE [&lt;file&gt;]]
[REPORT_FILE &lt;file&gt;]
)
</pre></div>
</div>
<p>which will create a custom rule to generate a parser. <code class="docutils literal notranslate"><span class="pre">&lt;YaccInput&gt;</span></code> is
the path to a yacc file. <code class="docutils literal notranslate"><span class="pre">&lt;CodeOutput&gt;</span></code> is the name of the source file
generated by bison. A header file is also be generated, and contains
the token list.</p>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.14: </span>When <span class="target" id="index-0-policy:CMP0088"></span><a class="reference internal" href="../policy/CMP0088.html#policy:CMP0088" title="CMP0088"><code class="xref cmake cmake-policy docutils literal notranslate"><span class="pre">CMP0088</span></code></a> is set to <code class="docutils literal notranslate"><span class="pre">NEW</span></code>, <code class="docutils literal notranslate"><span class="pre">bison</span></code> runs in the
<span class="target" id="index-0-variable:CMAKE_CURRENT_BINARY_DIR"></span><a class="reference internal" href="../variable/CMAKE_CURRENT_BINARY_DIR.html#variable:CMAKE_CURRENT_BINARY_DIR" title="CMAKE_CURRENT_BINARY_DIR"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_CURRENT_BINARY_DIR</span></code></a> directory.</p>
</div>
<p>The options are:</p>
<dl>
<dt><code class="docutils literal notranslate"><span class="pre">COMPILE_FLAGS</span> <span class="pre">&lt;flags&gt;</span></code></dt><dd><p>Specify flags to be added to the <code class="docutils literal notranslate"><span class="pre">bison</span></code> command line.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">DEFINES_FILE</span> <span class="pre">&lt;file&gt;</span></code></dt><dd><div class="versionadded">
<p><span class="versionmodified added">New in version 3.4.</span></p>
</div>
<p>Specify a non-default header <code class="docutils literal notranslate"><span class="pre">&lt;file&gt;</span></code> to be generated by <code class="docutils literal notranslate"><span class="pre">bison</span></code>.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">VERBOSE</span> <span class="pre">[&lt;file&gt;]</span></code></dt><dd><p>Tell <code class="docutils literal notranslate"><span class="pre">bison</span></code> to write a report file of the grammar and parser.</p>
<div class="deprecated">
<p><span class="versionmodified deprecated">Deprecated since version 3.7: </span>If <code class="docutils literal notranslate"><span class="pre">&lt;file&gt;</span></code> is given, it specifies path the report file is copied to.
<code class="docutils literal notranslate"><span class="pre">[&lt;file&gt;]</span></code> is left for backward compatibility of this module.
Use <code class="docutils literal notranslate"><span class="pre">VERBOSE</span> <span class="pre">REPORT_FILE</span> <span class="pre">&lt;file&gt;</span></code>.</p>
</div>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">REPORT_FILE</span> <span class="pre">&lt;file&gt;</span></code></dt><dd><div class="versionadded">
<p><span class="versionmodified added">New in version 3.7.</span></p>
</div>
<p>Specify a non-default report <code class="docutils literal notranslate"><span class="pre">&lt;file&gt;</span></code>, if generated.</p>
</dd>
</dl>
<p>The macro defines the following variables:</p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">BISON_&lt;Name&gt;_DEFINED</span></code></dt><dd><p><code class="docutils literal notranslate"><span class="pre">True</span></code> is the macro ran successfully</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">BISON_&lt;Name&gt;_INPUT</span></code></dt><dd><p>The input source file, an alias for &lt;YaccInput&gt;</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">BISON_&lt;Name&gt;_OUTPUT_SOURCE</span></code></dt><dd><p>The source file generated by bison</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">BISON_&lt;Name&gt;_OUTPUT_HEADER</span></code></dt><dd><p>The header file generated by bison</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">BISON_&lt;Name&gt;_OUTPUTS</span></code></dt><dd><p>All files generated by bison including the source, the header and the report</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">BISON_&lt;Name&gt;_COMPILE_FLAGS</span></code></dt><dd><p>Options used in the <code class="docutils literal notranslate"><span class="pre">bison</span></code> command line</p>
</dd>
</dl>
<p>Example usage:</p>
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">find_package(</span><span class="no">BISON</span><span class="nf">)</span><span class="w"></span>
<span class="nf">BISON_TARGET(</span><span class="nb">MyParser</span><span class="w"> </span><span class="nb">parser.y</span><span class="w"> </span><span class="o">${</span><span class="nt">CMAKE_CURRENT_BINARY_DIR</span><span class="o">}</span><span class="na">/parser.cpp</span><span class="w"></span>
<span class="w"> </span><span class="no">DEFINES_FILE</span><span class="w"> </span><span class="o">${</span><span class="nt">CMAKE_CURRENT_BINARY_DIR</span><span class="o">}</span><span class="na">/parser.h</span><span class="nf">)</span><span class="w"></span>
<span class="nf">add_executable(</span><span class="nb">Foo</span><span class="w"> </span><span class="nb">main.cpp</span><span class="w"> </span><span class="o">${</span><span class="nt">BISON_MyParser_OUTPUTS</span><span class="o">}</span><span class="nf">)</span><span class="w"></span>
</pre></div>
</div>
</div>
<div class="clearer"></div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="FindBacktrace.html"
title="previous chapter">FindBacktrace</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="FindBLAS.html"
title="next chapter">FindBLAS</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/module/FindBISON.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="FindBLAS.html" title="FindBLAS"
>next</a> |</li>
<li class="right" >
<a href="FindBacktrace.html" title="FindBacktrace"
>previous</a> |</li>
<li>
<img src="../_static/cmake-logo-16.png" alt=""
style="vertical-align: middle; margin-top: -2px" />
</li>
<li>
<a href="https://cmake.org/">CMake</a> &#187;
</li>
<li>
<a href="../index.html">3.23.1 Documentation</a> &#187;
</li>
<li class="nav-item nav-item-1"><a href="../manual/cmake-modules.7.html" >cmake-modules(7)</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">FindBISON</a></li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2000-2022 Kitware, Inc. and Contributors.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.1.2.
</div>
</body>
</html>