CheckInclude{FileCXX,File,Files}: Add examples

This adds some examples to modules for checking headers.
This commit is contained in:
Peter Kokot
2025-03-06 23:10:28 +01:00
parent c2d9b5944a
commit d3b7f0d272
3 changed files with 71 additions and 7 deletions
+18 -3
View File
@@ -35,9 +35,24 @@ the way the check is run:
.. 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
using the ``CXX`` language.
Examples
^^^^^^^^
Checking whether the ``C`` header ``<unistd.h>`` exists and storing the check
result in the ``HAVE_UNISTD_H`` cache variable:
.. code-block:: cmake
include(CheckIncludeFile)
check_include_file(unistd.h HAVE_UNISTD_H)
See Also
^^^^^^^^
* The :module:`CheckIncludeFileCXX` module to check for single ``C++`` header.
* The :module:`CheckIncludeFiles` module to check for one or more ``C`` or
``C++`` headers at once.
#]=======================================================================]
include_guard(GLOBAL)