aboutsummaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2015-11-02 13:27:33 -0800
committerGerald Combs <gerald@wireshark.org>2015-11-03 00:37:29 +0000
commit6d1b6cd39db80fe8dc77c250ae795d16ce08bf41 (patch)
tree8de348a584065d96fd6abbdb851bcdb54e82e921 /cmake
parent0f4d1394371102c8fe335e4fd802f7cae4bde8fe (diff)
CMake: Look for Python using the "App Paths" key.
Query HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\Python.exe and HKCU\Software\Microsoft\Windows\CurrentVersion\App Paths\Python.exe first before trying other methods. Change-Id: I83f54f6833149c68f1626c3c17f25ffe54d8ea5d Reviewed-on: https://code.wireshark.org/review/11506 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/LocatePythonExecutable.cmake39
1 files changed, 26 insertions, 13 deletions
diff --git a/cmake/modules/LocatePythonExecutable.cmake b/cmake/modules/LocatePythonExecutable.cmake
index 125ed5fff5..603df2000a 100644
--- a/cmake/modules/LocatePythonExecutable.cmake
+++ b/cmake/modules/LocatePythonExecutable.cmake
@@ -2,17 +2,30 @@
# calling FindPythonInterp in order to keep us from using Cygwin's Python.
# http://public.kitware.com/Bug/view.php?id=13818
-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()
+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]"
+ )
+ endif()
+ if(NOT PYTHON_EXECUTABLE)
+ get_filename_component(PYTHON_EXECUTABLE
+ "[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\Python.exe]"
+ )
+ 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()
endforeach()
- endforeach()
-endif() \ No newline at end of file
+ endif()
+endif(WIN32) \ No newline at end of file