summaryrefslogtreecommitdiffstats
path: root/Modules/CheckLanguage.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-07-28 19:08:51 (GMT)
committerBrad King <brad.king@kitware.com>2023-07-31 14:45:57 (GMT)
commitcfd92dece3df698e432bb628f15c432142bc662f (patch)
tree5f7cbe8f33679dd40cf38740a9538def5e6280e6 /Modules/CheckLanguage.cmake
parent731fba7751affe2a7c7354e04f4c0082666d05e6 (diff)
downloadCMake-cfd92dece3df698e432bb628f15c432142bc662f.zip
CMake-cfd92dece3df698e432bb628f15c432142bc662f.tar.gz
CMake-cfd92dece3df698e432bb628f15c432142bc662f.tar.bz2
CheckLanguage: Modernize documentation formatting
Diffstat (limited to 'Modules/CheckLanguage.cmake')
-rw-r--r--Modules/CheckLanguage.cmake39
1 files changed, 25 insertions, 14 deletions
diff --git a/Modules/CheckLanguage.cmake b/Modules/CheckLanguage.cmake
index 69913a3..4c49d9a 100644
--- a/Modules/CheckLanguage.cmake
+++ b/Modules/CheckLanguage.cmake
@@ -5,26 +5,37 @@
CheckLanguage
-------------
-Check if a language can be enabled
+Check whether a language can be enabled by the :command:`enable_language`
+or :command:`project` commands:
-Usage:
+.. command:: check_language
-::
+ .. code-block:: cmake
- check_language(<lang>)
+ check_language(<lang>)
-where ``<lang>`` is a language that may be passed to :command:`enable_language`
-such as ``Fortran``. If :variable:`CMAKE_<LANG>_COMPILER` is already defined
-the check does nothing. Otherwise it tries enabling the language in a
-test project. The result is cached in :variable:`CMAKE_<LANG>_COMPILER`
-as the compiler that was found, or ``NOTFOUND`` if the language cannot be
-enabled. For CUDA which can have an explicit host compiler, the cache
-:variable:`CMAKE_CUDA_HOST_COMPILER` variable will be set if it was required
-for compilation (and cleared if it was not).
+ Try enabling language ``<lang>`` in a test project and record results
+ in the cache:
-Example:
+ :variable:`CMAKE_<LANG>_COMPILER`
+ If the language can be enabled, this variable is set to the compiler
+ that was found. If the language cannot be enabled, this variable is
+ set to ``NOTFOUND``.
-::
+ If this variable is already set, either explicitly or cached by
+ a previous call, the check is skipped.
+
+ :variable:`CMAKE_CUDA_HOST_COMPILER`
+ This variable is set when ``<lang>`` is ``CUDA``.
+
+ If the check detects an explicit host compiler that is required for
+ compilation, this variable will be set to that compiler.
+ If the check detects that no explicit host compiler is needed,
+ this variable will be cleared.
+
+For example:
+
+.. code-block:: cmake
check_language(Fortran)
if(CMAKE_Fortran_COMPILER)