aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/cmake/Python.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/cmake/Python.cmake')
-rw-r--r--linden/indra/cmake/Python.cmake49
1 files changed, 49 insertions, 0 deletions
diff --git a/linden/indra/cmake/Python.cmake b/linden/indra/cmake/Python.cmake
new file mode 100644
index 0000000..e9505fb
--- /dev/null
+++ b/linden/indra/cmake/Python.cmake
@@ -0,0 +1,49 @@
1# -*- cmake -*-
2
3set(PYTHONINTERP_FOUND)
4
5if (WINDOWS)
6 # On Windows, explicitly avoid Cygwin Python.
7
8 find_program(PYTHON_EXECUTABLE
9 NAMES python25.exe python23.exe python.exe
10 NO_DEFAULT_PATH # added so that cmake does not find cygwin python
11 PATHS
12 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath]
13 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]
14 [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]
15 )
16elseif (EXISTS /etc/debian_version)
17 # On Debian and Ubuntu, avoid Python 2.4 if possible.
18
19 find_program(PYTHON_EXECUTABLE python2.5 python2.3 python PATHS /usr/bin)
20
21 if (PYTHON_EXECUTABLE)
22 set(PYTHONINTERP_FOUND ON)
23 endif (PYTHON_EXECUTABLE)
24elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
25 # On MAC OS X be sure to search standard locations first
26
27 string(REPLACE ":" ";" PATH_LIST "$ENV{PATH}")
28 find_program(PYTHON_EXECUTABLE
29 NAMES python python25 python24 python23
30 NO_DEFAULT_PATH # Avoid searching non-standard locations first
31 PATHS
32 /bin
33 /usr/bin
34 /usr/local/bin
35 ${PATH_LIST}
36 )
37
38 if (PYTHON_EXECUTABLE)
39 set(PYTHONINTERP_FOUND ON)
40 endif (PYTHON_EXECUTABLE)
41else (WINDOWS)
42 include(FindPythonInterp)
43endif (WINDOWS)
44
45if (NOT PYTHON_EXECUTABLE)
46 message(FATAL_ERROR "No Python interpreter found")
47endif (NOT PYTHON_EXECUTABLE)
48
49mark_as_advanced(PYTHON_EXECUTABLE)