1
0
Эх сурвалжийг харах

Merge topic 'doc_varreq'

9e1b30121f Help:toolchain: refer to CheckSourceCompiles
cf48022dc5 Help:Check*: include CMAKE_REQUIRED_* vars to dedupe

Acked-by: Kitware Robot <[email protected]>
Merge-request: !8300
Brad King 2 жил өмнө
parent
commit
5f74e19abb
36 өөрчлөгдсөн 490 нэмэгдсэн , 705 устгасан
  1. 1 1
      Help/manual/cmake-toolchains.7.rst
  2. 4 0
      Help/module/CMAKE_REQUIRED_DEFINITIONS.txt
  3. 6 0
      Help/module/CMAKE_REQUIRED_FLAGS.txt
  4. 4 0
      Help/module/CMAKE_REQUIRED_INCLUDES.txt
  5. 5 0
      Help/module/CMAKE_REQUIRED_LIBRARIES.txt
  6. 5 0
      Help/module/CMAKE_REQUIRED_LINK_OPTIONS.txt
  7. 5 0
      Help/module/CMAKE_REQUIRED_QUIET.txt
  8. 23 11
      Modules/CheckCCompilerFlag.cmake
  9. 19 43
      Modules/CheckCSourceCompiles.cmake
  10. 19 43
      Modules/CheckCSourceRuns.cmake
  11. 0 5
      Modules/CheckCXXCompilerFlag.cmake
  12. 19 43
      Modules/CheckCXXSourceCompiles.cmake
  13. 19 43
      Modules/CheckCXXSourceRuns.cmake
  14. 11 16
      Modules/CheckCXXSymbolExists.cmake
  15. 23 11
      Modules/CheckCompilerFlag.cmake
  16. 23 11
      Modules/CheckFortranCompilerFlag.cmake
  17. 19 41
      Modules/CheckFortranSourceCompiles.cmake
  18. 19 39
      Modules/CheckFortranSourceRuns.cmake
  19. 11 16
      Modules/CheckFunctionExists.cmake
  20. 11 16
      Modules/CheckIncludeFile.cmake
  21. 11 16
      Modules/CheckIncludeFileCXX.cmake
  22. 11 16
      Modules/CheckIncludeFiles.cmake
  23. 10 12
      Modules/CheckLibraryExists.cmake
  24. 23 11
      Modules/CheckOBJCCompilerFlag.cmake
  25. 19 39
      Modules/CheckOBJCSourceCompiles.cmake
  26. 19 39
      Modules/CheckOBJCSourceRuns.cmake
  27. 23 11
      Modules/CheckOBJCXXCompilerFlag.cmake
  28. 19 39
      Modules/CheckOBJCXXSourceCompiles.cmake
  29. 19 39
      Modules/CheckOBJCXXSourceRuns.cmake
  30. 12 14
      Modules/CheckPrototypeDefinition.cmake
  31. 15 35
      Modules/CheckSourceCompiles.cmake
  32. 19 39
      Modules/CheckSourceRuns.cmake
  33. 11 14
      Modules/CheckStructHasMember.cmake
  34. 11 16
      Modules/CheckSymbolExists.cmake
  35. 12 14
      Modules/CheckTypeSize.cmake
  36. 10 12
      Modules/CheckVariableExists.cmake

+ 1 - 1
Help/manual/cmake-toolchains.7.rst

@@ -84,7 +84,7 @@ Toolchain Features
 ==================
 
 CMake provides the :command:`try_compile` command and wrapper macros such as
-:module:`CheckCXXSourceCompiles`, :module:`CheckCXXSymbolExists` and
+:module:`CheckSourceCompiles`, :module:`CheckCXXSymbolExists` and
 :module:`CheckIncludeFile` to test capability and availability of various
 toolchain features. These APIs test the toolchain in some way and cache the
 result so that the test does not have to be performed again the next time

+ 4 - 0
Help/module/CMAKE_REQUIRED_DEFINITIONS.txt

@@ -0,0 +1,4 @@
+  ``CMAKE_REQUIRED_DEFINITIONS``
+    A :ref:`;-list <CMake Language Lists>` of compiler definitions of the form
+    ``-DFOO`` or ``-DFOO=bar``. A definition for the name specified by
+    ``<resultVar>`` will also be added automatically.

+ 6 - 0
Help/module/CMAKE_REQUIRED_FLAGS.txt

@@ -0,0 +1,6 @@
+  ``CMAKE_REQUIRED_FLAGS``
+    String of additional flags to pass to the compiler. The string must be
+    space-delimited--a :ref:`;-list <CMake Language Lists>` will not work.
+    The contents of :variable:`CMAKE_<LANG>_FLAGS <CMAKE_<LANG>_FLAGS>` and
+    its associated configuration-specific variable are automatically added
+    to the compiler command before the contents of ``CMAKE_REQUIRED_FLAGS``.

+ 4 - 0
Help/module/CMAKE_REQUIRED_INCLUDES.txt

@@ -0,0 +1,4 @@
+  ``CMAKE_REQUIRED_INCLUDES``
+    A :ref:`;-list <CMake Language Lists>` of header search paths to pass to
+    the compiler. These will be the only header search paths used--the contents
+    of the :prop_dir:`INCLUDE_DIRECTORIES` directory property will be ignored.

+ 5 - 0
Help/module/CMAKE_REQUIRED_LIBRARIES.txt

@@ -0,0 +1,5 @@
+  ``CMAKE_REQUIRED_LIBRARIES``
+    A :ref:`;-list <CMake Language Lists>` of libraries to add to the link
+    command. These can be the name of system libraries or they can be
+    :ref:`Imported Targets <Imported Targets>` (see :command:`try_compile` for
+    further details).

+ 5 - 0
Help/module/CMAKE_REQUIRED_LINK_OPTIONS.txt

@@ -0,0 +1,5 @@
+  ``CMAKE_REQUIRED_LINK_OPTIONS``
+    .. versionadded:: 3.14
+
+    A :ref:`;-list <CMake Language Lists>` of options to add to the link
+    command (see :command:`try_compile` for further details).

+ 5 - 0
Help/module/CMAKE_REQUIRED_QUIET.txt

@@ -0,0 +1,5 @@
+  ``CMAKE_REQUIRED_QUIET``
+    .. versionadded:: 3.1
+
+    If this variable evaluates to a boolean true value, all status messages
+    associated with the check will be suppressed.

+ 23 - 11
Modules/CheckCCompilerFlag.cmake

@@ -11,25 +11,37 @@ Check whether the C compiler supports a given flag.
 
   .. code-block:: cmake
 
-    check_c_compiler_flag(<flag> <var>)
+    check_c_compiler_flag(<flag> <resultVar>)
 
   Check that the ``<flag>`` is accepted by the compiler without
   a diagnostic.  Stores the result in an internal cache entry
-  named ``<var>``.
-
-This command temporarily sets the ``CMAKE_REQUIRED_DEFINITIONS`` variable
-and calls the ``check_c_source_compiles`` macro from the
-:module:`CheckCSourceCompiles` module.  See documentation of that
-module for a listing of variables that can otherwise modify the build.
+  named ``<resultVar>``.
 
 A positive result from this check indicates only that the compiler did not
 issue a diagnostic message when given the flag.  Whether the flag has any
 effect or even a specific one is beyond the scope of this module.
 
-.. note::
-  Since the :command:`try_compile` command forwards flags from variables
-  like :variable:`CMAKE_C_FLAGS <CMAKE_<LANG>_FLAGS>`, unknown flags
-  in such variables may cause a false negative for this check.
+The check is only performed once, with the result cached in the variable named
+by ``<resultVar>``. Every subsequent CMake run will re-use this cached value
+rather than performing the check again, even if the ``<code>`` changes. In
+order to force the check to be re-evaluated, the variable named by
+``<resultVar>`` must be manually removed from the cache.
+
+The compile and link commands can be influenced by setting any of the
+following variables prior to calling ``check_c_compiler_flag()``
+
+.. include:: /module/CMAKE_REQUIRED_FLAGS.txt
+
+.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt
+
+.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt
+
+.. include:: /module/CMAKE_REQUIRED_QUIET.txt
+
 #]=======================================================================]
 
 include_guard(GLOBAL)

+ 19 - 43
Modules/CheckCSourceCompiles.cmake

