FindPythonInterp.cmake 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # - Find python interpreter
  2. # This module finds if Python interpreter is installed and determines where the
  3. # executables are. This code sets the following variables:
  4. #
  5. # PYTHONINTERP_FOUND - Was the Python executable found
  6. # PYTHON_EXECUTABLE - path to the Python interpreter
  7. #
  8. #=============================================================================
  9. # Copyright 2005-2009 Kitware, Inc.
  10. #
  11. # Distributed under the OSI-approved BSD License (the "License");
  12. # see accompanying file Copyright.txt for details.
  13. #
  14. # This software is distributed WITHOUT ANY WARRANTY; without even the
  15. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  16. # See the License for more information.
  17. #=============================================================================
  18. # (To distributed this file outside of CMake, substitute the full
  19. # License text for the above reference.)
  20. FIND_PROGRAM(PYTHON_EXECUTABLE
  21. NAMES python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5 python
  22. PATHS
  23. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.6\\InstallPath]
  24. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath]
  25. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath]
  26. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath]
  27. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.2\\InstallPath]
  28. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.1\\InstallPath]
  29. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.0\\InstallPath]
  30. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.6\\InstallPath]
  31. [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.5\\InstallPath]
  32. )
  33. # handle the QUIETLY and REQUIRED arguments and set PYTHONINTERP_FOUND to TRUE if
  34. # all listed variables are TRUE
  35. INCLUDE(FindPackageHandleStandardArgs)
  36. FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonInterp DEFAULT_MSG PYTHON_EXECUTABLE)
  37. MARK_AS_ADVANCED(PYTHON_EXECUTABLE)