diff options
author | Alexander Neundorf <neundorf@kde.org> | 2010-06-23 20:51:06 +0000 |
---|---|---|
committer | Alexander Neundorf <neundorf@kde.org> | 2010-06-23 20:51:06 +0000 |
commit | ae8fa5c09c8d92d87a32ec910cddd33c46f753fa (patch) | |
tree | f162c510017ff65a15c25fadb3354e8f519d7c07 /modules/FindPythonLibrary.cmake | |
parent | dce1cd0521e1e308910390d67a2b38856d5b42f4 (diff) | |
download | extra-cmake-modules-ae8fa5c09c8d92d87a32ec910cddd33c46f753fa.tar.gz extra-cmake-modules-ae8fa5c09c8d92d87a32ec910cddd33c46f753fa.tar.bz2 |
-add cache variable PYTHON_SITE_PACKAGES_INSTALL_DIR, this can be used as install destination
for python modules, PYTHON_SITE_PACKAGES_DIR should not be used, since this most probably
requires root permissions- The new variable can be adjusted via the cache.
Also, this patch removes the PYTHON_LIBS_WITH_KDE_LIBS switch, this was undocumented, and
anything with "KDE" in the name shouldn't appear in "FindPythonLibrary.cmake".
Alex
CCMAIL: kde-buildsystem@kde.org
svn path=/trunk/KDE/kdelibs/; revision=1141934
Diffstat (limited to 'modules/FindPythonLibrary.cmake')
-rw-r--r-- | modules/FindPythonLibrary.cmake | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/modules/FindPythonLibrary.cmake b/modules/FindPythonLibrary.cmake index 4fe427d0..7b4b9538 100644 --- a/modules/FindPythonLibrary.cmake +++ b/modules/FindPythonLibrary.cmake @@ -12,6 +12,11 @@ # PYTHON_LONG_VERSION - The version of the Python interpreter found as a human # readable string. # +# PYTHON_SITE_PACKAGES_INSTALL_DIR - this cache variable can be used for installing +# own python modules. You may want to adjust this to be the +# same as ${PYTHON_SITE_PACKAGES_DIR}, but then admin +# privileges may be required for installation. +# # PYTHON_SITE_PACKAGES_DIR - Location of the Python site-packages directory. # # PYTHON_INCLUDE_PATH - Directory holding the python.h include file. @@ -46,14 +51,17 @@ else(EXISTS PYTHON_LIBRARY) string(REGEX REPLACE ".*exec_prefix:([^\n]+).*$" "\\1" PYTHON_PREFIX ${python_config}) string(REGEX REPLACE ".*\nshort_version:([^\n]+).*$" "\\1" PYTHON_SHORT_VERSION ${python_config}) string(REGEX REPLACE ".*\nlong_version:([^\n]+).*$" "\\1" PYTHON_LONG_VERSION ${python_config}) - string(REGEX REPLACE ".*\npy_inc_dir:([^\n]+).*$" "\\1" PYTHON_INCLUDE_PATH ${python_config}) - if(NOT PYTHON_SITE_PACKAGES_DIR) - if(NOT PYTHON_LIBS_WITH_KDE_LIBS) - string(REGEX REPLACE ".*\nsite_packages_dir:([^\n]+).*$" "\\1" PYTHON_SITE_PACKAGES_DIR ${python_config}) - else(NOT PYTHON_LIBS_WITH_KDE_LIBS) - set(PYTHON_SITE_PACKAGES_DIR ${KDE4_LIB_INSTALL_DIR}/python${PYTHON_SHORT_VERSION}/site-packages) - endif(NOT PYTHON_LIBS_WITH_KDE_LIBS) - endif(NOT PYTHON_SITE_PACKAGES_DIR) + + string(REGEX REPLACE ".*\npy_inc_dir:([^\n]+).*$" "\\1" _TMP_PYTHON_INCLUDE_PATH ${python_config}) + string(REGEX REPLACE ".*\nsite_packages_dir:([^\n]+).*$" "\\1" _TMP_PYTHON_SITE_PACKAGES_DIR ${python_config}) + + # Put these two variables in the cache so they are visible for the user, but read-only: + set(PYTHON_INCLUDE_PATH "${_TMP_PYTHON_INCLUDE_PATH}" CACHE PATH "The python include directory" FORCE) + set(PYTHON_SITE_PACKAGES_DIR "${_TMP_PYTHON_SITE_PACKAGES_DIR}" CACHE PATH "The python site packages dir" FORCE) + + # This one is intended to be used and changed by the user for installing own modules: + set(PYTHON_SITE_PACKAGES_INSTALL_DIR lib/python${PYTHON_SHORT_VERSION}/site-packages CACHE PATH "The directory where python modules will be installed to.") + string(REGEX REPLACE "([0-9]+).([0-9]+)" "\\1\\2" PYTHON_SHORT_VERSION_NO_DOT ${PYTHON_SHORT_VERSION}) set(PYTHON_LIBRARY_NAMES python${PYTHON_SHORT_VERSION} python${PYTHON_SHORT_VERSION_NO_DOT}) if(WIN32) |