@@ -22,51 +22,27 @@ Check if given C source compiles and links into an executable.
   checking if anything in the output matches any of the specified regular
   expressions.
 
-  The underlying check is performed by the :command:`try_compile` command. The
-  compile and link commands can be influenced by setting any of the following
-  variables prior to calling ``check_c_source_compiles()``:
-
-  ``CMAKE_REQUIRED_FLAGS``
-    Additional flags to pass to the compiler. Note that the contents of
-    :variable:`CMAKE_C_FLAGS <CMAKE_<LANG>_FLAGS>` and its associated
-    configuration-specific variable are automatically added to the compiler
-    command before the contents of ``CMAKE_REQUIRED_FLAGS``.
-
-  ``CMAKE_REQUIRED_DEFINITIONS``
-    A :ref:`;-list <CMake Language Lists>` of compiler definitions of the form
-    ``-DFOO`` or ``-DFOO=bar``. A definition for the name specified by
-    ``<resultVar>`` will also be added automatically.
-
-  ``CMAKE_REQUIRED_INCLUDES``
-    A :ref:`;-list <CMake Language Lists>` of header search paths to pass to
-    the compiler. These will be the only header search paths used by
-    ``try_compile()``, i.e. the contents of the :prop_dir:`INCLUDE_DIRECTORIES`
-    directory property will be ignored.
-
-  ``CMAKE_REQUIRED_LINK_OPTIONS``
-    .. versionadded:: 3.14
-
-    A :ref:`;-list <CMake Language Lists>` of options to add to the link
-    command (see :command:`try_compile` for further details).
-
-  ``CMAKE_REQUIRED_LIBRARIES``
-    A :ref:`;-list <CMake Language Lists>` of libraries to add to the link
-    command. These can be the name of system libraries or they can be
-    :ref:`Imported Targets <Imported Targets>` (see :command:`try_compile` for
-    further details).
-
-  ``CMAKE_REQUIRED_QUIET``
-    .. versionadded:: 3.1
-
-    If this variable evaluates to a boolean true value, all status messages
-    associated with the check will be suppressed.
-
-  The check is only performed once, with the result cached in the variable
-  named by ``<resultVar>``. Every subsequent CMake run will re-use this cached
-  value rather than performing the check again, even if the ``<code>`` changes.
-  In order to force the check to be re-evaluated, the variable named by
+  The check is only performed once, with the result cached in the variable named
+  by ``<resultVar>``. Every subsequent CMake run will re-use this cached value
+  rather than performing the check again, even if the ``<code>`` changes. In
+  order to force the check to be re-evaluated, the variable named by
   ``<resultVar>`` must be manually removed from the cache.
 
+  The compile and link commands can be influenced by setting any of the
+  following variables prior to calling ``check_c_source_compiles()``:
+
+.. include:: /module/CMAKE_REQUIRED_FLAGS.txt
+
+.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt
+
+.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt
+
+.. include:: /module/CMAKE_REQUIRED_QUIET.txt
+
 #]=======================================================================]
 
 include_guard(GLOBAL)

+ 19 - 43
Modules/CheckCSourceRuns.cmake

@@ -21,51 +21,27 @@ subsequently be run.
   be set to 1, otherwise it will be set to an value that evaluates to boolean
   false (e.g. an empty string or an error message).
 
-  The underlying check is performed by the :command:`try_run` command. The
-  compile and link commands can be influenced by setting any of the following
-  variables prior to calling ``check_c_source_runs()``:
-
-  ``CMAKE_REQUIRED_FLAGS``
-    Additional flags to pass to the compiler. Note that the contents of
-    :variable:`CMAKE_C_FLAGS <CMAKE_<LANG>_FLAGS>` and its associated
-    configuration-specific variable are automatically added to the compiler
-    command before the contents of ``CMAKE_REQUIRED_FLAGS``.
-
-  ``CMAKE_REQUIRED_DEFINITIONS``
-    A :ref:`;-list <CMake Language Lists>` of compiler definitions of the form
-    ``-DFOO`` or ``-DFOO=bar``. A definition for the name specified by
-    ``<resultVar>`` will also be added automatically.
-
-  ``CMAKE_REQUIRED_INCLUDES``
-    A :ref:`;-list <CMake Language Lists>` of header search paths to pass to
-    the compiler. These will be the only header search paths used by
-    ``try_run()``, i.e. the contents of the :prop_dir:`INCLUDE_DIRECTORIES`
-    directory property will be ignored.
-
-  ``CMAKE_REQUIRED_LINK_OPTIONS``
-    .. versionadded:: 3.14
-
-    A :ref:`;-list <CMake Language Lists>` of options to add to the link
-    command (see :command:`try_run` for further details).
-
-  ``CMAKE_REQUIRED_LIBRARIES``
-    A :ref:`;-list <CMake Language Lists>` of libraries to add to the link
-    command. These can be the name of system libraries or they can be
-    :ref:`Imported Targets <Imported Targets>` (see :command:`try_run` for
-    further details).
-
-  ``CMAKE_REQUIRED_QUIET``
-    .. versionadded:: 3.1
-
-    If this variable evaluates to a boolean true value, all status messages
-    associated with the check will be suppressed.
-
-  The check is only performed once, with the result cached in the variable
-  named by ``<resultVar>``. Every subsequent CMake run will re-use this cached
-  value rather than performing the check again, even if the ``<code>`` changes.
-  In order to force the check to be re-evaluated, the variable named by
+  The check is only performed once, with the result cached in the variable named
+  by ``<resultVar>``. Every subsequent CMake run will re-use this cached value
+  rather than performing the check again, even if the ``<code>`` changes. In
+  order to force the check to be re-evaluated, the variable named by
   ``<resultVar>`` must be manually removed from the cache.
 
+  The compile and link commands can be influenced by setting any of the
+  following variables prior to calling ``check_c_source_runs()``:
+
+.. include:: /module/CMAKE_REQUIRED_FLAGS.txt
+
+.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt
+
+.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt
+
+.. include:: /module/CMAKE_REQUIRED_QUIET.txt
+
 #]=======================================================================]
 
 include_guard(GLOBAL)

+ 0 - 5
Modules/CheckCXXCompilerFlag.cmake

@@ -17,11 +17,6 @@ Check whether the CXX compiler supports a given flag.
   a diagnostic.  Stores the result in an internal cache entry
   named ``<var>``.
 
-This command temporarily sets the ``CMAKE_REQUIRED_DEFINITIONS`` variable
-and calls the ``check_cxx_source_compiles`` macro from the
-:module:`CheckCXXSourceCompiles` module.  See documentation of that
-module for a listing of variables that can otherwise modify the build.
-
 A positive result from this check indicates only that the compiler did not
 issue a diagnostic message when given the flag.  Whether the flag has any
 effect or even a specific one is beyond the scope of this module.

+ 19 - 43
Modules/CheckCXXSourceCompiles.cmake

@@ -22,51 +22,27 @@ Check if given C++ source compiles and links into an executable.
   checking if anything in the output matches any of the specified regular
   expressions.
 
-  The underlying check is performed by the :command:`try_compile` command. The
-  compile and link commands can be influenced by setting any of the following
-  variables prior to calling ``check_cxx_source_compiles()``:
-
-  ``CMAKE_REQUIRED_FLAGS``
-    Additional flags to pass to the compiler. Note that the contents of
-    :variable:`CMAKE_CXX_FLAGS <CMAKE_<LANG>_FLAGS>` and its associated
-    configuration-specific variable are automatically added to the compiler
-    command before the contents of ``CMAKE_REQUIRED_FLAGS``.
-
-  ``CMAKE_REQUIRED_DEFINITIONS``
-    A :ref:`;-list <CMake Language Lists>` of compiler definitions of the form
-    ``-DFOO`` or ``-DFOO=bar``. A definition for the name specified by
-    ``<resultVar>`` will also be added automatically.
-
-  ``CMAKE_REQUIRED_INCLUDES``
-    A :ref:`;-list <CMake Language Lists>` of header search paths to pass to
-    the compiler. These will be the only header search paths used by
-    ``try_compile()``, i.e. the contents of the :prop_dir:`INCLUDE_DIRECTORIES`
-    directory property will be ignored.
-
-  ``CMAKE_REQUIRED_LINK_OPTIONS``
-    .. versionadded:: 3.14
-
-    A :ref:`;-list <CMake Language Lists>` of options to add to the link
-    command (see :command:`try_compile` for further details).
-
-  ``CMAKE_REQUIRED_LIBRARIES``
-    A :ref:`;-list <CMake Language Lists>` of libraries to add to the link
-    command. These can be the name of system libraries or they can be
-    :ref:`Imported Targets <Imported Targets>` (see :command:`try_compile` for
-    further details).
-
-  ``CMAKE_REQUIRED_QUIET``
-    .. versionadded:: 3.1
-
-    If this variable evaluates to a boolean true value, all status messages
-    associated with the check will be suppressed.
-
-  The check is only performed once, with the result cached in the variable
-  named by ``<resultVar>``. Every subsequent CMake run will re-use this cached
-  value rather than performing the check again, even if the ``<code>`` changes.
-  In order to force the check to be re-evaluated, the variable named by
+  The check is only performed once, with the result cached in the variable named
+  by ``<resultVar>``. Every subsequent CMake run will re-use this cached value
+  rather than performing the check again, even if the ``<code>`` changes. In
+  order to force the check to be re-evaluated, the variable named by
   ``<resultVar>`` must be manually removed from the cache.
 
