Check{,C,CXX,Fortran,OBJC,OBJCXX}CompilerFlag: Update documentation

- Added intro code blocks showing how to include these modules.
- Used word "command" instead of "macro".
- Added examples sections.
- Updated and synced descriptions of commands and arguments.
- Added a rubric title for variables that affect the checks.
- Listed CMAKE_TRY_COMPILE_TARGET_TYPE variable in the rubric together
  with CMAKE_REQUIRED_* variables.
- Added link to CheckCompilerFlag module in the target_compile_options()
  docs.
- Used lowercase style for check_fortran_compiler_flag() command.
- Added a link to `$<COMPILE_LANGUAGE:languages>` generator expression
  so it can be linked from other pages (See commit
  2e37a20f02 for more info on the initial
  style used).
- Fixed the GENEX_NOTE inclusion (starting with line after the 2nd line)
  where part of the sentence was rendered in the output.
This commit is contained in:
Peter Kokot
2025-05-29 00:16:39 +02:00
parent 9ffbef62ca
commit ac67631b02
13 changed files with 423 additions and 111 deletions

View File

@@ -41,7 +41,8 @@ this command is in a compiler-specific conditional clause:
endif()
To set per-language options, use the :genex:`$<COMPILE_LANGUAGE>`
or :genex:`$<COMPILE_LANGUAGE:languages>` generator expressions.
or :genex:`$<COMPILE_LANGUAGE:languages> <COMPILE_LANGUAGE:languages>`
generator expressions.
See Also
^^^^^^^^

View File

@@ -34,7 +34,7 @@ The named ``<target>`` must have been created by a command such as
.. |more_see_also| replace:: See the :manual:`cmake-compile-features(7)`
manual for information on compile features and a list of supported compilers.
.. include:: include/GENEX_NOTE.rst
:start-line: 1
:start-line: 2
See Also
^^^^^^^^

View File

@@ -69,3 +69,6 @@ See Also
* :variable:`CMAKE_<LANG>_FLAGS` and :variable:`CMAKE_<LANG>_FLAGS_<CONFIG>`
add language-wide flags passed to all invocations of the compiler.
This includes invocations that drive compiling and those that drive linking.
* The :module:`CheckCompilerFlag` module to check whether the compiler
supports a given flag.

View File

@@ -71,7 +71,8 @@ included by absolute path. For example:
)
.. |command_name| replace:: ``target_precompile_headers``
.. |more_see_also| replace:: The :genex:`$<COMPILE_LANGUAGE:...>` generator
.. |more_see_also| replace:: The :genex:`$<COMPILE_LANGUAGE:...>
<COMPILE_LANGUAGE:languages>` generator
expression is particularly useful for specifying a language-specific header
to precompile for only one language (e.g. ``CXX`` and not ``C``). In this
case, header file names that are not explicitly in double quotes or angle
@@ -79,7 +80,7 @@ included by absolute path. For example:
brackets inside a generator expression, be sure to encode the closing
``>`` as :genex:`$<ANGLE-R>`. For example:
.. include:: include/GENEX_NOTE.rst
:start-line: 1
:start-line: 2
.. code-block:: cmake