Chris@49
|
1 # - Check if the prototype for a single argument math function exists.
|
Chris@49
|
2 # ARMA_CHECK_MATH_PROTO (FUNCTION NAMESPACE HEADER VARIABLE)
|
Chris@49
|
3 #
|
Chris@49
|
4 # FUNCTION - the name of the single argument math function you are looking for
|
Chris@49
|
5 # NAMESPACE - the name of the namespace
|
Chris@49
|
6 # HEADER - the header(s) where the prototype should be declared
|
Chris@49
|
7 # VARIABLE - variable to store the result
|
Chris@49
|
8 #
|
Chris@49
|
9 # The following variables may be set before calling this macro to
|
Chris@49
|
10 # modify the way the check is run:
|
Chris@49
|
11 #
|
Chris@49
|
12 # CMAKE_REQUIRED_FLAGS = string of compile command line flags
|
Chris@49
|
13 # CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
|
Chris@49
|
14 # CMAKE_REQUIRED_INCLUDES = list of include directories
|
Chris@49
|
15
|
Chris@49
|
16 # adapted from "CheckPrototypeExists.cmake"
|
Chris@49
|
17 # ( http://websvn.kde.org/trunk/KDE/kdelibs/cmake/modules/CheckPrototypeExists.cmake )
|
Chris@49
|
18 # on 2009-06-19 by Conrad Sanderson (conradsand at ieee dot org)
|
Chris@49
|
19
|
Chris@49
|
20 # original copyright for "CheckPrototypeExists.cmake":
|
Chris@49
|
21 #
|
Chris@49
|
22 # Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
|
Chris@49
|
23 #
|
Chris@49
|
24 # Redistribution and use is allowed according to the terms of the BSD license.
|
Chris@49
|
25 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
Chris@49
|
26
|
Chris@49
|
27
|
Chris@49
|
28 INCLUDE(CheckCXXSourceCompiles)
|
Chris@49
|
29
|
Chris@49
|
30 MACRO (ARMA_CHECK_MATH_PROTO _SYMBOL _NAMESPACE _HEADER _RESULT)
|
Chris@49
|
31
|
Chris@49
|
32 SET(_INCLUDE_FILES)
|
Chris@49
|
33
|
Chris@49
|
34 FOREACH (it ${_HEADER})
|
Chris@49
|
35 SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n")
|
Chris@49
|
36 ENDFOREACH (it)
|
Chris@49
|
37
|
Chris@49
|
38 SET(_TMP_SOURCE_CODE "
|
Chris@49
|
39 ${_INCLUDE_FILES}
|
Chris@49
|
40 int main()
|
Chris@49
|
41 {
|
Chris@49
|
42 #if !defined(${_SYMBOL})
|
Chris@49
|
43 int i = (${_NAMESPACE}::${_SYMBOL})(1.0);
|
Chris@49
|
44 #endif
|
Chris@49
|
45 return 0;
|
Chris@49
|
46 }
|
Chris@49
|
47 ")
|
Chris@49
|
48
|
Chris@49
|
49 CHECK_CXX_SOURCE_COMPILES("${_TMP_SOURCE_CODE}" ${_RESULT})
|
Chris@49
|
50
|
Chris@49
|
51 ENDMACRO (ARMA_CHECK_MATH_PROTO _SYMBOL _NAMESPACE _HEADER _RESULT)
|