+  The compile and link commands can be influenced by setting any of the
+  following variables prior to calling ``check_cxx_source_compiles()``:
+
+.. include:: /module/CMAKE_REQUIRED_FLAGS.txt
+
+.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt
+
+.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt
+
+.. include:: /module/CMAKE_REQUIRED_QUIET.txt
+
 #]=======================================================================]
 
 include_guard(GLOBAL)

+ 19 - 43
Modules/CheckCXXSourceRuns.cmake

@@ -21,51 +21,27 @@ subsequently be run.
   be set to 1, otherwise it will be set to an value that evaluates to boolean
   false (e.g. an empty string or an error message).
 
-  The underlying check is performed by the :command:`try_run` command. The
-  compile and link commands can be influenced by setting any of the following
-  variables prior to calling ``check_cxx_source_runs()``:
-
-  ``CMAKE_REQUIRED_FLAGS``
-    Additional flags to pass to the compiler. Note that the contents of
-    :variable:`CMAKE_CXX_FLAGS <CMAKE_<LANG>_FLAGS>` and its associated
-    configuration-specific variable are automatically added to the compiler
-    command before the contents of ``CMAKE_REQUIRED_FLAGS``.
-
-  ``CMAKE_REQUIRED_DEFINITIONS``
-    A :ref:`;-list <CMake Language Lists>` of compiler definitions of the form
-    ``-DFOO`` or ``-DFOO=bar``. A definition for the name specified by
-    ``<resultVar>`` will also be added automatically.
-
-  ``CMAKE_REQUIRED_INCLUDES``
-    A :ref:`;-list <CMake Language Lists>` of header search paths to pass to
-    the compiler. These will be the only header search paths used by
-    ``try_run()``, i.e. the contents of the :prop_dir:`INCLUDE_DIRECTORIES`
-    directory property will be ignored.
-
-  ``CMAKE_REQUIRED_LINK_OPTIONS``
-    .. versionadded:: 3.14
-
-    A :ref:`;-list <CMake Language Lists>` of options to add to the link
-    command (see :command:`try_run` for further details).
-
-  ``CMAKE_REQUIRED_LIBRARIES``
-    A :ref:`;-list <CMake Language Lists>` of libraries to add to the link
-    command. These can be the name of system libraries or they can be
-    :ref:`Imported Targets <Imported Targets>` (see :command:`try_run` for
-    further details).
-
-  ``CMAKE_REQUIRED_QUIET``
-    .. versionadded:: 3.1
-
-    If this variable evaluates to a boolean true value, all status messages
-    associated with the check will be suppressed.
-
-  The check is only performed once, with the result cached in the variable
-  named by ``<resultVar>``. Every subsequent CMake run will re-use this cached
-  value rather than performing the check again, even if the ``<code>`` changes.
-  In order to force the check to be re-evaluated, the variable named by
+  The check is only performed once, with the result cached in the variable named
+  by ``<resultVar>``. Every subsequent CMake run will re-use this cached value
+  rather than performing the check again, even if the ``<code>`` changes. In
+  order to force the check to be re-evaluated, the variable named by
   ``<resultVar>`` must be manually removed from the cache.
 
+  The compile and link commands can be influenced by setting any of the
+  following variables prior to calling ``check_cxx_source_runs()``:
+
+.. include:: /module/CMAKE_REQUIRED_FLAGS.txt
+
+.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt
+
+.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt
+
+.. include:: /module/CMAKE_REQUIRED_QUIET.txt
+
 #]=======================================================================]
 
 include_guard(GLOBAL)

+ 11 - 16
Modules/CheckCXXSymbolExists.cmake

@@ -41,22 +41,17 @@ Check if a symbol exists as a function, variable, or macro in ``C++``.
 The following variables may be set before calling this macro to modify
 the way the check is run:
 
-``CMAKE_REQUIRED_FLAGS``
-  string of compile command line flags.
-``CMAKE_REQUIRED_DEFINITIONS``
-  a :ref:`;-list <CMake Language Lists>` of macros to define (-DFOO=bar).
-``CMAKE_REQUIRED_INCLUDES``
-  a :ref:`;-list <CMake Language Lists>` of header search paths to pass to
-  the compiler.
-``CMAKE_REQUIRED_LINK_OPTIONS``
-  .. versionadded:: 3.14
-    a :ref:`;-list <CMake Language Lists>` of options to add to the link command.
-``CMAKE_REQUIRED_LIBRARIES``
-  a :ref:`;-list <CMake Language Lists>` of libraries to add to the link
-  command. See policy :policy:`CMP0075`.
-``CMAKE_REQUIRED_QUIET``
-  .. versionadded:: 3.1
-    execute quietly without messages.
+.. include:: /module/CMAKE_REQUIRED_FLAGS.txt
+
+.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt
+
+.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt
+
+.. include:: /module/CMAKE_REQUIRED_QUIET.txt
 
 For example:
 

+ 23 - 11
Modules/CheckCompilerFlag.cmake

@@ -13,24 +13,36 @@ Check whether the compiler supports a given flag.
 
   .. code-block:: cmake
 
-    check_compiler_flag(<lang> <flag> <var>)
+    check_compiler_flag(<lang> <flag> <resultVar>)
 
 Check that the ``<flag>`` is accepted by the compiler without a diagnostic.
-Stores the result in an internal cache entry named ``<var>``.
-
-This command temporarily sets the ``CMAKE_REQUIRED_DEFINITIONS`` variable
-and calls the ``check_source_compiles(<LANG>)`` function from the
-:module:`CheckSourceCompiles` module.  See documentation of that
-module for a listing of variables that can otherwise modify the build.
+Stores the result in an internal cache entry named ``<resultVar>``.
 
 A positive result from this check indicates only that the compiler did not
 issue a diagnostic message when given the flag.  Whether the flag has any
 effect or even a specific one is beyond the scope of this module.
 
-.. note::
-  Since the :command:`try_compile` command forwards flags from variables
-  like :variable:`CMAKE_<LANG>_FLAGS <CMAKE_<LANG>_FLAGS>`, unknown flags
-  in such variables may cause a false negative for this check.
+The check is only performed once, with the result cached in the variable named
+by ``<resultVar>``. Every subsequent CMake run will re-use this cached value
+rather than performing the check again, even if the ``<code>`` changes. In
+order to force the check to be re-evaluated, the variable named by
+``<resultVar>`` must be manually removed from the cache.
+
+The compile and link commands can be influenced by setting any of the
+following variables prior to calling ``check_compiler_flag()``
+
+.. include:: /module/CMAKE_REQUIRED_FLAGS.txt
+
+.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt
+
+.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt
+
+.. include:: /module/CMAKE_REQUIRED_QUIET.txt
+
 #]=======================================================================]
 
 include_guard(GLOBAL)

+ 23 - 11
Modules/CheckFortranCompilerFlag.cmake

@@ -13,25 +13,37 @@ Check whether the Fortran compiler supports a given flag.
 
   .. code-block:: cmake
 
-    check_fortran_compiler_flag(<flag> <var>)
+    check_fortran_compiler_flag(<flag> <resultVar>)
 
   Check that the ``<flag>`` is accepted by the compiler without
   a diagnostic.  Stores the result in an internal cache entry
