summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-03-03 15:06:19 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2014-03-03 15:06:19 (GMT)
commitc32ac3331f7933f6b80a2edebfcc9dc907df643f (patch)
treef983f15b54de64683fce04b495679b7e9bb190d5
parentace6fa5a8b047c80cfd5c10f58446226616c1663 (diff)
parent3816cd2dc7a7cc220e4f1b1e87fee986545b9cb3 (diff)
downloadCMake-c32ac3331f7933f6b80a2edebfcc9dc907df643f.zip
CMake-c32ac3331f7933f6b80a2edebfcc9dc907df643f.tar.gz
CMake-c32ac3331f7933f6b80a2edebfcc9dc907df643f.tar.bz2
Merge topic 'different-python-header-libs-exe-0013794'
3816cd2d FindPythonLibs: Find consistent Python interp, headers, libs (#13794)
-rw-r--r--Modules/FindPythonLibs.cmake13
1 files changed, 9 insertions, 4 deletions
diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake
index 0749efc..27d9e45 100644
--- a/Modules/FindPythonLibs.cmake
+++ b/Modules/FindPythonLibs.cmake
@@ -80,10 +80,15 @@ 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.
+find_package(PythonInterp QUIET)
+set(_Python_VERSIONS ${Python_ADDITIONAL_VERSIONS})
+if(DEFINED PYTHON_VERSION_MAJOR AND DEFINED PYTHON_VERSION_MINOR)
+ list(APPEND _Python_VERSIONS ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
+endif()
+list(APPEND _Python_VERSIONS ${_PYTHON_FIND_OTHER_VERSIONS})
unset(_PYTHON_FIND_OTHER_VERSIONS)
unset(_PYTHON1_VERSIONS)