diff armadillo-2.4.4/build_aux/cmake/Modules/ARMA_CheckProto.cmake @ 0:8b6102e2a9b0

Armadillo Library
author maxzanoni76 <max.zanoni@eecs.qmul.ac.uk>
date Wed, 11 Apr 2012 09:27:06 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/armadillo-2.4.4/build_aux/cmake/Modules/ARMA_CheckProto.cmake	Wed Apr 11 09:27:06 2012 +0100
@@ -0,0 +1,53 @@
+# - Check if the prototype for a non-overloaded function exists in a specified namespace.
+# ARMA_CHECK_PROTO (FUNCTION NAMESPACE HEADER VARIABLE)
+#
+#  FUNCTION  - the name of the function you are looking for
+#  NAMESPACE - the name of the namespace
+#  HEADER    - the header(s) where the prototype should be declared
+#  VARIABLE  - variable to store the result
+#
+# The following variables may be set before calling this macro to
+# modify the way the check is run:
+#
+#  CMAKE_REQUIRED_FLAGS = string of compile command line flags
+#  CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
+#  CMAKE_REQUIRED_INCLUDES = list of include directories
+
+# adapted from "CheckPrototypeExists.cmake"
+# ( http://websvn.kde.org/trunk/KDE/kdelibs/cmake/modules/CheckPrototypeExists.cmake )
+# on 2009-06-19 by Conrad Sanderson (conradsand at ieee dot org)
+
+# original copyright for "CheckPrototypeExists.cmake":
+# 
+# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+INCLUDE(CheckCXXSourceCompiles)
+
+MACRO (ARMA_CHECK_PROTO _SYMBOL _NAMESPACE _HEADER _RESULT)
+
+  SET(_INCLUDE_FILES)
+
+  FOREACH (it ${_HEADER})
+    SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n")
+  ENDFOREACH (it)
+
+  SET(_TMP_SOURCE_CODE "
+${_INCLUDE_FILES}
+int
+main()
+  {
+  #if !defined(${_SYMBOL})
+    int i = sizeof(&(${_NAMESPACE}::${_SYMBOL}));
+  #endif
+  return 0;
+  }
+")
+
+  CHECK_CXX_SOURCE_COMPILES("${_TMP_SOURCE_CODE}" ${_RESULT})
+
+ENDMACRO (ARMA_CHECK_PROTO _SYMBOL _NAMESPACE _HEADER _RESULT)
+