gentoo/dev-util/cmake/files/cmake-3.9.0_rc2-FindPythonInterp.patch

44 lines
1.4 KiB
Diff
Raw Normal View History

From 325652950ecc5d72f0a6ac843889a048fe9e32cf Mon Sep 17 00:00:00 2001
From: Lars Wendler <polynomial-c@gentoo.org>
Date: Fri, 9 Jun 2017 02:08:03 +0200
Subject: [PATCH] Don't mess with python versions too much
---
Modules/FindPythonInterp.cmake | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake
index 64b98a879..73bd35b56 100644
--- a/Modules/FindPythonInterp.cmake
+++ b/Modules/FindPythonInterp.cmake
@@ -64,6 +64,11 @@ if(PythonInterp_FIND_VERSION)
else()
set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS})
endif()
+
+if (CMAKE_GENTOO_BUILD OR CMAKE_BUILD_TYPE STREQUAL Gentoo)
+ set(_Python_NAMES python)
+endif()
+
find_program(PYTHON_EXECUTABLE NAMES ${_Python_NAMES})
# Set up the versions we know about, in the order we will search. Always add
@@ -88,12 +93,13 @@ unset(_PYTHON2_VERSIONS)
unset(_PYTHON3_VERSIONS)
# Search for newest python version if python executable isn't found
-if(NOT PYTHON_EXECUTABLE)
+if(NOT PYTHON_EXECUTABLE AND NOT (CMAKE_GENTOO_BUILD OR CMAKE_BUILD_TYPE STREQUAL Gentoo))
foreach(_CURRENT_VERSION IN LISTS _Python_VERSIONS)
set(_Python_NAMES python${_CURRENT_VERSION})
if(CMAKE_HOST_WIN32)
list(APPEND _Python_NAMES python)
endif()
+
find_program(PYTHON_EXECUTABLE
NAMES ${_Python_NAMES}
PATHS
--
2.13.1