1 include(CMakeFindDependencyMacro)
2 find_dependency(
"Python${VTK_PYTHON_VERSION}" COMPONENTS Interpreter)
4 COMMAND
"${Python${VTK_PYTHON_VERSION}_EXECUTABLE}" -c
6 OUTPUT_VARIABLE _mpi4py_out
7 ERROR_VARIABLE _mpi4py_out
8 RESULT_VARIABLE _mpi4py_res)
13 if (NOT mpi4py_INCLUDE_DIR OR NOT EXISTS
"${mpi4py_INCLUDE_DIR}")
15 COMMAND
"${Python${VTK_PYTHON_VERSION}_EXECUTABLE}" -c
16 "import mpi4py; print(mpi4py.get_include())" 17 OUTPUT_VARIABLE _mpi4py_INCLUDE_DIR
18 RESULT_VARIABLE _mpi4py_include_dir_res
19 OUTPUT_STRIP_TRAILING_WHITESPACE)
20 if (_mpi4py_include_dir_res)
23 set(mpi4py_INCLUDE_DIR
"${_mpi4py_INCLUDE_DIR}" 24 CACHE INTERNAL
"Path of the MPI4Py include directory")
27 include(FindPackageHandleStandardArgs)
28 find_package_handle_standard_args(mpi4py
29 REQUIRED_VARS mpi4py_INCLUDE_DIR)
31 if (mpi4py_FOUND AND NOT TARGET mpi4py::mpi4py)
32 add_library(mpi4py::mpi4py INTERFACE IMPORTED)
33 set_target_properties(mpi4py::mpi4py
35 INTERFACE_INCLUDE_DIRECTORIES
"${mpi4py_INCLUDE_DIR}")