1 # - Check if the prototype for a function exists.
2 # CHECK_PROTOTYPE_EXISTS (FUNCTION HEADER VARIABLE)
4 # FUNCTION - the name of the function you are looking for
5 # HEADER - the header(s) where the prototype should be declared
6 # VARIABLE - variable to store the result
8 # The following variables may be set before calling this macro to
9 # modify the way the check is run:
11 # CMAKE_REQUIRED_FLAGS = string of compile command line flags
12 # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
13 # CMAKE_REQUIRED_INCLUDES = list of include directories
15 INCLUDE(CheckCXXSourceCompiles)
17 MACRO (CHECK_PROTOTYPE_EXISTS _SYMBOL _HEADER _RESULT)
19 FOREACH (it ${_HEADER})
20 SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n")
23 SET(_CHECK_PROTO_EXISTS_SOURCE_CODE "
28 int i = sizeof(&${_SYMBOL});
33 CHECK_CXX_SOURCE_COMPILES("${_CHECK_PROTO_EXISTS_SOURCE_CODE}" ${_RESULT})
34 ENDMACRO (CHECK_PROTOTYPE_EXISTS _SYMBOL _HEADER _RESULT)