Warning, /network/telepathy-logger-qt/cmake/modules/FindPythonLibrary.cmake is written in an unsupported language. File is not indexed.
0001 # FindPythonLibrary.cmake 0002 # ~~~~~~~~~~~~~~~~~~~~~~~ 0003 # Find the Python interpreter and related Python directories. 0004 # 0005 # This file defines the following variables: 0006 # 0007 # PYTHON_EXECUTABLE - The path and filename of the Python interpreter. 0008 # 0009 # PYTHON_SHORT_VERSION - The version of the Python interpreter found, 0010 # excluding the patch version number. (e.g. 2.5 and not 2.5.1)) 0011 # 0012 # PYTHON_LONG_VERSION - The version of the Python interpreter found as a human 0013 # readable string. 0014 # 0015 # PYTHON_SITE_PACKAGES_DIR - Location of the Python site-packages directory. 0016 # 0017 # PYTHON_INCLUDE_PATH - Directory holding the python.h include file. 0018 # 0019 # PYTHON_LIBRARY, PYTHON_LIBRARIES- Location of the Python library. 0020 0021 # Copyright (c) 2007, Simon Edwards <simon@simonzone.com> 0022 # Redistribution and use is allowed according to the terms of the BSD license. 0023 # For details see the accompanying COPYING-CMAKE-SCRIPTS file. 0024 0025 INCLUDE(CMakeFindFrameworks) 0026 0027 if(EXISTS PYTHON_LIBRARY) 0028 # Already in cache, be silent 0029 set(PYTHONLIBRARY_FOUND TRUE) 0030 else(EXISTS PYTHON_LIBRARY) 0031 FIND_PACKAGE(PythonInterp) 0032 0033 if(PYTHONINTERP_FOUND) 0034 FIND_FILE(_find_lib_python_py FindLibPython.py PATHS ${CMAKE_MODULE_PATH}) 0035 0036 EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} ${_find_lib_python_py} OUTPUT_VARIABLE python_config) 0037 if(python_config) 0038 STRING(REGEX REPLACE ".*exec_prefix:([^\n]+).*$" "\\1" PYTHON_PREFIX ${python_config}) 0039 STRING(REGEX REPLACE ".*\nshort_version:([^\n]+).*$" "\\1" PYTHON_SHORT_VERSION ${python_config}) 0040 STRING(REGEX REPLACE ".*\nlong_version:([^\n]+).*$" "\\1" PYTHON_LONG_VERSION ${python_config}) 0041 STRING(REGEX REPLACE ".*\npy_inc_dir:([^\n]+).*$" "\\1" PYTHON_INCLUDE_PATH ${python_config}) 0042 STRING(REGEX REPLACE ".*\nsite_packages_dir:([^\n]+).*$" "\\1" PYTHON_SITE_PACKAGES_DIR ${python_config}) 0043 STRING(REGEX REPLACE "([0-9]+).([0-9]+)" "\\1\\2" PYTHON_SHORT_VERSION_NO_DOT ${PYTHON_SHORT_VERSION}) 0044 set(PYTHON_LIBRARY_NAMES python${PYTHON_SHORT_VERSION} python${PYTHON_SHORT_VERSION_NO_DOT}) 0045 if(WIN32) 0046 STRING(REPLACE "\\" "/" PYTHON_SITE_PACKAGES_DIR ${PYTHON_SITE_PACKAGES_DIR}) 0047 endif(WIN32) 0048 FIND_LIBRARY(PYTHON_LIBRARY NAMES ${PYTHON_LIBRARY_NAMES} PATHS ${PYTHON_PREFIX}/lib ${PYTHON_PREFIX}/libs NO_DEFAULT_PATH) 0049 set(PYTHONLIBRARY_FOUND TRUE) 0050 endif(python_config) 0051 0052 # adapted from cmake's builtin FindPythonLibs 0053 if(APPLE) 0054 CMAKE_FIND_FRAMEWORKS(Python) 0055 set(PYTHON_FRAMEWORK_INCLUDES) 0056 if(Python_FRAMEWORKS) 0057 # If a framework has been selected for the include path, 0058 # make sure "-framework" is used to link it. 0059 if("${PYTHON_INCLUDE_PATH}" MATCHES "Python\\.framework") 0060 set(PYTHON_LIBRARY "") 0061 set(PYTHON_DEBUG_LIBRARY "") 0062 endif("${PYTHON_INCLUDE_PATH}" MATCHES "Python\\.framework") 0063 if(NOT PYTHON_LIBRARY) 0064 set (PYTHON_LIBRARY "-framework Python" CACHE FILEPATH "Python Framework" FORCE) 0065 endif(NOT PYTHON_LIBRARY) 0066 set(PYTHONLIBRARY_FOUND TRUE) 0067 endif(Python_FRAMEWORKS) 0068 endif(APPLE) 0069 endif(PYTHONINTERP_FOUND) 0070 0071 if(PYTHONLIBRARY_FOUND) 0072 set(PYTHON_LIBRARIES ${PYTHON_LIBRARY}) 0073 if(NOT PYTHONLIBRARY_FIND_QUIETLY) 0074 message(STATUS "Found Python executable: ${PYTHON_EXECUTABLE}") 0075 message(STATUS "Found Python version: ${PYTHON_LONG_VERSION}") 0076 endif(NOT PYTHONLIBRARY_FIND_QUIETLY) 0077 else(PYTHONLIBRARY_FOUND) 0078 if(PYTHONLIBRARY_FIND_REQUIRED) 0079 message(FATAL_ERROR "Could not find Python") 0080 endif(PYTHONLIBRARY_FIND_REQUIRED) 0081 endif(PYTHONLIBRARY_FOUND) 0082 0083 endif (EXISTS PYTHON_LIBRARY)