project.rst 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. project
  2. -------
  3. Set a name and enable languages for the entire project.
  4. .. code-block:: cmake
  5. project(<PROJECT-NAME> [<language-name>...])
  6. Sets the name of the project and stores the name in the
  7. :variable:`PROJECT_NAME` variable. Additionally this sets variables
  8. * :variable:`PROJECT_SOURCE_DIR`,
  9. :variable:`<PROJECT-NAME>_SOURCE_DIR`
  10. * :variable:`PROJECT_BINARY_DIR`,
  11. :variable:`<PROJECT-NAME>_BINARY_DIR`
  12. Optionally you can specify which languages your project supports.
  13. Example languages are ``C``, ``CXX`` (i.e. C++), ``Fortran``, etc.
  14. By default ``C`` and ``CXX`` are enabled if no language options are
  15. given. Specify language ``NONE`` to skip enabling any languages.
  16. If a variable exists called :variable:`CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE`,
  17. the file pointed to by that variable will be included as the last step of the
  18. project command.
  19. The top-level ``CMakeLists.txt`` file for a project must contain a
  20. literal, direct call to the :command:`project` command; loading one
  21. through the :command:`include` command is not sufficient. If no such
  22. call exists CMake will implicitly add one to the top that enables the
  23. default languages (``C`` and ``CXX``).