| |
| <!DOCTYPE html> |
| |
| <html lang="en"> |
| <head> |
| <meta charset="utf-8" /> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
| <title>OPTIMIZE_DEPENDENCIES — 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="OSX_ARCHITECTURES" href="OSX_ARCHITECTURES.html" /> |
| <link rel="prev" title="OBJCXX_STANDARD_REQUIRED" href="OBJCXX_STANDARD_REQUIRED.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="OSX_ARCHITECTURES.html" title="OSX_ARCHITECTURES" |
| accesskey="N">next</a> |</li> |
| <li class="right" > |
| <a href="OBJCXX_STANDARD_REQUIRED.html" title="OBJCXX_STANDARD_REQUIRED" |
| 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> » |
| </li> |
| <li> |
| <a href="../index.html">3.23.1 Documentation</a> » |
| </li> |
| |
| <li class="nav-item nav-item-1"><a href="../manual/cmake-properties.7.html" accesskey="U">cmake-properties(7)</a> »</li> |
| <li class="nav-item nav-item-this"><a href="">OPTIMIZE_DEPENDENCIES</a></li> |
| </ul> |
| </div> |
| |
| <div class="document"> |
| <div class="documentwrapper"> |
| <div class="bodywrapper"> |
| <div class="body" role="main"> |
| |
| <div class="section" id="optimize-dependencies"> |
| <span id="prop_tgt:OPTIMIZE_DEPENDENCIES"></span><h1>OPTIMIZE_DEPENDENCIES<a class="headerlink" href="#optimize-dependencies" title="Permalink to this headline">ΒΆ</a></h1> |
| <div class="versionadded"> |
| <p><span class="versionmodified added">New in version 3.19.</span></p> |
| </div> |
| <p>Activates dependency optimization of static and object libraries.</p> |
| <p>When this property is set to true, some dependencies for a static or object |
| library may be removed at generation time if they are not necessary to build |
| the library, since static and object libraries don't actually link against |
| anything.</p> |
| <p>If a static or object library has dependency optimization enabled, it first |
| discards all dependencies. Then, it looks through all of the direct and |
| indirect dependencies that it initially had, and adds them back if they meet |
| any of the following criteria:</p> |
| <ul class="simple"> |
| <li><p>The dependency was added to the library by <span class="target" id="index-0-command:add_dependencies"></span><a class="reference internal" href="../command/add_dependencies.html#command:add_dependencies" title="add_dependencies"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">add_dependencies()</span></code></a>.</p></li> |
| <li><p>The dependency was added to the library through a source file in the library |
| generated by a custom command that uses the dependency.</p></li> |
| <li><p>The dependency has any <code class="docutils literal notranslate"><span class="pre">PRE_BUILD</span></code>, <code class="docutils literal notranslate"><span class="pre">PRE_LINK</span></code>, or <code class="docutils literal notranslate"><span class="pre">POST_BUILD</span></code> custom |
| commands associated with it.</p></li> |
| <li><p>The dependency contains any source files that were generated by a custom |
| command.</p></li> |
| <li><p>The dependency contains any languages which produce side effects that are |
| relevant to the library. Currently, all languages except C, C++, Objective-C, |
| Objective-C++, assembly, and CUDA are assumed to produce side effects. |
| However, side effects from one language are assumed not to be relevant to |
| another (for example, a Fortran library is assumed to not have any side |
| effects that are relevant for a Swift library.)</p></li> |
| </ul> |
| <p>As an example, assume you have a static Fortran library which depends on a |
| static C library, which in turn depends on a static Fortran library. The |
| top-level Fortran library has optimization enabled, but the middle C library |
| does not. If you build the top Fortran library, the bottom Fortran library will |
| also build, but not the middle C library, since the C library does not have any |
| side effects that are relevant for the Fortran library. However, if you build |
| the middle C library, the bottom Fortran library will also build, even though |
| it does not have any side effects that are relevant to the C library, since the |
| C library does not have optimization enabled.</p> |
| <p>This property is initialized by the value of the |
| <span class="target" id="index-0-variable:CMAKE_OPTIMIZE_DEPENDENCIES"></span><a class="reference internal" href="../variable/CMAKE_OPTIMIZE_DEPENDENCIES.html#variable:CMAKE_OPTIMIZE_DEPENDENCIES" title="CMAKE_OPTIMIZE_DEPENDENCIES"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_OPTIMIZE_DEPENDENCIES</span></code></a> variable when the target is created.</p> |
| </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="OBJCXX_STANDARD_REQUIRED.html" |
| title="previous chapter">OBJCXX_STANDARD_REQUIRED</a></p> |
| <h4>Next topic</h4> |
| <p class="topless"><a href="OSX_ARCHITECTURES.html" |
| title="next chapter">OSX_ARCHITECTURES</a></p> |
| <div role="note" aria-label="source link"> |
| <h3>This Page</h3> |
| <ul class="this-page-menu"> |
| <li><a href="../_sources/prop_tgt/OPTIMIZE_DEPENDENCIES.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="OSX_ARCHITECTURES.html" title="OSX_ARCHITECTURES" |
| >next</a> |</li> |
| <li class="right" > |
| <a href="OBJCXX_STANDARD_REQUIRED.html" title="OBJCXX_STANDARD_REQUIRED" |
| >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> » |
| </li> |
| <li> |
| <a href="../index.html">3.23.1 Documentation</a> » |
| </li> |
| |
| <li class="nav-item nav-item-1"><a href="../manual/cmake-properties.7.html" >cmake-properties(7)</a> »</li> |
| <li class="nav-item nav-item-this"><a href="">OPTIMIZE_DEPENDENCIES</a></li> |
| </ul> |
| </div> |
| |
| <div class="footer" role="contentinfo"> |
| © Copyright 2000-2022 Kitware, Inc. and Contributors. |
| Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.1.2. |
| </div> |
| </body> |
| </html> |