Blame build/cmake/CheckTypeExists.cmake

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