-  named ``<var>``.
-
-This command temporarily sets the ``CMAKE_REQUIRED_DEFINITIONS`` variable
-and calls the ``check_fortran_source_compiles`` macro from the
-:module:`CheckFortranSourceCompiles` module.  See documentation of that
-module for a listing of variables that can otherwise modify the build.
+  named ``<resultVar>``.
 
 A positive result from this check indicates only that the compiler did not
 issue a diagnostic message when given the flag.  Whether the flag has any
 effect or even a specific one is beyond the scope of this module.
 
-.. note::
-  Since the :command:`try_compile` command forwards flags from variables
-  like :variable:`CMAKE_Fortran_FLAGS <CMAKE_<LANG>_FLAGS>`, unknown flags
-  in such variables may cause a false negative for this check.
+The check is only performed once, with the result cached in the variable named
+by ``<resultVar>``. Every subsequent CMake run will re-use this cached value
+rather than performing the check again, even if the ``<code>`` changes. In
+order to force the check to be re-evaluated, the variable named by
+``<resultVar>`` must be manually removed from the cache.
+
+The compile and link commands can be influenced by setting any of the
+following variables prior to calling ``check_fortran_compiler_flag()``
+
+.. include:: /module/CMAKE_REQUIRED_FLAGS.txt
+
+.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt
+
+.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt
+
+.. include:: /module/CMAKE_REQUIRED_QUIET.txt
+
 #]=======================================================================]
 
 include_guard(GLOBAL)

+ 19 - 41
Modules/CheckFortranSourceCompiles.cmake

@@ -47,49 +47,27 @@ Check if given Fortran source compiles and links into an executable.
   ``SRC_EXT`` option can be used to override this with ``.<extension>`` instead--
   ``.F90`` is a typical choice.
 
-  The underlying check is performed by the :command:`try_compile` command. The
-  compile and link commands can be influenced by setting any of the following
-  variables prior to calling ``check_fortran_source_compiles()``:
-
-  ``CMAKE_REQUIRED_FLAGS``
-    Additional flags to pass to the compiler. Note that the contents of
-    :variable:`CMAKE_Fortran_FLAGS <CMAKE_<LANG>_FLAGS>` and its associated
-    configuration-specific variable are automatically added to the compiler
-    command before the contents of ``CMAKE_REQUIRED_FLAGS``.
-
-  ``CMAKE_REQUIRED_DEFINITIONS``
-    A :ref:`;-list <CMake Language Lists>` of compiler definitions of the form
-    ``-DFOO`` or ``-DFOO=bar``. A definition for the name specified by
-    ``<resultVar>`` will also be added automatically.
-
-  ``CMAKE_REQUIRED_INCLUDES``
-    A :ref:`;-list <CMake Language Lists>` of header search paths to pass to
-    the compiler. These will be the only header search paths used by
-    ``try_compile()``, i.e. the contents of the :prop_dir:`INCLUDE_DIRECTORIES`
-    directory property will be ignored.
-
-  ``CMAKE_REQUIRED_LINK_OPTIONS``
-    .. versionadded:: 3.14
-
-    A :ref:`;-list <CMake Language Lists>` of options to add to the link
-    command (see :command:`try_compile` for further details).
-
-  ``CMAKE_REQUIRED_LIBRARIES``
-    A :ref:`;-list <CMake Language Lists>` of libraries to add to the link
-    command. These can be the name of system libraries or they can be
-    :ref:`Imported Targets <Imported Targets>` (see :command:`try_compile` for
-    further details).
-
-  ``CMAKE_REQUIRED_QUIET``
-    If this variable evaluates to a boolean true value, all status messages
-    associated with the check will be suppressed.
-
-  The check is only performed once, with the result cached in the variable
-  named by ``<resultVar>``. Every subsequent CMake run will re-use this cached
-  value rather than performing the check again, even if the ``<code>`` changes.
-  In order to force the check to be re-evaluated, the variable named by
+  The check is only performed once, with the result cached in the variable named
+  by ``<resultVar>``. Every subsequent CMake run will re-use this cached value
+  rather than performing the check again, even if the ``<code>`` changes. In
+  order to force the check to be re-evaluated, the variable named by
   ``<resultVar>`` must be manually removed from the cache.
 
+  The compile and link commands can be influenced by setting any of the
+  following variables prior to calling ``check_fortran_source_compiles()``:
+
+.. include:: /module/CMAKE_REQUIRED_FLAGS.txt
+
+.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt
+
+.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt
+
+.. include:: /module/CMAKE_REQUIRED_QUIET.txt
+
 #]=======================================================================]
 
 include_guard(GLOBAL)

+ 19 - 39
Modules/CheckFortranSourceRuns.cmake

@@ -43,47 +43,27 @@ subsequently be run.
   By default, the test source file will be given a ``.F90`` file extension. The
   ``SRC_EXT`` option can be used to override this with ``.<extension>`` instead.
 
-  The underlying check is performed by the :command:`try_run` command. The
-  compile and link commands can be influenced by setting any of the following
-  variables prior to calling ``check_fortran_source_runs()``:
-
-  ``CMAKE_REQUIRED_FLAGS``
-    Additional flags to pass to the compiler. Note that the contents of
-    :variable:`CMAKE_Fortran_FLAGS <CMAKE_<LANG>_FLAGS>` and its associated
-    configuration-specific variable are automatically added to the compiler
-    command before the contents of ``CMAKE_REQUIRED_FLAGS``.
-
-  ``CMAKE_REQUIRED_DEFINITIONS``
-    A :ref:`;-list <CMake Language Lists>` of compiler definitions of the form
-    ``-DFOO`` or ``-DFOO=bar``. A definition for the name specified by
-    ``<resultVar>`` will also be added automatically.
-
-  ``CMAKE_REQUIRED_INCLUDES``
-    A :ref:`;-list <CMake Language Lists>` of header search paths to pass to
-    the compiler. These will be the only header search paths used by
-    ``try_run()``, i.e. the contents of the :prop_dir:`INCLUDE_DIRECTORIES`
-    directory property will be ignored.
-
-  ``CMAKE_REQUIRED_LINK_OPTIONS``
-    A :ref:`;-list <CMake Language Lists>` of options to add to the link
-    command (see :command:`try_run` for further details).
-
-  ``CMAKE_REQUIRED_LIBRARIES``
-    A :ref:`;-list <CMake Language Lists>` of libraries to add to the link
-    command. These can be the name of system libraries or they can be
-    :ref:`Imported Targets <Imported Targets>` (see :command:`try_run` for
-    further details).
-
-  ``CMAKE_REQUIRED_QUIET``
-    If this variable evaluates to a boolean true value, all status messages
-    associated with the check will be suppressed.
-
-  The check is only performed once, with the result cached in the variable
-  named by ``<resultVar>``. Every subsequent CMake run will re-use this cached
-  value rather than performing the check again, even if the ``<code>`` changes.
-  In order to force the check to be re-evaluated, the variable named by
+  The check is only performed once, with the result cached in the variable named
+  by ``<resultVar>``. Every subsequent CMake run will re-use this cached value
+  rather than performing the check again, even if the ``<code>`` changes. In
+  order to force the check to be re-evaluated, the variable named by
   ``<resultVar>`` must be manually removed from the cache.
 
+  The compile and link commands can be influenced by setting any of the
+  following variables prior to calling ``check_fortran_source_runs()``:
+
+.. include:: /module/CMAKE_REQUIRED_FLAGS.txt
+
+.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt
+
+.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt
+
+.. include:: /module/CMAKE_REQUIRED_QUIET.txt
+
 #]=======================================================================]
 
 include_guard(GLOBAL)

+ 11 - 16
Modules/CheckFunctionExists.cmake

@@ -20,22 +20,17 @@ Check if a C function can be linked
 The following variables may be set before calling this macro to modify the
 way the check is run:
 
