Datasets:

Modalities:
Image
Text
Formats:
text
Size:
< 1K
Libraries:
Datasets
License:
File size: 11,411 Bytes
1ffdd88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195

<!DOCTYPE html>

<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <title>CMakeFindDependencyMacro &mdash; CMake 3.27.9 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/_sphinx_javascript_frameworks_compat.js"></script>
    <script src="../_static/doctools.js"></script>
    <script src="../_static/sphinx_highlight.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.27.9 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">
            
  <section id="cmakefinddependencymacro">
<span id="module:CMakeFindDependencyMacro"></span><h1>CMakeFindDependencyMacro<a class="headerlink" href="#cmakefinddependencymacro" title="Permalink to this heading"></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>

<section id="package-dependency-search-optimizations">
<h2>Package Dependency Search Optimizations<a class="headerlink" href="#package-dependency-search-optimizations" title="Permalink to this heading"></a></h2>
<p>If <code class="docutils literal notranslate"><span class="pre">find_dependency</span></code> is called with arguments identical to a previous
call in the same directory, perhaps due to diamond-shaped package
dependencies, the underlying call to <span class="target" id="index-4-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> is optimized
out.  This optimization is important to support large package dependency
graphs while avoiding a combinatorial explosion of repeated searches.
However, the heuristic cannot account for ambient variables that
affect package behavior, such as <code class="docutils literal notranslate"><span class="pre">&lt;PackageName&gt;_USE_STATIC_LIBS</span></code>,
offered by some packages.  Therefore package configuration files should
avoid setting such variables before their calls to <code class="docutils literal notranslate"><span class="pre">find_dependency</span></code>.</p>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.15: </span>Previously, the underlying call to <span class="target" id="index-5-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> was always
optimized out if the package had already been found.  CMake 3.15
removed the optimization to support cases in which <code class="docutils literal notranslate"><span class="pre">find_dependency</span></code>
call arguments request different components.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 3.26: </span>The pre-3.15 optimization was restored, but with the above-described
heuristic to account for varying <code class="docutils literal notranslate"><span class="pre">find_dependency</span></code> call arguments.</p>
</div>
</section>
</section>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <div>
    <h3><a href="../index.html">Table of Contents</a></h3>
    <ul>
<li><a class="reference internal" href="#">CMakeFindDependencyMacro</a><ul>
<li><a class="reference internal" href="#package-dependency-search-optimizations">Package Dependency Search Optimizations</a></li>
</ul>
</li>
</ul>

  </div>
  <div>
    <h4>Previous topic</h4>
    <p class="topless"><a href="CMakeDependentOption.html"
                          title="previous chapter">CMakeDependentOption</a></p>
  </div>
  <div>
    <h4>Next topic</h4>
    <p class="topless"><a href="CMakeFindFrameworks.html"
                          title="next chapter">CMakeFindFrameworks</a></p>
  </div>
  <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>document.getElementById('searchbox').style.display = "block"</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.27.9 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-2023 Kitware, Inc. and Contributors.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 5.3.0.
    </div>
  </body>
</html>