| <!DOCTYPE html> | |
| <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <title>GetPrerequisites — CMake 3.23.1 Documentation</title> | |
| <link rel="stylesheet" href="../_static/cmake.css" type="text/css" /> | |
| <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> | |
| <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script> | |
| <script type="text/javascript" src="../_static/jquery.js"></script> | |
| <script type="text/javascript" src="../_static/underscore.js"></script> | |
| <script type="text/javascript" src="../_static/doctools.js"></script> | |
| <script type="text/javascript" src="../_static/language_data.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="GNUInstallDirs" href="GNUInstallDirs.html" /> | |
| <link rel="prev" title="GenerateExportHeader" href="GenerateExportHeader.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="GNUInstallDirs.html" title="GNUInstallDirs" | |
| accesskey="N">next</a> |</li> | |
| <li class="right" > | |
| <a href="GenerateExportHeader.html" title="GenerateExportHeader" | |
| 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-modules.7.html" accesskey="U">cmake-modules(7)</a> »</li> | |
| </ul> | |
| </div> | |
| <div class="document"> | |
| <div class="documentwrapper"> | |
| <div class="bodywrapper"> | |
| <div class="body" role="main"> | |
| <div class="section" id="getprerequisites"> | |
| <span id="module:GetPrerequisites"></span><h1>GetPrerequisites<a class="headerlink" href="#getprerequisites" title="Permalink to this headline">ΒΆ</a></h1> | |
| <div class="deprecated"> | |
| <p><span class="versionmodified deprecated">Deprecated since version 3.16: </span>Use <span class="target" id="index-0-command:file"></span><a class="reference internal" href="../command/file.html#command:file" title="file"><code class="xref cmake cmake-command docutils literal notranslate"><span class="pre">file(GET_RUNTIME_DEPENDENCIES)</span></code></a> instead.</p> | |
| </div> | |
| <p>Functions to analyze and list executable file prerequisites.</p> | |
| <p>This module provides functions to list the .dll, .dylib or .so files | |
| that an executable or shared library file depends on. (Its | |
| prerequisites.)</p> | |
| <p>It uses various tools to obtain the list of required shared library | |
| files:</p> | |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>dumpbin (Windows) | |
| objdump (MinGW on Windows) | |
| ldd (Linux/Unix) | |
| otool (Mac OSX) | |
| </pre></div> | |
| </div> | |
| <div class="versionchanged"> | |
| <p><span class="versionmodified changed">Changed in version 3.16: </span>The tool specified by <code class="docutils literal notranslate"><span class="pre">CMAKE_OBJDUMP</span></code> will be used, if set.</p> | |
| </div> | |
| <p>The following functions are provided by this module:</p> | |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>get_prerequisites | |
| list_prerequisites | |
| list_prerequisites_by_glob | |
| gp_append_unique | |
| is_file_executable | |
| gp_item_default_embedded_path | |
| (projects can override with gp_item_default_embedded_path_override) | |
| gp_resolve_item | |
| (projects can override with gp_resolve_item_override) | |
| gp_resolved_file_type | |
| (projects can override with gp_resolved_file_type_override) | |
| gp_file_type | |
| </pre></div> | |
| </div> | |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>GET_PREREQUISITES(<target> <prerequisites_var> <exclude_system> <recurse> | |
| <exepath> <dirs> [<rpaths>]) | |
| </pre></div> | |
| </div> | |
| <p>Get the list of shared library files required by <target>. The list | |
| in the variable named <prerequisites_var> should be empty on first | |
| entry to this function. On exit, <prerequisites_var> will contain the | |
| list of required shared library files.</p> | |
| <p><target> is the full path to an executable file. <prerequisites_var> | |
| is the name of a CMake variable to contain the results. | |
| <exclude_system> must be 0 or 1 indicating whether to include or | |
| exclude "system" prerequisites. If <recurse> is set to 1 all | |
| prerequisites will be found recursively, if set to 0 only direct | |
| prerequisites are listed. <exepath> is the path to the top level | |
| executable used for @executable_path replacement on the Mac. <dirs> is | |
| a list of paths where libraries might be found: these paths are | |
| searched first when a target without any path info is given. Then | |
| standard system locations are also searched: PATH, Framework | |
| locations, /usr/lib...</p> | |
| <div class="versionadded"> | |
| <p><span class="versionmodified added">New in version 3.14: </span>The variable GET_PREREQUISITES_VERBOSE can be set to true to enable verbose | |
| output.</p> | |
| </div> | |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>LIST_PREREQUISITES(<target> [<recurse> [<exclude_system> [<verbose>]]]) | |
| </pre></div> | |
| </div> | |
| <p>Print a message listing the prerequisites of <target>.</p> | |
| <p><target> is the name of a shared library or executable target or the | |
| full path to a shared library or executable file. If <recurse> is set | |
| to 1 all prerequisites will be found recursively, if set to 0 only | |
| direct prerequisites are listed. <exclude_system> must be 0 or 1 | |
| indicating whether to include or exclude "system" prerequisites. With | |
| <verbose> set to 0 only the full path names of the prerequisites are | |
| printed, set to 1 extra information will be displayed.</p> | |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>LIST_PREREQUISITES_BY_GLOB(<glob_arg> <glob_exp>) | |
| </pre></div> | |
| </div> | |
| <p>Print the prerequisites of shared library and executable files | |
| matching a globbing pattern. <glob_arg> is GLOB or GLOB_RECURSE and | |
| <glob_exp> is a globbing expression used with "file(GLOB" or | |
| "file(GLOB_RECURSE" to retrieve a list of matching files. If a | |
| matching file is executable, its prerequisites are listed.</p> | |
| <p>Any additional (optional) arguments provided are passed along as the | |
| optional arguments to the list_prerequisites calls.</p> | |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>GP_APPEND_UNIQUE(<list_var> <value>) | |
| </pre></div> | |
| </div> | |
| <p>Append <value> to the list variable <list_var> only if the value is | |
| not already in the list.</p> | |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>IS_FILE_EXECUTABLE(<file> <result_var>) | |
| </pre></div> | |
| </div> | |
| <p>Return 1 in <result_var> if <file> is a binary executable, 0 | |
| otherwise.</p> | |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>GP_ITEM_DEFAULT_EMBEDDED_PATH(<item> <default_embedded_path_var>) | |
| </pre></div> | |
| </div> | |
| <p>Return the path that others should refer to the item by when the item | |
| is embedded inside a bundle.</p> | |
| <p>Override on a per-project basis by providing a project-specific | |
| gp_item_default_embedded_path_override function.</p> | |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>GP_RESOLVE_ITEM(<context> <item> <exepath> <dirs> <resolved_item_var> | |
| [<rpaths>]) | |
| </pre></div> | |
| </div> | |
| <p>Resolve an item into an existing full path file.</p> | |
| <p>Override on a per-project basis by providing a project-specific | |
| gp_resolve_item_override function.</p> | |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>GP_RESOLVED_FILE_TYPE(<original_file> <file> <exepath> <dirs> <type_var> | |
| [<rpaths>]) | |
| </pre></div> | |
| </div> | |
| <p>Return the type of <file> with respect to <original_file>. String | |
| describing type of prerequisite is returned in variable named | |
| <type_var>.</p> | |
| <p>Use <exepath> and <dirs> if necessary to resolve non-absolute <file> | |
| values -- but only for non-embedded items.</p> | |
| <p>Possible types are:</p> | |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>system | |
| local | |
| embedded | |
| other | |
| </pre></div> | |
| </div> | |
| <p>Override on a per-project basis by providing a project-specific | |
| gp_resolved_file_type_override function.</p> | |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>GP_FILE_TYPE(<original_file> <file> <type_var>) | |
| </pre></div> | |
| </div> | |
| <p>Return the type of <file> with respect to <original_file>. String | |
| describing type of prerequisite is returned in variable named | |
| <type_var>.</p> | |
| <p>Possible types are:</p> | |
| <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>system | |
| local | |
| embedded | |
| other | |
| </pre></div> | |
| </div> | |
| </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="GenerateExportHeader.html" | |
| title="previous chapter">GenerateExportHeader</a></p> | |
| <h4>Next topic</h4> | |
| <p class="topless"><a href="GNUInstallDirs.html" | |
| title="next chapter">GNUInstallDirs</a></p> | |
| <div role="note" aria-label="source link"> | |
| <h3>This Page</h3> | |
| <ul class="this-page-menu"> | |
| <li><a href="../_sources/module/GetPrerequisites.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" /> | |
| <input type="submit" value="Go" /> | |
| </form> | |
| </div> | |
| </div> | |
| <script type="text/javascript">$('#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="GNUInstallDirs.html" title="GNUInstallDirs" | |
| >next</a> |</li> | |
| <li class="right" > | |
| <a href="GenerateExportHeader.html" title="GenerateExportHeader" | |
| >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-modules.7.html" >cmake-modules(7)</a> »</li> | |
| </ul> | |
| </div> | |
| <div class="footer" role="contentinfo"> | |
| © Copyright 2000-2022 Kitware, Inc. and Contributors. | |
| Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.1.2. | |
| </div> | |
| </body> | |
| </html> |