| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| |
| |
| <html xmlns="http://www.w3.org/1999/xhtml"> |
| <head> |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| |
| <title>project — CMake 3.8.2 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"> |
| var DOCUMENTATION_OPTIONS = { |
| URL_ROOT: '../', |
| VERSION: '3.8.2', |
| COLLAPSE_INDEX: false, |
| FILE_SUFFIX: '.html', |
| HAS_SOURCE: true, |
| SOURCELINK_SUFFIX: '.txt' |
| }; |
| </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> |
| <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="qt_wrap_cpp" href="qt_wrap_cpp.html" /> |
| <link rel="prev" title="option" href="option.html" /> |
| </head> |
| <body role="document"> |
| <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="qt_wrap_cpp.html" title="qt_wrap_cpp" |
| accesskey="N">next</a> |</li> |
| <li class="right" > |
| <a href="option.html" title="option" |
| 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.8.2 Documentation</a> » |
| </li> |
| |
| <li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" accesskey="U">cmake-commands(7)</a> »</li> |
| </ul> |
| </div> |
| |
| <div class="document"> |
| <div class="documentwrapper"> |
| <div class="bodywrapper"> |
| <div class="body" role="main"> |
| |
| <div class="section" id="project"> |
| <span id="command:project"></span><h1>project<a class="headerlink" href="#project" title="Permalink to this headline">ΒΆ</a></h1> |
| <p>Set a name, version, and enable languages for the entire project.</p> |
| <div class="highlight-cmake"><div class="highlight"><pre><span></span><span class="nb">project</span><span class="p">(</span><span class="s"><PROJECT-NAME></span> <span class="s">[LANGUAGES]</span> <span class="s">[<language-name>...]</span><span class="p">)</span> |
| <span class="nb">project</span><span class="p">(</span><span class="s"><PROJECT-NAME></span> |
| <span class="s">[VERSION</span> <span class="s"><major>[.<minor>[.<patch>[.<tweak>]]]]</span> |
| <span class="s">[LANGUAGES</span> <span class="s"><language-name>...]</span><span class="p">)</span> |
| </pre></div> |
| </div> |
| <p>Sets the name of the project and stores the name in the |
| <span class="target" id="index-0-variable:PROJECT_NAME"></span><a class="reference internal" href="../variable/PROJECT_NAME.html#variable:PROJECT_NAME" title="PROJECT_NAME"><code class="xref cmake cmake-variable docutils literal"><span class="pre">PROJECT_NAME</span></code></a> variable. Additionally this sets variables</p> |
| <ul class="simple"> |
| <li><span class="target" id="index-0-variable:PROJECT_SOURCE_DIR"></span><a class="reference internal" href="../variable/PROJECT_SOURCE_DIR.html#variable:PROJECT_SOURCE_DIR" title="PROJECT_SOURCE_DIR"><code class="xref cmake cmake-variable docutils literal"><span class="pre">PROJECT_SOURCE_DIR</span></code></a>, |
| <span class="target" id="index-0-variable:<PROJECT-NAME>_SOURCE_DIR"></span><a class="reference internal" href="../variable/PROJECT-NAME_SOURCE_DIR.html#variable:<PROJECT-NAME>_SOURCE_DIR" title="<PROJECT-NAME>_SOURCE_DIR"><code class="xref cmake cmake-variable docutils literal"><span class="pre"><PROJECT-NAME>_SOURCE_DIR</span></code></a></li> |
| <li><span class="target" id="index-0-variable:PROJECT_BINARY_DIR"></span><a class="reference internal" href="../variable/PROJECT_BINARY_DIR.html#variable:PROJECT_BINARY_DIR" title="PROJECT_BINARY_DIR"><code class="xref cmake cmake-variable docutils literal"><span class="pre">PROJECT_BINARY_DIR</span></code></a>, |
| <span class="target" id="index-0-variable:<PROJECT-NAME>_BINARY_DIR"></span><a class="reference internal" href="../variable/PROJECT-NAME_BINARY_DIR.html#variable:<PROJECT-NAME>_BINARY_DIR" title="<PROJECT-NAME>_BINARY_DIR"><code class="xref cmake cmake-variable docutils literal"><span class="pre"><PROJECT-NAME>_BINARY_DIR</span></code></a></li> |
| </ul> |
| <p>If <code class="docutils literal"><span class="pre">VERSION</span></code> is specified, given components must be non-negative integers. |
| If <code class="docutils literal"><span class="pre">VERSION</span></code> is not specified, the default version is the empty string. |
| The <code class="docutils literal"><span class="pre">VERSION</span></code> option may not be used unless policy <span class="target" id="index-0-policy:CMP0048"></span><a class="reference internal" href="../policy/CMP0048.html#policy:CMP0048" title="CMP0048"><code class="xref cmake cmake-policy docutils literal"><span class="pre">CMP0048</span></code></a> is |
| set to <code class="docutils literal"><span class="pre">NEW</span></code>.</p> |
| <p>The <span class="target" id="index-0-command:project"></span><a class="reference internal" href="#command:project" title="project"><code class="xref cmake cmake-command docutils literal"><span class="pre">project()</span></code></a> command stores the version number and its components |
| in variables</p> |
| <ul class="simple"> |
| <li><span class="target" id="index-0-variable:PROJECT_VERSION"></span><a class="reference internal" href="../variable/PROJECT_VERSION.html#variable:PROJECT_VERSION" title="PROJECT_VERSION"><code class="xref cmake cmake-variable docutils literal"><span class="pre">PROJECT_VERSION</span></code></a>, |
| <span class="target" id="index-0-variable:<PROJECT-NAME>_VERSION"></span><a class="reference internal" href="../variable/PROJECT-NAME_VERSION.html#variable:<PROJECT-NAME>_VERSION" title="<PROJECT-NAME>_VERSION"><code class="xref cmake cmake-variable docutils literal"><span class="pre"><PROJECT-NAME>_VERSION</span></code></a></li> |
| <li><span class="target" id="index-0-variable:PROJECT_VERSION_MAJOR"></span><a class="reference internal" href="../variable/PROJECT_VERSION_MAJOR.html#variable:PROJECT_VERSION_MAJOR" title="PROJECT_VERSION_MAJOR"><code class="xref cmake cmake-variable docutils literal"><span class="pre">PROJECT_VERSION_MAJOR</span></code></a>, |
| <span class="target" id="index-0-variable:<PROJECT-NAME>_VERSION_MAJOR"></span><a class="reference internal" href="../variable/PROJECT-NAME_VERSION_MAJOR.html#variable:<PROJECT-NAME>_VERSION_MAJOR" title="<PROJECT-NAME>_VERSION_MAJOR"><code class="xref cmake cmake-variable docutils literal"><span class="pre"><PROJECT-NAME>_VERSION_MAJOR</span></code></a></li> |
| <li><span class="target" id="index-0-variable:PROJECT_VERSION_MINOR"></span><a class="reference internal" href="../variable/PROJECT_VERSION_MINOR.html#variable:PROJECT_VERSION_MINOR" title="PROJECT_VERSION_MINOR"><code class="xref cmake cmake-variable docutils literal"><span class="pre">PROJECT_VERSION_MINOR</span></code></a>, |
| <span class="target" id="index-0-variable:<PROJECT-NAME>_VERSION_MINOR"></span><a class="reference internal" href="../variable/PROJECT-NAME_VERSION_MINOR.html#variable:<PROJECT-NAME>_VERSION_MINOR" title="<PROJECT-NAME>_VERSION_MINOR"><code class="xref cmake cmake-variable docutils literal"><span class="pre"><PROJECT-NAME>_VERSION_MINOR</span></code></a></li> |
| <li><span class="target" id="index-0-variable:PROJECT_VERSION_PATCH"></span><a class="reference internal" href="../variable/PROJECT_VERSION_PATCH.html#variable:PROJECT_VERSION_PATCH" title="PROJECT_VERSION_PATCH"><code class="xref cmake cmake-variable docutils literal"><span class="pre">PROJECT_VERSION_PATCH</span></code></a>, |
| <span class="target" id="index-0-variable:<PROJECT-NAME>_VERSION_PATCH"></span><a class="reference internal" href="../variable/PROJECT-NAME_VERSION_PATCH.html#variable:<PROJECT-NAME>_VERSION_PATCH" title="<PROJECT-NAME>_VERSION_PATCH"><code class="xref cmake cmake-variable docutils literal"><span class="pre"><PROJECT-NAME>_VERSION_PATCH</span></code></a></li> |
| <li><span class="target" id="index-0-variable:PROJECT_VERSION_TWEAK"></span><a class="reference internal" href="../variable/PROJECT_VERSION_TWEAK.html#variable:PROJECT_VERSION_TWEAK" title="PROJECT_VERSION_TWEAK"><code class="xref cmake cmake-variable docutils literal"><span class="pre">PROJECT_VERSION_TWEAK</span></code></a>, |
| <span class="target" id="index-0-variable:<PROJECT-NAME>_VERSION_TWEAK"></span><a class="reference internal" href="../variable/PROJECT-NAME_VERSION_TWEAK.html#variable:<PROJECT-NAME>_VERSION_TWEAK" title="<PROJECT-NAME>_VERSION_TWEAK"><code class="xref cmake cmake-variable docutils literal"><span class="pre"><PROJECT-NAME>_VERSION_TWEAK</span></code></a></li> |
| </ul> |
| <p>Variables corresponding to unspecified versions are set to the empty string |
| (if policy <span class="target" id="index-1-policy:CMP0048"></span><a class="reference internal" href="../policy/CMP0048.html#policy:CMP0048" title="CMP0048"><code class="xref cmake cmake-policy docutils literal"><span class="pre">CMP0048</span></code></a> is set to <code class="docutils literal"><span class="pre">NEW</span></code>).</p> |
| <p>Optionally you can specify which languages your project supports. |
| Example languages are <code class="docutils literal"><span class="pre">C</span></code>, <code class="docutils literal"><span class="pre">CXX</span></code> (i.e. C++), <code class="docutils literal"><span class="pre">Fortran</span></code>, etc. |
| By default <code class="docutils literal"><span class="pre">C</span></code> and <code class="docutils literal"><span class="pre">CXX</span></code> are enabled if no language options are |
| given. Specify language <code class="docutils literal"><span class="pre">NONE</span></code>, or use the <code class="docutils literal"><span class="pre">LANGUAGES</span></code> keyword |
| and list no languages, to skip enabling any languages.</p> |
| <p>If a variable exists called <span class="target" id="index-0-variable:CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE"></span><a class="reference internal" href="../variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE.html#variable:CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE" title="CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE"><code class="xref cmake cmake-variable docutils literal"><span class="pre">CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE</span></code></a>, |
| the file pointed to by that variable will be included as the last step of the |
| project command.</p> |
| <p>The top-level <code class="docutils literal"><span class="pre">CMakeLists.txt</span></code> file for a project must contain a |
| literal, direct call to the <span class="target" id="index-1-command:project"></span><a class="reference internal" href="#command:project" title="project"><code class="xref cmake cmake-command docutils literal"><span class="pre">project()</span></code></a> command; loading one |
| through the <span class="target" id="index-0-command:include"></span><a class="reference internal" href="include.html#command:include" title="include"><code class="xref cmake cmake-command docutils literal"><span class="pre">include()</span></code></a> command is not sufficient. If no such |
| call exists CMake will implicitly add one to the top that enables the |
| default languages (<code class="docutils literal"><span class="pre">C</span></code> and <code class="docutils literal"><span class="pre">CXX</span></code>).</p> |
| <div class="admonition note"> |
| <p class="first admonition-title">Note</p> |
| <p class="last">Call the <span class="target" id="index-0-command:cmake_minimum_required"></span><a class="reference internal" href="cmake_minimum_required.html#command:cmake_minimum_required" title="cmake_minimum_required"><code class="xref cmake cmake-command docutils literal"><span class="pre">cmake_minimum_required()</span></code></a> command at the beginning |
| of the top-level <code class="docutils literal"><span class="pre">CMakeLists.txt</span></code> file even before calling the |
| <code class="docutils literal"><span class="pre">project()</span></code> command. It is important to establish version and |
| policy settings before invoking other commands whose behavior they |
| may affect. See also policy <span class="target" id="index-0-policy:CMP0000"></span><a class="reference internal" href="../policy/CMP0000.html#policy:CMP0000" title="CMP0000"><code class="xref cmake cmake-policy docutils literal"><span class="pre">CMP0000</span></code></a>.</p> |
| </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="option.html" |
| title="previous chapter">option</a></p> |
| <h4>Next topic</h4> |
| <p class="topless"><a href="qt_wrap_cpp.html" |
| title="next chapter">qt_wrap_cpp</a></p> |
| <div role="note" aria-label="source link"> |
| <h3>This Page</h3> |
| <ul class="this-page-menu"> |
| <li><a href="../_sources/command/project.rst.txt" |
| rel="nofollow">Show Source</a></li> |
| </ul> |
| </div> |
| <div id="searchbox" style="display: none" role="search"> |
| <h3>Quick search</h3> |
| <form class="search" action="../search.html" method="get"> |
| <div><input type="text" name="q" /></div> |
| <div><input type="submit" value="Go" /></div> |
| <input type="hidden" name="check_keywords" value="yes" /> |
| <input type="hidden" name="area" value="default" /> |
| </form> |
| </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="qt_wrap_cpp.html" title="qt_wrap_cpp" |
| >next</a> |</li> |
| <li class="right" > |
| <a href="option.html" title="option" |
| >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.8.2 Documentation</a> » |
| </li> |
| |
| <li class="nav-item nav-item-1"><a href="../manual/cmake-commands.7.html" >cmake-commands(7)</a> »</li> |
| </ul> |
| </div> |
| <div class="footer" role="contentinfo"> |
| © Copyright 2000-2017 Kitware, Inc. and Contributors. |
| Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.5.2. |
| </div> |
| </body> |
| </html> |