enable_language.rst 1.1 KB

12345678910111213141516171819202122232425262728
  1. enable_language
  2. ---------------
  3. Enable languages (CXX/C/OBJC/OBJCXX/Fortran/etc)
  4. .. code-block:: cmake
  5. enable_language(<lang>... [OPTIONAL])
  6. Enables support for the named languages in CMake. This is the same as
  7. the :command:`project` command but does not create any of the extra
  8. variables that are created by the project command.
  9. .. include:: SUPPORTED_LANGUAGES.txt
  10. By default ``C`` and ``CXX`` are enabled if no language options are given.
  11. Specify language ``NONE``, or use the ``LANGUAGES`` keyword and list no languages,
  12. to skip enabling any languages.
  13. This command must be called in file scope, not in a function call.
  14. Furthermore, it must be called in the highest directory common to all
  15. targets using the named language directly for compiling sources or
  16. indirectly through link dependencies. It is simplest to enable all
  17. needed languages in the top-level directory of a project.
  18. The ``OPTIONAL`` keyword is a placeholder for future implementation and
  19. does not currently work. Instead you can use the :module:`CheckLanguage`
  20. module to verify support before enabling.