From 3f102a2ae3900b1e21eb91ac6b77be1140a762cb Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Thu, 15 May 2025 07:13:33 +0200 Subject: [PATCH] CheckLanguage: Add intro code block - Added intro code block showing how to include this module. - Used "command" instead of "macro". --- Modules/CheckLanguage.cmake | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/Modules/CheckLanguage.cmake b/Modules/CheckLanguage.cmake index ac61d7019c..1fe9bc4d47 100644 --- a/Modules/CheckLanguage.cmake +++ b/Modules/CheckLanguage.cmake @@ -5,17 +5,32 @@ CheckLanguage ------------- -This module provides the ``check_language()`` macro to check whether a language -can be enabled using the :command:`enable_language` or :command:`project` -commands. +This module provides a command to check whether a language can be enabled +using the :command:`enable_language` or :command:`project` commands. + +Load this module in a CMake project with: + +.. code-block:: cmake + + include(CheckLanguage) + +This module is useful when a project does not always require a specific +language but may need to enable it for certain parts. + +Commands +^^^^^^^^ + +This module provides the following command: .. command:: check_language + Checks whether a language can be enabled in a CMake project: + .. code-block:: cmake check_language() - This macro attempts to enable the language ```` in a test project and + This command attempts to enable the language ```` in a test project and records the results in the following cache variables: :variable:`CMAKE__COMPILER` @@ -51,9 +66,8 @@ commands. Examples ^^^^^^^^ -This module is useful when a project does not always require a specific language -but may need to enable it for certain parts. The following example checks for -the availability of the ``Fortran`` language and enables it if possible: +The following example checks for the availability of the ``Fortran`` language +and enables it if possible: .. code-block:: cmake