Просмотр исходного кода

CheckSymbolExists: Add examples for check_symbol_exists

Add examples in `CheckCXXSymbolExists` too.

Co-Author: Brad King <[email protected]>
Hong Xu 6 лет назад
Родитель
Сommit
bf2244681b
2 измененных файлов с 22 добавлено и 0 удалено
  1. 11 0
      Modules/CheckCXXSymbolExists.cmake
  2. 11 0
      Modules/CheckSymbolExists.cmake

+ 11 - 0
Modules/CheckCXXSymbolExists.cmake

@@ -44,6 +44,17 @@ the way the check is run:
   command. See policy :policy:`CMP0075`.
 ``CMAKE_REQUIRED_QUIET``
   execute quietly without messages.
+
+For example:
+
+.. code-block:: cmake
+
+  include(CheckCXXSymbolExists)
+
+  # Check for macro SEEK_SET
+  check_cxx_symbol_exists(SEEK_SET "cstdio" HAVE_SEEK_SET)
+  # Check for function std::fopen
+  check_cxx_symbol_exists(std::fopen "cstdio" HAVE_STD_FOPEN)
 #]=======================================================================]
 
 include_guard(GLOBAL)

+ 11 - 0
Modules/CheckSymbolExists.cmake

@@ -45,6 +45,17 @@ the way the check is run:
   command. See policy :policy:`CMP0075`.
 ``CMAKE_REQUIRED_QUIET``
   execute quietly without messages.
+
+For example:
+
+.. code-block:: cmake
+
+  include(CheckSymbolExists)
+
+  # Check for macro SEEK_SET
+  check_symbol_exists(SEEK_SET "stdio.h" HAVE_SEEK_SET)
+  # Check for function fopen
+  check_symbol_exists(fopen "stdio.h" HAVE_FOPEN)
 #]=======================================================================]
 
 include_guard(GLOBAL)