-``CMAKE_REQUIRED_FLAGS``
-  string of compile command line flags.
-``CMAKE_REQUIRED_DEFINITIONS``
-  a :ref:`;-list <CMake Language Lists>` of macros to define (-DFOO=bar).
-``CMAKE_REQUIRED_INCLUDES``
-  a :ref:`;-list <CMake Language Lists>` of header search paths to pass to
-  the compiler.
-``CMAKE_REQUIRED_LINK_OPTIONS``
-  .. versionadded:: 3.14
-    a :ref:`;-list <CMake Language Lists>` of options to add to the link command.
-``CMAKE_REQUIRED_LIBRARIES``
-  a :ref:`;-list <CMake Language Lists>` of libraries to add to the link
-  command. See policy :policy:`CMP0075`.
-``CMAKE_REQUIRED_QUIET``
-  .. versionadded:: 3.1
-    execute quietly without messages.
+.. include:: /module/CMAKE_REQUIRED_FLAGS.txt
+
+.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt
+
+.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt
+
+.. include:: /module/CMAKE_REQUIRED_QUIET.txt
 
 .. note::
 

+ 11 - 16
Modules/CheckIncludeFile.cmake

@@ -21,22 +21,17 @@ Provides a macro to check if a header file can be included in ``C``.
 The following variables may be set before calling this macro to modify
 the way the check is run:
 
-``CMAKE_REQUIRED_FLAGS``
-  string of compile command line flags.
-``CMAKE_REQUIRED_DEFINITIONS``
-  a :ref:`;-list <CMake Language Lists>` of macros to define (-DFOO=bar).
-``CMAKE_REQUIRED_INCLUDES``
-  a :ref:`;-list <CMake Language Lists>` of header search paths to pass to
-  the compiler.
-``CMAKE_REQUIRED_LINK_OPTIONS``
-  .. versionadded:: 3.14
-    a :ref:`;-list <CMake Language Lists>` of options to add to the link command.
-``CMAKE_REQUIRED_LIBRARIES``
-  a :ref:`;-list <CMake Language Lists>` of libraries to add to the link
-  command. See policy :policy:`CMP0075`.
-``CMAKE_REQUIRED_QUIET``
-  .. versionadded:: 3.1
-    execute quietly without messages.
+.. include:: /module/CMAKE_REQUIRED_FLAGS.txt
+
+.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt
+
+.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt
+
+.. include:: /module/CMAKE_REQUIRED_QUIET.txt
 
 See the :module:`CheckIncludeFiles` module to check for multiple headers
 at once.  See the :module:`CheckIncludeFileCXX` module to check for headers

+ 11 - 16
Modules/CheckIncludeFileCXX.cmake

@@ -21,22 +21,17 @@ Provides a macro to check if a header file can be included in ``CXX``.
 The following variables may be set before calling this macro to modify
 the way the check is run:
 
-``CMAKE_REQUIRED_FLAGS``
-  string of compile command line flags.
-``CMAKE_REQUIRED_DEFINITIONS``
-  a :ref:`;-list <CMake Language Lists>` of macros to define (-DFOO=bar).
-``CMAKE_REQUIRED_INCLUDES``
-  a :ref:`;-list <CMake Language Lists>` of header search paths to pass to
-  the compiler.
-``CMAKE_REQUIRED_LINK_OPTIONS``
-  .. versionadded:: 3.14
-    a :ref:`;-list <CMake Language Lists>` of options to add to the link command.
-``CMAKE_REQUIRED_LIBRARIES``
-  a :ref:`;-list <CMake Language Lists>` of libraries to add to the link
-  command. See policy :policy:`CMP0075`.
-``CMAKE_REQUIRED_QUIET``
-  .. versionadded:: 3.1
-    execute quietly without messages.
+.. include:: /module/CMAKE_REQUIRED_FLAGS.txt
+
+.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt
+
+.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt
+
+.. include:: /module/CMAKE_REQUIRED_QUIET.txt
 
 See modules :module:`CheckIncludeFile` and :module:`CheckIncludeFiles`
 to check for one or more ``C`` headers.

+ 11 - 16
Modules/CheckIncludeFiles.cmake

@@ -27,22 +27,17 @@ be included together.
 The following variables may be set before calling this macro to modify
 the way the check is run:
 
-``CMAKE_REQUIRED_FLAGS``
-  string of compile command line flags.
-``CMAKE_REQUIRED_DEFINITIONS``
-  a :ref:`;-list <CMake Language Lists>` of macros to define (-DFOO=bar).
-``CMAKE_REQUIRED_INCLUDES``
-  a :ref:`;-list <CMake Language Lists>` of header search paths to pass to
-  the compiler.
-``CMAKE_REQUIRED_LINK_OPTIONS``
-  .. versionadded:: 3.14
-    a :ref:`;-list <CMake Language Lists>` of options to add to the link command.
-``CMAKE_REQUIRED_LIBRARIES``
-  a :ref:`;-list <CMake Language Lists>` of libraries to add to the link
-  command. See policy :policy:`CMP0075`.
-``CMAKE_REQUIRED_QUIET``
-  .. versionadded:: 3.1
-    execute quietly without messages.
+.. include:: /module/CMAKE_REQUIRED_FLAGS.txt
+
+.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt
+
+.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt
+
+.. include:: /module/CMAKE_REQUIRED_QUIET.txt
 
 See modules :module:`CheckIncludeFile` and :module:`CheckIncludeFileCXX`
 to check for a single header file in ``C`` or ``CXX`` languages.

+ 10 - 12
Modules/CheckLibraryExists.cmake

@@ -26,18 +26,16 @@ Check if the function exists.
 The following variables may be set before calling this macro to modify
 the way the check is run:
 
-``CMAKE_REQUIRED_FLAGS``
-  string of compile command line flags.
-``CMAKE_REQUIRED_DEFINITIONS``
-  list of macros to define (-DFOO=bar).
-``CMAKE_REQUIRED_LINK_OPTIONS``
-  .. versionadded:: 3.14
-    list of options to pass to link command.
-``CMAKE_REQUIRED_LIBRARIES``
-  list of libraries to link.
-``CMAKE_REQUIRED_QUIET``
-  .. versionadded:: 3.1
-    execute quietly without messages.
+.. include:: /module/CMAKE_REQUIRED_FLAGS.txt
+
+.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt
+
+.. include:: /module/CMAKE_REQUIRED_QUIET.txt
+
 #]=======================================================================]
 
 include_guard(GLOBAL)

+ 23 - 11
Modules/CheckOBJCCompilerFlag.cmake

@@ -13,25 +13,37 @@ Check whether the Objective-C compiler supports a given flag.
 
   .. code-block:: cmake
 
-    check_objc_compiler_flag(<flag> <var>)
+    check_objc_compiler_flag(<flag> <resultVar>)
 
   Check that the ``<flag>`` is accepted by the compiler without
   a diagnostic.  Stores the result in an internal cache entry
-  named ``<var>``.
-
-This command temporarily sets the ``CMAKE_REQUIRED_DEFINITIONS`` variable
-and calls the ``check_objc_source_compiles`` macro from the
-:module:`CheckOBJCSourceCompiles` module.  See documentation of that
-module for a listing of variables that can otherwise modify the build.
+  named ``<resultVar>``.
 
 A positive result from this check indicates only that the compiler did not
 issue a diagnostic message when given the flag.  Whether the flag has any
 effect or even a specific one is beyond the scope of this module.
 
-.. note::
-  Since the :command:`try_compile` command forwards flags from variables
-  like :variable:`CMAKE_OBJC_FLAGS <CMAKE_<LANG>_FLAGS>`, unknown flags
-  in such variables may cause a false negative for this check.
+The check is only performed once, with the result cached in the variable named
+by ``<resultVar>``. Every subsequent CMake run will re-use this cached value
+rather than performing the check again, even if the ``<code>`` changes. In
+order to force the check to be re-evaluated, the variable named by
+``<resultVar>`` must be manually removed from the cache.
+
+The compile and link commands can be influenced by setting any of the
+following variables prior to calling ``check_objc_compiler_flag()``
+
+.. include:: /module/CMAKE_REQUIRED_FLAGS.txt
+
+.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt
+
+.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt
+
+.. include:: /module/CMAKE_REQUIRED_QUIET.txt
+
 #]=======================================================================]
 
 include_guard(GLOBAL)

+ 19 - 39
Modules/CheckOBJCSourceCompiles.cmake

@@ -24,47 +24,27 @@ Check if given Objective-C source compiles and links into an executable.
   checking if anything in the output matches any of the specified regular
   expressions.
 
