summaryrefslogtreecommitdiffstats
path: root/config/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'config/cmake')
-rw-r--r--config/cmake/FindPythonNumPy.cmake28
1 files changed, 28 insertions, 0 deletions
diff --git a/config/cmake/FindPythonNumPy.cmake b/config/cmake/FindPythonNumPy.cmake
new file mode 100644
index 0000000..77099a8
--- /dev/null
+++ b/config/cmake/FindPythonNumPy.cmake
@@ -0,0 +1,28 @@
+# - Find NumPy
+# Find the native numpy includes
+# This module defines
+# PYTHON_NUMPY_INCLUDE_DIR, where to find numpy/arrayobject.h, etc.
+# PYTHON_NUMPY_FOUND, If false, do not try to use numpy headers.
+
+IF (PYTHON_NUMPY_INCLUDE_DIR)
+ # in cache already
+ SET (PYTHON_NUMPY_FIND_QUIETLY TRUE)
+ENDIF (PYTHON_NUMPY_INCLUDE_DIR)
+
+INCLUDE (FindPythonInterp)
+
+IF (PYTHON_EXECUTABLE)
+ EXEC_PROGRAM ("${PYTHON_EXECUTABLE}"
+ ARGS "-c \"import numpy; print numpy.get_include()\""
+ OUTPUT_VARIABLE PYTHON_NUMPY_INCLUDE_PATH
+ RETURN_VALUE PYTHON_NUMPY_NOT_FOUND)
+
+ IF (NOT ${PYTHON_NUMPY_INCLUDE_PATH} MATCHES "Traceback")
+ SET (PYTHON_NUMPY_INCLUDE_DIR ${PYTHON_NUMPY_INCLUDE_PATH} CACHE STRING "Numpy include path.")
+ ENDIF (NOT ${PYTHON_NUMPY_INCLUDE_PATH} MATCHES "Traceback")
+ENDIF(PYTHON_EXECUTABLE)
+
+INCLUDE (FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS (PYTHON_NUMPY DEFAULT_MSG PYTHON_NUMPY_INCLUDE_DIR)
+
+MARK_AS_ADVANCED (PYTHON_NUMPY_INCLUDE_DIR)