Warning, /frameworks/kdelibs4support/cmake/modules/FindPythonLibrary.cmake is written in an unsupported language. File is not indexed.
0001 # Find Python 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_INSTALL_DIR - this cache variable can be used for installing 0016 # own python modules. You may want to adjust this to be the 0017 # same as ${PYTHON_SITE_PACKAGES_DIR}, but then admin 0018 # privileges may be required for installation. 0019 # 0020 # PYTHON_SITE_PACKAGES_DIR - Location of the Python site-packages directory. 0021 # 0022 # PYTHON_INCLUDE_PATH - Directory holding the python.h include file. 0023 # 0024 # PYTHON_LIBRARY, PYTHON_LIBRARIES- Location of the Python library. 0025 0026 # Copyright (c) 2007, Simon Edwards <simon@simonzone.com> 0027 # Copyright (c) 2012, Luca Beltrame <lbeltrame@kde.org> 0028 # Redistribution and use is allowed according to the terms of the BSD license. 0029 # For details see the accompanying COPYING-CMAKE-SCRIPTS file. 0030 0031 include(FindPackageHandleStandardArgs) 0032 0033 find_package(PythonInterp) 0034 0035 if (PYTHONINTERP_FOUND) 0036 0037 option(INSTALL_PYTHON_FILES_IN_PYTHON_PREFIX "Install the Python files in the Python packages dir" FALSE) 0038 0039 # Set the Python libraries to what we actually found for interpreters 0040 set(Python_ADDITIONAL_VERSIONS "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}") 0041 # These are kept for compatibility 0042 set(PYTHON_SHORT_VERSION "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}") 0043 set(PYTHON_LONG_VERSION ${PYTHON_VERSION_STRING}) 0044 0045 find_package(PythonLibs QUIET) 0046 0047 if(PYTHONLIBS_FOUND) 0048 set(PYTHON_LIBRARY ${PYTHON_LIBRARIES}) 0049 endif(PYTHONLIBS_FOUND) 0050 0051 # Auto detect Python site-packages directory 0052 execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(True))" 0053 OUTPUT_VARIABLE PYTHON_SITE_PACKAGES_DIR 0054 OUTPUT_STRIP_TRAILING_WHITESPACE 0055 ) 0056 0057 message(STATUS "Python system site-packages directory: ${PYTHON_SITE_PACKAGES_DIR}") 0058 if(INSTALL_PYTHON_FILES_IN_PYTHON_PREFIX) 0059 set(PYTHON_SITE_PACKAGES_INSTALL_DIR ${PYTHON_SITE_PACKAGES_DIR}) 0060 else() 0061 execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(True, prefix='${CMAKE_INSTALL_PREFIX}'))" 0062 OUTPUT_VARIABLE PYTHON_SITE_PACKAGES_INSTALL_DIR 0063 OUTPUT_STRIP_TRAILING_WHITESPACE 0064 ) 0065 endif() 0066 0067 if(NOT PYTHON_SITE_PACKAGES_INSTALL_DIR STREQUAL PYTHON_SITE_PACKAGES_DIR) 0068 message(STATUS "The Python files will be installed to ${PYTHON_SITE_PACKAGES_INSTALL_DIR}. Make sure to add them to the Python search path (e.g. by setting PYTHONPATH)") 0069 endif() 0070 0071 endif(PYTHONINTERP_FOUND) 0072 0073 find_package_handle_standard_args(PythonLibrary DEFAULT_MSG PYTHON_LIBRARY)