-  The underlying check is performed by the :command:`try_compile` command. The
-  compile and link commands can be influenced by setting any of the following
-  variables prior to calling ``check_objc_source_compiles()``:
-
-  ``CMAKE_REQUIRED_FLAGS``
-    Additional flags to pass to the compiler. Note that the contents of
-    :variable:`CMAKE_OBJC_FLAGS <CMAKE_<LANG>_FLAGS>` and its associated
-    configuration-specific variable are automatically added to the compiler
-    command before the contents of ``CMAKE_REQUIRED_FLAGS``.
-
-  ``CMAKE_REQUIRED_DEFINITIONS``
-    A :ref:`;-list <CMake Language Lists>` of compiler definitions of the form
-    ``-DFOO`` or ``-DFOO=bar``. A definition for the name specified by
-    ``<resultVar>`` will also be added automatically.
-
-  ``CMAKE_REQUIRED_INCLUDES``
-    A :ref:`;-list <CMake Language Lists>` of header search paths to pass to
-    the compiler. These will be the only header search paths used by
-    ``try_compile()``, i.e. the contents of the :prop_dir:`INCLUDE_DIRECTORIES`
-    directory property will be ignored.
-
-  ``CMAKE_REQUIRED_LINK_OPTIONS``
-    A :ref:`;-list <CMake Language Lists>` of options to add to the link
-    command (see :command:`try_compile` for further details).
-
-  ``CMAKE_REQUIRED_LIBRARIES``
-    A :ref:`;-list <CMake Language Lists>` of libraries to add to the link
-    command. These can be the name of system libraries or they can be
-    :ref:`Imported Targets <Imported Targets>` (see :command:`try_compile` for
-    further details).
-
-  ``CMAKE_REQUIRED_QUIET``
-    If this variable evaluates to a boolean true value, all status messages
-    associated with the check will be suppressed.
-
-  The check is only performed once, with the result cached in the variable
-  named by ``<resultVar>``. Every subsequent CMake run will re-use this cached
-  value rather than performing the check again, even if the ``<code>`` changes.
-  In order to force the check to be re-evaluated, the variable named by
+  The check is only performed once, with the result cached in the variable named
+  by ``<resultVar>``. Every subsequent CMake run will re-use this cached value
+  rather than performing the check again, even if the ``<code>`` changes. In
+  order to force the check to be re-evaluated, the variable named by
   ``<resultVar>`` must be manually removed from the cache.
 
+  The compile and link commands can be influenced by setting any of the
+  following variables prior to calling ``check_objc_source_compiles()``
+
+.. include:: /module/CMAKE_REQUIRED_FLAGS.txt
+
+.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt
+
+.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt
+
+.. include:: /module/CMAKE_REQUIRED_QUIET.txt
+
 #]=======================================================================]
 
 include_guard(GLOBAL)

+ 19 - 39
Modules/CheckOBJCSourceRuns.cmake

@@ -23,47 +23,27 @@ subsequently be run.
   be set to 1, otherwise it will be set to an value that evaluates to boolean
   false (e.g. an empty string or an error message).
 
-  The underlying check is performed by the :command:`try_run` command. The
-  compile and link commands can be influenced by setting any of the following
-  variables prior to calling ``check_objc_source_runs()``:
-
-  ``CMAKE_REQUIRED_FLAGS``
-    Additional flags to pass to the compiler. Note that the contents of
-    :variable:`CMAKE_OBJC_FLAGS <CMAKE_<LANG>_FLAGS>` and its associated
-    configuration-specific variable are automatically added to the compiler
-    command before the contents of ``CMAKE_REQUIRED_FLAGS``.
-
-  ``CMAKE_REQUIRED_DEFINITIONS``
-    A :ref:`;-list <CMake Language Lists>` of compiler definitions of the form
-    ``-DFOO`` or ``-DFOO=bar``. A definition for the name specified by
-    ``<resultVar>`` will also be added automatically.
-
-  ``CMAKE_REQUIRED_INCLUDES``
-    A :ref:`;-list <CMake Language Lists>` of header search paths to pass to
-    the compiler. These will be the only header search paths used by
-    ``try_run()``, i.e. the contents of the :prop_dir:`INCLUDE_DIRECTORIES`
-    directory property will be ignored.
-
-  ``CMAKE_REQUIRED_LINK_OPTIONS``
-    A :ref:`;-list <CMake Language Lists>` of options to add to the link
-    command (see :command:`try_run` for further details).
-
-  ``CMAKE_REQUIRED_LIBRARIES``
-    A :ref:`;-list <CMake Language Lists>` of libraries to add to the link
-    command. These can be the name of system libraries or they can be
-    :ref:`Imported Targets <Imported Targets>` (see :command:`try_run` for
-    further details).
-
-  ``CMAKE_REQUIRED_QUIET``
-    If this variable evaluates to a boolean true value, all status messages
-    associated with the check will be suppressed.
-
-  The check is only performed once, with the result cached in the variable
-  named by ``<resultVar>``. Every subsequent CMake run will re-use this cached
-  value rather than performing the check again, even if the ``<code>`` changes.
-  In order to force the check to be re-evaluated, the variable named by
+  The check is only performed once, with the result cached in the variable named
+  by ``<resultVar>``. Every subsequent CMake run will re-use this cached value
+  rather than performing the check again, even if the ``<code>`` changes. In
+  order to force the check to be re-evaluated, the variable named by
   ``<resultVar>`` must be manually removed from the cache.
 
+  The compile and link commands can be influenced by setting any of the
+  following variables prior to calling ``check_objc_source_runs()``
+
+.. include:: /module/CMAKE_REQUIRED_FLAGS.txt
+
+.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt
+
+.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt
+
+.. include:: /module/CMAKE_REQUIRED_QUIET.txt
+
 #]=======================================================================]
 
 include_guard(GLOBAL)

+ 23 - 11
Modules/CheckOBJCXXCompilerFlag.cmake

@@ -13,25 +13,37 @@ Check whether the Objective-C++ compiler supports a given flag.
 
   .. code-block:: cmake
 
-    check_objcxx_compiler_flag(<flag> <var>)
+    check_objcxx_compiler_flag(<flag> <resultVar>)
 
   Check that the ``<flag>`` is accepted by the compiler without
   a diagnostic.  Stores the result in an internal cache entry
-  named ``<var>``.
-
-This command temporarily sets the ``CMAKE_REQUIRED_DEFINITIONS`` variable
-and calls the ``check_objcxx_source_compiles`` macro from the
-:module:`CheckOBJCXXSourceCompiles` module.  See documentation of that
-module for a listing of variables that can otherwise modify the build.
+  named ``<resultVar>``.
 
 A positive result from this check indicates only that the compiler did not
 issue a diagnostic message when given the flag.  Whether the flag has any
 effect or even a specific one is beyond the scope of this module.
 
-.. note::
-  Since the :command:`try_compile` command forwards flags from variables
-  like :variable:`CMAKE_OBJCXX_FLAGS <CMAKE_<LANG>_FLAGS>`, unknown flags
-  in such variables may cause a false negative for this check.
+The check is only performed once, with the result cached in the variable named
+by ``<resultVar>``. Every subsequent CMake run will re-use this cached value
+rather than performing the check again, even if the ``<code>`` changes. In
+order to force the check to be re-evaluated, the variable named by
+``<resultVar>`` must be manually removed from the cache.
+
+The compile and link commands can be influenced by setting any of the
+following variables prior to calling ``check_objcxx_compiler_flag()``
+
+.. include:: /module/CMAKE_REQUIRED_FLAGS.txt
+
+.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt
+
+.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt
+
+.. include:: /module/CMAKE_REQUIRED_QUIET.txt
+
 #]=======================================================================]
 
 include_guard(GLOBAL)

+ 19 - 39
Modules/CheckOBJCXXSourceCompiles.cmake

@@ -24,47 +24,27 @@ Check if given Objective-C++ source compiles and links into an executable.
   checking if anything in the output matches any of the specified regular
   expressions.
 
