ngompa / rpms / cmake

Forked from rpms/cmake 4 years ago
Clone
Blob Blame History Raw
diff -rupN cmake/Modules/FindPythonLibs.cmake new/Modules/FindPythonLibs.cmake
--- cmake/Modules/FindPythonLibs.cmake	2013-04-12 14:09:08.470669049 -0500
+++ new/Modules/FindPythonLibs.cmake	2013-04-12 15:41:15.789496153 -0500
@@ -69,10 +69,21 @@ endif()
 
 # Set up the versions we know about, in the order we will search. Always add
 # the user supplied additional versions to the front.
-set(_Python_VERSIONS
-  ${Python_ADDITIONAL_VERSIONS}
-  ${_PYTHON_FIND_OTHER_VERSIONS}
-  )
+# If FindPythonInterp has already found the major and minor version, 
+# insert that version between the user supplied versions and the stock
+# version list. 
+if(DEFINED PYTHON_VERSION_MAJOR AND DEFINED PYTHON_VERSION_MINOR)
+  set(_Python_VERSIONS
+    ${Python_ADDITIONAL_VERSIONS}
+    ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}
+    ${_PYTHON_FIND_OTHER_VERSIONS}
+    )
+else()
+  set(_Python_VERSIONS
+    ${Python_ADDITIONAL_VERSIONS}
+    ${_PYTHON_FIND_OTHER_VERSIONS}
+    )
+endif()
 
 unset(_PYTHON_FIND_OTHER_VERSIONS)
 unset(_PYTHON1_VERSIONS)