|
Packit |
ed3af9 |
#=============================================================================
|
|
Packit |
ed3af9 |
# Copyright 2010 Alexander Neundorf <neundorf@kde.org>
|
|
Packit |
ed3af9 |
#
|
|
Packit |
ed3af9 |
# Redistribution and use in source and binary forms, with or without
|
|
Packit |
ed3af9 |
# modification, are permitted provided that the following conditions are
|
|
Packit |
ed3af9 |
# met:
|
|
Packit |
ed3af9 |
#
|
|
Packit |
ed3af9 |
# * Redistributions of source code must retain the above copyright notice,
|
|
Packit |
ed3af9 |
# this list of conditions and the following disclaimer.
|
|
Packit |
ed3af9 |
#
|
|
Packit |
ed3af9 |
# * Redistributions in binary form must reproduce the above copyright notice,
|
|
Packit |
ed3af9 |
# this list of conditions and the following disclaimer in the documentation
|
|
Packit |
ed3af9 |
# and/or other materials provided with the distribution.
|
|
Packit |
ed3af9 |
#
|
|
Packit |
ed3af9 |
# * The names of Kitware, Inc., the Insight Consortium, or the names of
|
|
Packit |
ed3af9 |
# any consortium members, or of any contributors, may not be used to
|
|
Packit |
ed3af9 |
# endorse or promote products derived from this software without
|
|
Packit |
ed3af9 |
# specific prior written permission.
|
|
Packit |
ed3af9 |
#
|
|
Packit |
ed3af9 |
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''
|
|
Packit |
ed3af9 |
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
Packit |
ed3af9 |
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
Packit |
ed3af9 |
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
|
|
Packit |
ed3af9 |
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
Packit |
ed3af9 |
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
Packit |
ed3af9 |
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
Packit |
ed3af9 |
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
Packit |
ed3af9 |
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
Packit |
ed3af9 |
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Packit |
ed3af9 |
#=============================================================================
|
|
Packit |
ed3af9 |
|
|
Packit |
ed3af9 |
# AWI, downloaded from KDE repository since has not yet been transferred
|
|
Packit |
ed3af9 |
# to cmake repository as of 2006-07-31.
|
|
Packit |
ed3af9 |
# http://websvn.kde.org/trunk/KDE/kdelibs/cmake/modules/CheckPrototypeExists.cmake?rev=505849&view=markup
|
|
Packit |
ed3af9 |
#
|
|
Packit |
ed3af9 |
# - Check if the prototype for a function exists.
|
|
Packit |
ed3af9 |
# CHECK_PROTOTYPE_EXISTS (FUNCTION HEADER VARIABLE)
|
|
Packit |
ed3af9 |
#
|
|
Packit |
ed3af9 |
# FUNCTION - the name of the function you are looking for
|
|
Packit |
ed3af9 |
# HEADER - the header(s) where the prototype should be declared
|
|
Packit |
ed3af9 |
# VARIABLE - variable to store the result
|
|
Packit |
ed3af9 |
#
|
|
Packit |
ed3af9 |
|
|
Packit |
ed3af9 |
INCLUDE(CheckCXXSourceCompiles)
|
|
Packit |
ed3af9 |
|
|
Packit |
ed3af9 |
MACRO(CHECK_PROTOTYPE_EXISTS _SYMBOL _HEADER _RESULT)
|
|
Packit |
ed3af9 |
SET(_INCLUDE_FILES)
|
|
Packit |
ed3af9 |
FOREACH(it ${_HEADER})
|
|
Packit |
ed3af9 |
SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n")
|
|
Packit |
ed3af9 |
ENDFOREACH(it)
|
|
Packit |
ed3af9 |
|
|
Packit |
ed3af9 |
SET(_CHECK_PROTO_EXISTS_SOURCE_CODE "
|
|
Packit |
ed3af9 |
${_INCLUDE_FILES}
|
|
Packit |
ed3af9 |
void cmakeRequireSymbol(int dummy,...){(void)dummy;}
|
|
Packit |
ed3af9 |
int main()
|
|
Packit |
ed3af9 |
{
|
|
Packit |
ed3af9 |
#ifndef ${_SYMBOL}
|
|
Packit |
ed3af9 |
#ifndef _MSC_VER
|
|
Packit |
ed3af9 |
cmakeRequireSymbol(0,&${_SYMBOL});
|
|
Packit |
ed3af9 |
#else
|
|
Packit |
ed3af9 |
char i = sizeof(&${_SYMBOL});
|
|
Packit |
ed3af9 |
#endif
|
|
Packit |
ed3af9 |
#endif
|
|
Packit |
ed3af9 |
return 0;
|
|
Packit |
ed3af9 |
}
|
|
Packit |
ed3af9 |
")
|
|
Packit |
ed3af9 |
CHECK_CXX_SOURCE_COMPILES("${_CHECK_PROTO_EXISTS_SOURCE_CODE}" ${_RESULT})
|
|
Packit |
ed3af9 |
ENDMACRO(CHECK_PROTOTYPE_EXISTS _SYMBOL _HEADER _RESULT)
|
|
Packit |
ed3af9 |
|