blob: 09324055025379625187dfbe526323a9ed7a59c6 [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>CMakeFindDependencyMacro &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="CMakeFindFrameworks" href="CMakeFindFrameworks.html" />
<link rel="prev" title="CMakeDependentOption" href="CMakeDependentOption.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="CMakeFindFrameworks.html" title="CMakeFindFrameworks"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="CMakeDependentOption.html" title="CMakeDependentOption"
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="">CMakeFindDependencyMacro</a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="cmakefinddependencymacro">
<span id="module:CMakeFindDependencyMacro"></span><h1>CMakeFindDependencyMacro<a class="headerlink" href="#cmakefinddependencymacro" title="Permalink to this headline"></a></h1>
<dl class="cmake command">
<dt class="sig sig-object cmake" id="command:find_dependency">
<span class="sig-name descname"><span class="pre">find_dependency</span></span><a class="headerlink" href="#command:find_dependency" title="Permalink to this definition"></a></dt>
<dd><p>The <code class="docutils literal notranslate"><span class="pre">find_dependency()</span></code> macro wraps a <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()</span></code></a> call for
a package dependency:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>find_dependency(&lt;dep&gt; [...])
</pre></div>
</div>
<p>It is designed to be used in a
<a class="reference internal" href="../manual/cmake-packages.7.html#config-file-packages"><span class="std std-ref">Package Configuration File</span></a>
(<code class="docutils literal notranslate"><span class="pre">&lt;PackageName&gt;Config.cmake</span></code>). <code class="docutils literal notranslate"><span class="pre">find_dependency</span></code> forwards the correct
parameters for <code class="docutils literal notranslate"><span class="pre">QUIET</span></code> and <code class="docutils literal notranslate"><span class="pre">REQUIRED</span></code> which were passed to
the original <span class="target" id="index-1-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()</span></code></a> call. Any additional arguments
specified are forwarded to <span class="target" id="index-2-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()</span></code></a>.</p>
<p>If the dependency could not be found it sets an informative diagnostic
message and calls <span class="target" id="index-0-command:return"></span><a class="reference internal" href="../command/return.html#command:return" title="return"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">return()</span></code></a> to end processing of the calling
package configuration file and return to the <span class="target" id="index-3-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()</span></code></a>
command that loaded it.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>The call to <span class="target" id="index-1-command:return"></span><a class="reference internal" href="../command/return.html#command:return" title="return"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">return()</span></code></a> makes this macro unsuitable to call
from <a class="reference internal" href="../manual/cmake-developer.7.html#find-modules"><span class="std std-ref">Find Modules</span></a>.</p>
</div>
</dd></dl>
</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="CMakeDependentOption.html"
title="previous chapter">CMakeDependentOption</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="CMakeFindFrameworks.html"
title="next chapter">CMakeFindFrameworks</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/module/CMakeFindDependencyMacro.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="CMakeFindFrameworks.html" title="CMakeFindFrameworks"
>next</a> |</li>
<li class="right" >
<a href="CMakeDependentOption.html" title="CMakeDependentOption"
>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="">CMakeFindDependencyMacro</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>