summaryrefslogtreecommitdiff
path: root/cmake/modules/LocatePythonExecutable.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/modules/LocatePythonExecutable.cmake')
-rw-r--r--cmake/modules/LocatePythonExecutable.cmake41
1 files changed, 13 insertions, 28 deletions
diff --git a/cmake/modules/LocatePythonExecutable.cmake b/cmake/modules/LocatePythonExecutable.cmake
index e1d7eeba3f..125ed5fff5 100644
--- a/cmake/modules/LocatePythonExecutable.cmake
+++ b/cmake/modules/LocatePythonExecutable.cmake
@@ -2,32 +2,17 @@
# calling FindPythonInterp in order to keep us from using Cygwin's Python.
# http://public.kitware.com/Bug/view.php?id=13818
-if(WIN32)
- # First check the HKLM and HKCU "App Paths" keys.
- if(NOT PYTHON_EXECUTABLE)
- get_filename_component(PYTHON_EXECUTABLE
- "[HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\Python.exe]"
- ABSOLUTE CACHE
- )
- endif()
- if(NOT PYTHON_EXECUTABLE)
- get_filename_component(PYTHON_EXECUTABLE
- "[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\Python.exe]"
- ABSOLUTE CACHE
- )
- endif()
- if(NOT PYTHON_EXECUTABLE)
- foreach(_major_version 3 2)
- foreach(_minor_version 7 6 5 4 3 2 1)
- find_program(PYTHON_EXECUTABLE
- python.exe
- PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_major_version}.${_minor_version}\\InstallPath]
- NO_DEFAULT_PATH
- )
- if (PYTHON_EXECUTABLE)
- break()
- endif()
- endforeach()
+if(NOT PYTHON_EXECUTABLE AND WIN32)
+ foreach(_major_version 3 2)
+ foreach(_minor_version 7 6 5 4 3 2 1)
+ find_program(PYTHON_EXECUTABLE
+ python.exe
+ PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_major_version}.${_minor_version}\\InstallPath]
+ NO_DEFAULT_PATH
+ )
+ if (PYTHON_EXECUTABLE)
+ break()
+ endif()
endforeach()
- endif()
-endif(WIN32) \ No newline at end of file
+ endforeach()
+endif() \ No newline at end of file