project.rst 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. project
  2. -------
  3. Set a name and enable languages for the entire project.
  4. .. code-block:: cmake
  5. project(<PROJECT-NAME> [LANGUAGES] [<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``, or use the ``LANGUAGES`` keyword
  16. and list no languages, to skip enabling any languages.
  17. If a variable exists called :variable:`CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE`,
  18. the file pointed to by that variable will be included as the last step of the
  19. project command.
  20. The top-level ``CMakeLists.txt`` file for a project must contain a
  21. literal, direct call to the :command:`project` command; loading one
  22. through the :command:`include` command is not sufficient. If no such
  23. call exists CMake will implicitly add one to the top that enables the
  24. default languages (``C`` and ``CXX``).