PageRenderTime 7ms CodeModel.GetById 2ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/cmake/Python.cmake

https://bitbucket.org/lindenlab/viewer-beta/
CMake | 56 lines | 43 code | 9 blank | 4 comment | 5 complexity | 5793b2a1679e1a93c37adeefa553fe5b MD5 | raw file
 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.7\\InstallPath]
13    [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.6\\InstallPath]
14    [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath]
15    [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]
16    [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]
17    [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.7\\InstallPath]
18    [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.6\\InstallPath]
19    [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath]
20    [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]
21    [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]
22    )
23elseif (EXISTS /etc/debian_version)
24  # On Debian and Ubuntu, avoid Python 2.4 if possible.
25
26  find_program(PYTHON_EXECUTABLE python2.5 python2.3 python PATHS /usr/bin)
27
28  if (PYTHON_EXECUTABLE)
29    set(PYTHONINTERP_FOUND ON)
30  endif (PYTHON_EXECUTABLE)
31elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
32  # On MAC OS X be sure to search standard locations first
33
34  string(REPLACE ":" ";" PATH_LIST "$ENV{PATH}")
35  find_program(PYTHON_EXECUTABLE
36    NAMES python python25 python24 python23
37    NO_DEFAULT_PATH # Avoid searching non-standard locations first
38    PATHS
39    /bin
40    /usr/bin
41    /usr/local/bin
42    ${PATH_LIST}
43    )
44
45  if (PYTHON_EXECUTABLE)
46    set(PYTHONINTERP_FOUND ON)
47  endif (PYTHON_EXECUTABLE)
48else (WINDOWS)
49  include(FindPythonInterp)
50endif (WINDOWS)
51
52if (NOT PYTHON_EXECUTABLE)
53  message(FATAL_ERROR "No Python interpreter found")
54endif (NOT PYTHON_EXECUTABLE)
55
56mark_as_advanced(PYTHON_EXECUTABLE)