enable_language.rst 1.1 KB

1234567891011121314151617181920212223242526272829
  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 :command:`project` command.
  9. .. include:: include/SUPPORTED_LANGUAGES.rst
  10. The following restrictions apply to where ``enable_language()`` may be called:
  11. * It must be called in file scope, not in a :command:`function` call
  12. nor inside a :command:`block()`.
  13. * It must not be called before the first call to :command:`project`.
  14. See policy :policy:`CMP0165`.
  15. * It must be called in the highest directory common to all targets
  16. using the named language directly for compiling sources or
  17. indirectly through link dependencies. It is simplest to enable all
  18. needed languages in the top-level directory of a project.
  19. The ``OPTIONAL`` keyword is a placeholder for future implementation and
  20. does not currently work. Instead you can use the :module:`CheckLanguage`
  21. module to verify support before enabling.