PageRenderTime 32ms CodeModel.GetById 16ms RepoModel.GetById 0ms 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
Possible License(s): LGPL-2.1
  1. # -*- cmake -*-
  2. set(PYTHONINTERP_FOUND)
  3. if (WINDOWS)
  4. # On Windows, explicitly avoid Cygwin Python.
  5. find_program(PYTHON_EXECUTABLE
  6. NAMES python25.exe python23.exe python.exe
  7. NO_DEFAULT_PATH # added so that cmake does not find cygwin python
  8. PATHS
  9. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.7\\InstallPath]
  10. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.6\\InstallPath]
  11. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath]
  12. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]
  13. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]
  14. [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.7\\InstallPath]
  15. [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.6\\InstallPath]
  16. [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath]
  17. [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]
  18. [HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]
  19. )
  20. elseif (EXISTS /etc/debian_version)
  21. # On Debian and Ubuntu, avoid Python 2.4 if possible.
  22. find_program(PYTHON_EXECUTABLE python2.5 python2.3 python PATHS /usr/bin)
  23. if (PYTHON_EXECUTABLE)
  24. set(PYTHONINTERP_FOUND ON)
  25. endif (PYTHON_EXECUTABLE)
  26. elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
  27. # On MAC OS X be sure to search standard locations first
  28. string(REPLACE ":" ";" PATH_LIST "$ENV{PATH}")
  29. find_program(PYTHON_EXECUTABLE
  30. NAMES python python25 python24 python23
  31. NO_DEFAULT_PATH # Avoid searching non-standard locations first
  32. PATHS
  33. /bin
  34. /usr/bin
  35. /usr/local/bin
  36. ${PATH_LIST}
  37. )
  38. if (PYTHON_EXECUTABLE)
  39. set(PYTHONINTERP_FOUND ON)
  40. endif (PYTHON_EXECUTABLE)
  41. else (WINDOWS)
  42. include(FindPythonInterp)
  43. endif (WINDOWS)
  44. if (NOT PYTHON_EXECUTABLE)
  45. message(FATAL_ERROR "No Python interpreter found")
  46. endif (NOT PYTHON_EXECUTABLE)
  47. mark_as_advanced(PYTHON_EXECUTABLE)