浏览代码

Merge topic 'patch-CheckIncludeFiles-LANGUAGE'

5000f895fd CheckIncludeFiles: Document version 3.11 for LANGUAGE option

Acked-by: Kitware Robot <[email protected]>
Merge-request: !11123
Brad King 1 月之前
父节点
当前提交
c36c19d711
共有 3 个文件被更改,包括 51 次插入27 次删除
  1. 17 8
      Modules/CheckIncludeFile.cmake
  2. 15 6
      Modules/CheckIncludeFileCXX.cmake
  3. 19 13
      Modules/CheckIncludeFiles.cmake

+ 17 - 8
Modules/CheckIncludeFile.cmake

@@ -20,17 +20,26 @@ This module provides the following command:
 
 .. command:: check_include_file
 
-  Checks once whether a header file can be included in C code:
+  Checks once whether a header file exists and can be included in C code:
 
   .. code-block:: cmake
 
     check_include_file(<include> <variable> [<flags>])
 
-  This command checks once whether the given ``<include>`` header file
-  exists and can be included in a C source file.  The result of the check
-  is stored in an internal cache variable named ``<variable>``.  The
-  optional third argument may be used to add additional compilation flags
-  to the check (or use the ``CMAKE_REQUIRED_FLAGS`` variable below).
+  .. rubric:: The arguments are:
+
+  ``<include>``
+    A header file to be checked.
+
+  ``<variable>``
+    The name of the variable to store the result of the check.  This
+    variable will be created as an internal cache variable.
+
+  ``<flags>``
+    (Optional) A :ref:`semicolon-separated list <CMake Language Lists>` of
+    additional compilation flags to be added to the check.  Alternatively,
+    flags can be also specified with the ``CMAKE_REQUIRED_FLAGS`` variable
+    below.
 
   .. rubric:: Variables Affecting the Check
 
@@ -76,7 +85,7 @@ Example: Isolated Check
 In the following example, this module is used in combination with the
 :module:`CMakePushCheckState` module to temporarily modify the required
 compile definitions (via ``CMAKE_REQUIRED_DEFINITIONS``) and verify whether
-the C header ``ucontext.h`` is available.  The result is stored
+the C header ``<ucontext.h>`` is available.  The result is stored
 in the internal cache variable ``HAVE_UCONTEXT_H``.
 
 For example, on macOS, the ``ucontext`` API is deprecated, and headers may
@@ -95,7 +104,7 @@ features (values 500 or greater).
       set(CMAKE_REQUIRED_DEFINITIONS -D_XOPEN_SOURCE)
     endif()
 
-    check_include_files(ucontext.h HAVE_UCONTEXT_H)
+    check_include_file(ucontext.h HAVE_UCONTEXT_H)
   cmake_pop_check_state()
 
 See Also

+ 15 - 6
Modules/CheckIncludeFileCXX.cmake

@@ -20,17 +20,26 @@ This module provides the following command:
 
 .. command:: check_include_file_cxx
 
-  Checks once whether a header file can be included in C++ code:
+  Checks once whether a header file exists and can be included in C++ code:
 
   .. code-block:: cmake
 
     check_include_file_cxx(<include> <variable> [<flags>])
 
-  This command checks once whether the given ``<include>`` header file
-  exists and can be included in a ``CXX`` source file.  The result of the
-  check is stored in an internal cache variable named ``<variable>``.  The
-  optional third argument may be used to add additional compilation flags
-  to the check (or use the ``CMAKE_REQUIRED_FLAGS`` variable below).
+  .. rubric:: The arguments are:
+
+  ``<include>``
+    A header file to be checked.
+
+  ``<variable>``
+    The name of the variable to store the result of the check.  This
+    variable will be created as an internal cache variable.
+
+  ``<flags>``
+    (Optional) A :ref:`semicolon-separated list <CMake Language Lists>` of
+    additional compilation flags to be added to the check.  Alternatively,
+    flags can be also specified with the ``CMAKE_REQUIRED_FLAGS`` variable
+    below.
 
   .. rubric:: Variables Affecting the Check
 

+ 19 - 13
Modules/CheckIncludeFiles.cmake

@@ -20,24 +20,30 @@ This module provides the following command:
 
 .. command:: check_include_files
 
-  Checks once whether one or more header files can be included together in
-  source code:
+  Checks once whether one or more header files exist and can be included
+  together in C or C++ code:
 
   .. code-block:: cmake
 
     check_include_files(<includes> <variable> [LANGUAGE <language>])
 
-  This command checks once whether the given ``<includes>`` list of header
-  files exist and can be included together in a C or C++ source file.  The
-  result of the check is stored in an internal cache variable named
-  ``<variable>``.  Specify the ``<includes>`` argument as a
-  :ref:`semicolon-separated list <CMake Language Lists>` of header file
-  names.
-
-  If ``LANGUAGE`` is set, the specified compiler will be used to perform the
-  check.  Acceptable values are ``C`` and ``CXX``.  If not set, the C
-  compiler will be used if enabled.  If the C compiler is not enabled, the
-  C++ compiler will be used if enabled.
+  .. rubric:: The arguments are:
+
+  ``<includes>``
+    A :ref:`semicolon-separated list <CMake Language Lists>` of header
+    files to be checked.
+
+  ``<variable>``
+    The name of the variable to store the result of the check.  This
+    variable will be created as an internal cache variable.
+
+  ``LANGUAGE <language>``
+    .. versionadded:: 3.11
+
+    If set, the specified ``<language>`` compiler will be used to perform
+    the check.  Acceptable values are ``C`` and ``CXX``.  If this option is
+    not given, the C compiler will be used if enabled.  If the C compiler
+    is not enabled, the C++ compiler will be used if enabled.
 
   .. rubric:: Variables Affecting the Check