Blame cmake/CheckTypeExists.cmake

Packit 0b5880
# - Check if the system has the specified type
Packit 0b5880
# CHECK_TYPE_EXISTS (TYPE HEADER VARIABLE)
Packit 0b5880
#
Packit 0b5880
#  TYPE - the name of the type or struct or class you are interested in
Packit 0b5880
#  HEADER - the header(s) where the prototype should be declared
Packit 0b5880
#  VARIABLE - variable to store the result
Packit 0b5880
#
Packit 0b5880
# The following variables may be set before calling this macro to
Packit 0b5880
# modify the way the check is run:
Packit 0b5880
#
Packit 0b5880
#  CMAKE_REQUIRED_FLAGS = string of compile command line flags
Packit 0b5880
#  CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
Packit 0b5880
#  CMAKE_REQUIRED_INCLUDES = list of include directories
Packit 0b5880
# Copyright (c) 2009, Michihiro NAKAJIMA
Packit 0b5880
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
Packit 0b5880
#
Packit 0b5880
# Redistribution and use is allowed according to the terms of the BSD license.
Packit 0b5880
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
Packit 0b5880
Packit 0b5880
Packit 0b5880
INCLUDE(CheckCSourceCompiles)
Packit 0b5880
Packit 0b5880
MACRO (CHECK_TYPE_EXISTS _TYPE _HEADER _RESULT)
Packit 0b5880
   SET(_INCLUDE_FILES)
Packit 0b5880
   FOREACH (it ${_HEADER})
Packit 0b5880
      SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n")
Packit 0b5880
   ENDFOREACH (it)
Packit 0b5880
Packit 0b5880
   SET(_CHECK_TYPE_EXISTS_SOURCE_CODE "
Packit 0b5880
${_INCLUDE_FILES}
Packit 0b5880
int main()
Packit 0b5880
{
Packit 0b5880
   static ${_TYPE} tmp;
Packit 0b5880
   if (sizeof(tmp))
Packit 0b5880
      return 0;
Packit 0b5880
  return 0;
Packit 0b5880
}
Packit 0b5880
")
Packit 0b5880
   CHECK_C_SOURCE_COMPILES("${_CHECK_TYPE_EXISTS_SOURCE_CODE}" ${_RESULT})
Packit 0b5880
Packit 0b5880
ENDMACRO (CHECK_TYPE_EXISTS)
Packit 0b5880