CheckCXXSymbolExists.cmake 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. # file Copyright.txt or https://cmake.org/licensing for details.
  3. #.rst:
  4. # CheckCXXSymbolExists
  5. # --------------------
  6. #
  7. # Check if a symbol exists as a function, variable, or macro in C++
  8. #
  9. # CHECK_CXX_SYMBOL_EXISTS(<symbol> <files> <variable>)
  10. #
  11. # Check that the <symbol> is available after including given header
  12. # <files> and store the result in a <variable>. Specify the list of
  13. # files in one argument as a semicolon-separated list.
  14. # CHECK_CXX_SYMBOL_EXISTS() can be used to check in C++ files, as
  15. # opposed to CHECK_SYMBOL_EXISTS(), which works only for C.
  16. #
  17. # If the header files define the symbol as a macro it is considered
  18. # available and assumed to work. If the header files declare the symbol
  19. # as a function or variable then the symbol must also be available for
  20. # linking. If the symbol is a type or enum value it will not be
  21. # recognized (consider using CheckTypeSize or CheckCSourceCompiles).
  22. #
  23. # The following variables may be set before calling this macro to modify
  24. # the way the check is run:
  25. #
  26. # ::
  27. #
  28. # CMAKE_REQUIRED_FLAGS = string of compile command line flags
  29. # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
  30. # CMAKE_REQUIRED_INCLUDES = list of include directories
  31. # CMAKE_REQUIRED_LIBRARIES = list of libraries to link
  32. # CMAKE_REQUIRED_QUIET = execute quietly without messages
  33. include_guard(GLOBAL)
  34. include(CheckSymbolExists)
  35. macro(CHECK_CXX_SYMBOL_EXISTS SYMBOL FILES VARIABLE)
  36. __CHECK_SYMBOL_EXISTS_IMPL("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.cxx" "${SYMBOL}" "${FILES}" "${VARIABLE}" )
  37. endmacro()