-  The underlying check is performed by the :command:`try_compile` command. The
-  compile and link commands can be influenced by setting any of the following
-  variables prior to calling ``check_objcxx_source_compiles()``:
-
-  ``CMAKE_REQUIRED_FLAGS``
-    Additional flags to pass to the compiler. Note that the contents of
-    :variable:`CMAKE_OBJCXX_FLAGS <CMAKE_<LANG>_FLAGS>` and its associated
-    configuration-specific variable are automatically added to the compiler
-    command before the contents of ``CMAKE_REQUIRED_FLAGS``.
-
-  ``CMAKE_REQUIRED_DEFINITIONS``
-    A :ref:`;-list <CMake Language Lists>` of compiler definitions of the form
-    ``-DFOO`` or ``-DFOO=bar``. A definition for the name specified by
-    ``<resultVar>`` will also be added automatically.
-
-  ``CMAKE_REQUIRED_INCLUDES``
-    A :ref:`;-list <CMake Language Lists>` of header search paths to pass to
-    the compiler. These will be the only header search paths used by
-    ``try_compile()``, i.e. the contents of the :prop_dir:`INCLUDE_DIRECTORIES`
-    directory property will be ignored.
-
-  ``CMAKE_REQUIRED_LINK_OPTIONS``
-    A :ref:`;-list <CMake Language Lists>` of options to add to the link
-    command (see :command:`try_compile` for further details).
-
-  ``CMAKE_REQUIRED_LIBRARIES``
-    A :ref:`;-list <CMake Language Lists>` of libraries to add to the link
-    command. These can be the name of system libraries or they can be
-    :ref:`Imported Targets <Imported Targets>` (see :command:`try_compile` for
-    further details).
-
-  ``CMAKE_REQUIRED_QUIET``
-    If this variable evaluates to a boolean true value, all status messages
-    associated with the check will be suppressed.
-
-  The check is only performed once, with the result cached in the variable
-  named by ``<resultVar>``. Every subsequent CMake run will re-use this cached
-  value rather than performing the check again, even if the ``<code>`` changes.
-  In order to force the check to be re-evaluated, the variable named by
+  The check is only performed once, with the result cached in the variable named
+  by ``<resultVar>``. Every subsequent CMake run will re-use this cached value
+  rather than performing the check again, even if the ``<code>`` changes. In
+  order to force the check to be re-evaluated, the variable named by
   ``<resultVar>`` must be manually removed from the cache.
 
+  The compile and link commands can be influenced by setting any of the
+  following variables prior to calling ``check_objcxx_source_compiles()``
+
+.. include:: /module/CMAKE_REQUIRED_FLAGS.txt
+
+.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt
+
+.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt
+
+.. include:: /module/CMAKE_REQUIRED_QUIET.txt
+
 #]=======================================================================]
 
 include_guard(GLOBAL)

+ 19 - 39
Modules/CheckOBJCXXSourceRuns.cmake

@@ -23,47 +23,27 @@ subsequently be run.
   be set to 1, otherwise it will be set to an value that evaluates to boolean
   false (e.g. an empty string or an error message).
 
-  The underlying check is performed by the :command:`try_run` command. The
-  compile and link commands can be influenced by setting any of the following
-  variables prior to calling ``check_objcxx_source_runs()``:
-
-  ``CMAKE_REQUIRED_FLAGS``
-    Additional flags to pass to the compiler. Note that the contents of
-    :variable:`CMAKE_OBJCXX_FLAGS <CMAKE_<LANG>_FLAGS>` and its associated
-    configuration-specific variable are automatically added to the compiler
-    command before the contents of ``CMAKE_REQUIRED_FLAGS``.
-
-  ``CMAKE_REQUIRED_DEFINITIONS``
-    A :ref:`;-list <CMake Language Lists>` of compiler definitions of the form
-    ``-DFOO`` or ``-DFOO=bar``. A definition for the name specified by
-    ``<resultVar>`` will also be added automatically.
-
-  ``CMAKE_REQUIRED_INCLUDES``
-    A :ref:`;-list <CMake Language Lists>` of header search paths to pass to
-    the compiler. These will be the only header search paths used by
-    ``try_run()``, i.e. the contents of the :prop_dir:`INCLUDE_DIRECTORIES`
-    directory property will be ignored.
-
-  ``CMAKE_REQUIRED_LINK_OPTIONS``
-    A :ref:`;-list <CMake Language Lists>` of options to add to the link
-    command (see :command:`try_run` for further details).
-
-  ``CMAKE_REQUIRED_LIBRARIES``
-    A :ref:`;-list <CMake Language Lists>` of libraries to add to the link
-    command. These can be the name of system libraries or they can be
-    :ref:`Imported Targets <Imported Targets>` (see :command:`try_run` for
-    further details).
-
-  ``CMAKE_REQUIRED_QUIET``
-    If this variable evaluates to a boolean true value, all status messages
-    associated with the check will be suppressed.
-
-  The check is only performed once, with the result cached in the variable
-  named by ``<resultVar>``. Every subsequent CMake run will re-use this cached
-  value rather than performing the check again, even if the ``<code>`` changes.
-  In order to force the check to be re-evaluated, the variable named by
+  The check is only performed once, with the result cached in the variable named
+  by ``<resultVar>``. Every subsequent CMake run will re-use this cached value
+  rather than performing the check again, even if the ``<code>`` changes. In
+  order to force the check to be re-evaluated, the variable named by
   ``<resultVar>`` must be manually removed from the cache.
 
+  The compile and link commands can be influenced by setting any of the
+  following variables prior to calling ``check_objcxx_source_runs()``
+
+.. include:: /module/CMAKE_REQUIRED_FLAGS.txt
+
+.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt
+
+.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt
+
+.. include:: /module/CMAKE_REQUIRED_QUIET.txt
+
 #]=======================================================================]
 
 include_guard(GLOBAL)

+ 12 - 14
Modules/CheckPrototypeDefinition.cmake

@@ -35,20 +35,18 @@ Check if the prototype we expect is correct.
 The following variables may be set before calling this function to modify
 the way the check is run:
 
-``CMAKE_REQUIRED_FLAGS``
-  string of compile command line flags.
-``CMAKE_REQUIRED_DEFINITIONS``
-  list of macros to define (-DFOO=bar).
-``CMAKE_REQUIRED_INCLUDES``
-  list of include directories.
-``CMAKE_REQUIRED_LINK_OPTIONS``
-  .. versionadded:: 3.14
-    list of options to pass to link command.
-``CMAKE_REQUIRED_LIBRARIES``
-  list of libraries to link.
-``CMAKE_REQUIRED_QUIET``
-  .. versionadded:: 3.1
-    execute quietly without messages.
+.. include:: /module/CMAKE_REQUIRED_FLAGS.txt
+
+.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt
+
+.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt
+
+.. include:: /module/CMAKE_REQUIRED_QUIET.txt
+
 #]=======================================================================]
 
 #

+ 15 - 35
Modules/CheckSourceCompiles.cmake

@@ -47,47 +47,27 @@ Check if given source compiles and links into an executable.
     end program"
     HAVE_ERROR_STOP)
 
-  The underlying check is performed by the :command:`try_compile` command. The
-  compile and link commands can be influenced by setting any of the following
-  variables prior to calling ``check_source_compiles()``:
-
-  ``CMAKE_REQUIRED_FLAGS``
-    Additional flags to pass to the compiler. Note that the contents of
-    :variable:`CMAKE_<LANG>_FLAGS <CMAKE_<LANG>_FLAGS>` and its associated
-    configuration-specific variable are automatically added to the compiler
-    command before the contents of ``CMAKE_REQUIRED_FLAGS``.
-
-  ``CMAKE_REQUIRED_DEFINITIONS``
-    A :ref:`;-list <CMake Language Lists>` of compiler definitions of the form
-    ``-DFOO`` or ``-DFOO=bar``. A definition for the name specified by
-    ``<resultVar>`` will also be added automatically.
-
-  ``CMAKE_REQUIRED_INCLUDES``
-    A :ref:`;-list <CMake Language Lists>` of header search paths to pass to
-    the compiler. These will be the only header search paths used by
-    ``try_compile()``, i.e. the contents of the :prop_dir:`INCLUDE_DIRECTORIES`
-    directory property will be ignored.
-
-  ``CMAKE_REQUIRED_LINK_OPTIONS``
-    A :ref:`;-list <CMake Language Lists>` of options to add to the link
-    command (see :command:`try_compile` for further details).
-
-  ``CMAKE_REQUIRED_LIBRARIES``
-    A :ref:`;-list <CMake Language Lists>` of libraries to add to the link
-    command. These can be the name of system libraries or they can be
-    :ref:`Imported Targets <Imported Targets>` (see :command:`try_compile` for
-    further details).
-
-  ``CMAKE_REQUIRED_QUIET``
-    If this variable evaluates to a boolean true value, all status messages
-    associated with the check will be suppressed.
-
   The check is only performed once, with the result cached in the variable
   named by ``<resultVar>``. Every subsequent CMake run will re-use this cached
   value rather than performing the check again, even if the ``<code>`` changes.
   In order to force the check to be re-evaluated, the variable named by
   ``<resultVar>`` must be manually removed from the cache.
 
