enable_language.rst 1.0 KB

1234567891011121314151617181920212223242526
  1. enable_language
  2. ---------------
  3. Enable a language (CXX/C/Fortran/etc)
  4. ::
  5. enable_language(<lang> [OPTIONAL] )
  6. This command enables support for the named language in CMake. This is
  7. the same as the project command but does not create any of the extra
  8. variables that are created by the project command. Example languages
  9. are ``CXX``, ``C``, ``CUDA``, ``Fortran``, and ``ASM``.
  10. If enabling ``ASM``, enable it last so that CMake can check whether
  11. compilers for other languages like ``C`` work for assembly too.
  12. This command must be called in file scope, not in a function call.
  13. Furthermore, it must be called in the highest directory common to all
  14. targets using the named language directly for compiling sources or
  15. indirectly through link dependencies. It is simplest to enable all
  16. needed languages in the top-level directory of a project.
  17. The ``OPTIONAL`` keyword is a placeholder for future implementation and
  18. does not currently work. Instead you can use the :module:`CheckLanguage`
  19. module to verify support before enabling.