Blame build/cmake/CheckTypeExists.cmake

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