+  The compile and link commands can be influenced by setting any of the
+  following variables prior to calling ``check_source_compiles()``:
+
+.. include:: /module/CMAKE_REQUIRED_FLAGS.txt
+
+.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt
+
+.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt
+
+.. include:: /module/CMAKE_REQUIRED_QUIET.txt
+
 #]=======================================================================]
 
 include_guard(GLOBAL)

+ 19 - 39
Modules/CheckSourceRuns.cmake

@@ -47,47 +47,27 @@ subsequently be run.
     end program"
     HAVE_COARRAY)
 
-  The underlying check is performed by the :command:`try_run` command. The
-  compile and link commands can be influenced by setting any of the following
-  variables prior to calling ``check_source_runs()``:
-
-  ``CMAKE_REQUIRED_FLAGS``
-    Additional flags to pass to the compiler. Note that the contents of
-    :variable:`CMAKE_<LANG>_FLAGS <CMAKE_<LANG>_FLAGS>` and its associated
-    configuration-specific variable are automatically added to the compiler
-    command before the contents of ``CMAKE_REQUIRED_FLAGS``.
-
-  ``CMAKE_REQUIRED_DEFINITIONS``
-    A :ref:`;-list <CMake Language Lists>` of compiler definitions of the form
-    ``-DFOO`` or ``-DFOO=bar``. A definition for the name specified by
-    ``<resultVar>`` will also be added automatically.
-
-  ``CMAKE_REQUIRED_INCLUDES``
-    A :ref:`;-list <CMake Language Lists>` of header search paths to pass to
-    the compiler. These will be the only header search paths used by
-    ``try_run()``, i.e. the contents of the :prop_dir:`INCLUDE_DIRECTORIES`
-    directory property will be ignored.
-
-  ``CMAKE_REQUIRED_LINK_OPTIONS``
-    A :ref:`;-list <CMake Language Lists>` of options to add to the link
-    command (see :command:`try_run` for further details).
-
-  ``CMAKE_REQUIRED_LIBRARIES``
-    A :ref:`;-list <CMake Language Lists>` of libraries to add to the link
-    command. These can be the name of system libraries or they can be
-    :ref:`Imported Targets <Imported Targets>` (see :command:`try_run` for
-    further details).
-
-  ``CMAKE_REQUIRED_QUIET``
-    If this variable evaluates to a boolean true value, all status messages
-    associated with the check will be suppressed.
-
-  The check is only performed once, with the result cached in the variable
-  named by ``<resultVar>``. Every subsequent CMake run will re-use this cached
-  value rather than performing the check again, even if the ``<code>`` changes.
-  In order to force the check to be re-evaluated, the variable named by
+  The check is only performed once, with the result cached in the variable named
+  by ``<resultVar>``. Every subsequent CMake run will re-use this cached value
+  rather than performing the check again, even if the ``<code>`` changes. In
+  order to force the check to be re-evaluated, the variable named by
   ``<resultVar>`` must be manually removed from the cache.
 
+  The compile and link commands can be influenced by setting any of the
+  following variables prior to calling ``check_source_runs()``
+
+.. include:: /module/CMAKE_REQUIRED_FLAGS.txt
+
+.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt
+
+.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt
+
+.. include:: /module/CMAKE_REQUIRED_QUIET.txt
+
 #]=======================================================================]
 
 include_guard(GLOBAL)

+ 11 - 14
Modules/CheckStructHasMember.cmake

@@ -26,20 +26,17 @@ Check if the given struct or class has the specified member variable
 The following variables may be set before calling this macro to modify
 the way the check is run:
 
-``CMAKE_REQUIRED_FLAGS``
-  string of compile command line flags.
-``CMAKE_REQUIRED_DEFINITIONS``
-  list of macros to define (-DFOO=bar).
-``CMAKE_REQUIRED_INCLUDES``
-  list of include directories.
-``CMAKE_REQUIRED_LINK_OPTIONS``
-  .. versionadded:: 3.14
-    list of options to pass to link command.
-``CMAKE_REQUIRED_LIBRARIES``
-  list of libraries to link.
-``CMAKE_REQUIRED_QUIET``
-  .. versionadded:: 3.1
-    execute quietly without messages.
+.. include:: /module/CMAKE_REQUIRED_FLAGS.txt
+
+.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt
+
+.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt
+
+.. include:: /module/CMAKE_REQUIRED_QUIET.txt
 
 
 Example:

+ 11 - 16
Modules/CheckSymbolExists.cmake

@@ -31,22 +31,17 @@ If the check needs to be done in C++, consider using
 The following variables may be set before calling this macro to modify
 the way the check is run:
 
-``CMAKE_REQUIRED_FLAGS``
-  string of compile command line flags.
-``CMAKE_REQUIRED_DEFINITIONS``
-  a :ref:`;-list <CMake Language Lists>` of macros to define (-DFOO=bar).
-``CMAKE_REQUIRED_INCLUDES``
-  a :ref:`;-list <CMake Language Lists>` of header search paths to pass to
-  the compiler.
-``CMAKE_REQUIRED_LINK_OPTIONS``
-  .. versionadded:: 3.14
-    a :ref:`;-list <CMake Language Lists>` of options to add to the link command.
-``CMAKE_REQUIRED_LIBRARIES``
-  a :ref:`;-list <CMake Language Lists>` of libraries to add to the link
-  command. See policy :policy:`CMP0075`.
-``CMAKE_REQUIRED_QUIET``
-  .. versionadded:: 3.1
-    execute quietly without messages.
+.. include:: /module/CMAKE_REQUIRED_FLAGS.txt
+
+.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt
+
+.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt
+
+.. include:: /module/CMAKE_REQUIRED_QUIET.txt
 
 For example:
 

+ 12 - 14
Modules/CheckTypeSize.cmake

@@ -67,20 +67,18 @@ member you can do something like this:
 The following variables may be set before calling this macro to modify
 the way the check is run:
 
-``CMAKE_REQUIRED_FLAGS``
-  string of compile command line flags.
-``CMAKE_REQUIRED_DEFINITIONS``
-  list of macros to define (-DFOO=bar).
-``CMAKE_REQUIRED_INCLUDES``
-  list of include directories.
-``CMAKE_REQUIRED_LINK_OPTIONS``
-  .. versionadded:: 3.14
-    list of options to pass to link command.
-``CMAKE_REQUIRED_LIBRARIES``
-  list of libraries to link.
-``CMAKE_REQUIRED_QUIET``
-  .. versionadded:: 3.1
-    execute quietly without messages.
+.. include:: /module/CMAKE_REQUIRED_FLAGS.txt
+
+.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_INCLUDES.txt
+
+.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt
+
+.. include:: /module/CMAKE_REQUIRED_QUIET.txt
+
 ``CMAKE_EXTRA_INCLUDE_FILES``
   list of extra headers to include.
 #]=======================================================================]

+ 10 - 12
Modules/CheckVariableExists.cmake

@@ -26,18 +26,16 @@ Check if the variable exists.
 The following variables may be set before calling this macro to modify
 the way the check is run:
 
-``CMAKE_REQUIRED_FLAGS``
-  string of compile command line flags.
-``CMAKE_REQUIRED_DEFINITIONS``
-  list of macros to define (-DFOO=bar).
-``CMAKE_REQUIRED_LINK_OPTIONS``
-  .. versionadded:: 3.14
-    list of options to pass to link command.
-``CMAKE_REQUIRED_LIBRARIES``
-  list of libraries to link.
-``CMAKE_REQUIRED_QUIET``
-  .. versionadded:: 3.1
-    execute quietly without messages.
+.. include:: /module/CMAKE_REQUIRED_FLAGS.txt
+
+.. include:: /module/CMAKE_REQUIRED_DEFINITIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_LINK_OPTIONS.txt
+
+.. include:: /module/CMAKE_REQUIRED_LIBRARIES.txt
+
+.. include:: /module/CMAKE_REQUIRED_QUIET.txt
+
 #]=======================================================================]
 
 include_guard(GLOBAL)