aboutsummaryrefslogtreecommitdiffstats
path: root/extra
diff options
context:
space:
mode:
authorOliver Lee <oliverzlee@gmail.com>2015-02-13 17:14:00 +0100
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2015-02-13 18:42:46 +0200
commit02bd49bc9379e3062a718b1c16d6e2c23ea2f1a0 (patch)
tree25f926d12260b16196bb971121160aa1684c1bad /extra
parentd8d3b75e2e3b348d016f48cebc1be764061975d2 (diff)
Fix search for Python 2 with CMake
Do not assume that Python has already been found by CMake. Fix value of CMake variable PYTHON_EXECUTABLE if Python 3 was found. Change minimum supported Python version to 2.6. This fixes a bug introduced by this commit: d8d3b75e2e3b348d016f48cebc1be764061975d2
Diffstat (limited to 'extra')
-rw-r--r--extra/FindNanopb.cmake15
1 files changed, 7 insertions, 8 deletions
diff --git a/extra/FindNanopb.cmake b/extra/FindNanopb.cmake
index 513182d8..e65706ac 100644
--- a/extra/FindNanopb.cmake
+++ b/extra/FindNanopb.cmake
@@ -244,17 +244,16 @@ find_file(NANOPB_GENERATOR_EXECUTABLE
)
mark_as_advanced(NANOPB_GENERATOR_EXECUTABLE)
-# If python3 has already been found, save it and look for python2.7
-if(${PYTHON_VERSION_MAJOR} EQUAL 3)
+# If python3 has already been found, save it and look for python2.6
+if(${PYTHON_VERSION_MAJOR} AND ${PYTHON_VERSION_MAJOR} EQUAL 3)
set(PYTHON3_EXECUTABLE ${PYTHON_EXECUTABLE})
set(PYTHON_EXECUTABLE PYTHON_EXECUTABLE-NOTFOUND)
-endif()
-
-find_package(PythonInterp 2.7 REQUIRED)
-set(PYTHON2_EXECUTABLE ${PYTHON_EXECUTABLE})
-
-if(${PYTHON_VERSION_MAJOR} EQUAL 3)
+ find_package(PythonInterp 2.6 REQUIRED)
+ set(PYTHON2_EXECUTABLE ${PYTHON_EXECUTABLE})
set(PYTHON_EXECUTABLE ${PYTHON3_EXECUTABLE})
+else()
+ find_package(PythonInterp 2.6 REQUIRED)
+ set(PYTHON2_EXECUTABLE ${PYTHON_EXECUTABLE})
endif()
include(FindPackageHandleStandardArgs)