Python.cmake
上传用户:king477883
上传日期:2021-03-01
资源大小:9553k
文件大小:2k
源码类别:

游戏引擎

开发平台:

C++ Builder

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