From bd69bf7c5fd2880b794c2a2d90eae399fac6a14a Mon Sep 17 00:00:00 2001
From: Chuck Atkins <chuck.atkins@kitware.com>
Date: Wed, 28 Jun 2017 16:59:01 -0400
Subject: [PATCH] Make sure only compatible python versions get used.

Fixes #196
---
 bindings/python/CMakeLists.txt | 2 ++
 cmake/DetectOptions.cmake      | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt
index 665766a58..1f0604287 100644
--- a/bindings/python/CMakeLists.txt
+++ b/bindings/python/CMakeLists.txt
@@ -2,6 +2,8 @@ if(NOT BUILD_SHARED_LIBS)
   message(ERROR "Python bindings are only supported for shared libraries")
 endif()
 
+set(Python_ADDITIONAL_VERSIONS 3 2.7)
+find_package(PythonInterp REQUIRED)
 find_package(PythonLibsNew REQUIRED)
 
 pybind11_add_module(adios2py MODULE
diff --git a/cmake/DetectOptions.cmake b/cmake/DetectOptions.cmake
index 4ba6e3180..a484a5957 100644
--- a/cmake/DetectOptions.cmake
+++ b/cmake/DetectOptions.cmake
@@ -95,6 +95,8 @@ list(INSERT CMAKE_MODULE_PATH 0
 )
 if(ADIOS2_USE_Python STREQUAL AUTO)
   if(BUILD_SHARED_LIBS)
+    set(Python_ADDITIONAL_VERSIONS 3 2.7)
+    find_package(PythonInterp)
     find_package(PythonLibsNew)
     if(PYTHONLIBS_FOUND)
       if(ADIOS2_HAVE_MPI)
-- 
GitLab