Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
FindNumpy.cmake
Go to the documentation of this file.
1 # Variables set by this script
2 # NUMPY_FOUND
3 # NUMPY_INCLUDE_DIR
4 find_package(PackageHandleStandardArgs)
5 
6 # search for the runtime if it's not already set
7 if( NOT DEFINED PYTHON_EXECUTABLE )
8  FIND_PACKAGE(PythonLibs REQUIRED)
9  FIND_PACKAGE(PythonInterp REQUIRED)
10 endif()
11 
12 set(_python ${PYTHON_EXECUTABLE})
13 if(UNIX)
14  STRING(REPLACE " " "\ " _python ${PYTHON_EXECUTABLE})
15 endif()
16 
17 execute_process (
18  COMMAND ${_python} -c "import os; os.environ['DISTUTILS_USE_SDK']='1'; import numpy.distutils; print numpy.distutils.misc_util.get_numpy_include_dirs()[0]"
19  OUTPUT_VARIABLE output
20  OUTPUT_STRIP_TRAILING_WHITESPACE
21  )
22 
23 if(DEFINED output AND EXISTS ${output} )
24  set (NUMPY_INCLUDE_DIR ${output})
25 endif()
26 
27 FIND_PACKAGE_HANDLE_STANDARD_ARGS(Numpy DEFAULT_MSG NUMPY_INCLUDE_DIR)
28 
29 MARK_AS_ADVANCED (
30  NUMPY_INCLUDE_DIR
31 )