cmake/Help/command/enable_language.rst

29 lines
1.0 KiB
ReStructuredText
Raw Normal View History

2014-08-03 19:52:23 +02:00
enable_language
---------------
2022-11-16 20:14:03 +01:00
Enable languages (CXX/C/OBJC/OBJCXX/Fortran/etc)
2014-08-03 19:52:23 +02:00
2019-11-11 23:01:05 +01:00
.. code-block:: cmake
2014-08-03 19:52:23 +02:00
2022-11-16 20:14:03 +01:00
enable_language(<lang>... [OPTIONAL])
2014-08-03 19:52:23 +02:00
2022-11-16 20:14:03 +01:00
Enables support for the named languages in CMake. This is the same as
the :command:`project` command but does not create any of the extra
2024-07-09 14:46:46 +02:00
variables that are created by the :command:`project` command.
2021-09-14 00:13:48 +02:00
2023-05-23 16:38:00 +02:00
.. include:: SUPPORTED_LANGUAGES.txt
2021-09-14 00:13:48 +02:00
2024-07-09 14:46:46 +02:00
The following restrictions apply to where ``enable_language()`` may be called:
* It must be called in file scope, not in a function call.
* It must not be called before the first call to :command:`project`.
See policy :policy:`CMP0165`.
* It must be called in the highest directory common to all targets
using the named language directly for compiling sources or
indirectly through link dependencies. It is simplest to enable all
needed languages in the top-level directory of a project.
2014-08-03 19:52:23 +02:00
2015-11-17 17:22:37 +01:00
The ``OPTIONAL`` keyword is a placeholder for future implementation and
2018-04-23 21:13:27 +02:00
does not currently work. Instead you can use the :module:`CheckLanguage`
module to verify support before enabling.