summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Jonathan Beck2009-10-16 22:29:49 +0200
committerGravatar Jonathan Beck2009-10-16 22:29:49 +0200
commit7ba9a5437e49868ca7a7cc2f4d006509308b1ab4 (patch)
treea4223162b635be801eac1f26b5f9de38cabd3c51
parent32be8ec384bfd78e189d3de6609e50cf4dd072a2 (diff)
downloadlibplist-7ba9a5437e49868ca7a7cc2f4d006509308b1ab4.tar.gz
libplist-7ba9a5437e49868ca7a7cc2f4d006509308b1ab4.tar.bz2
Fix python binding install path.
-rw-r--r--CMakeLists.txt6
-rw-r--r--swig/CMakeLists.txt11
2 files changed, 12 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 07946ea..116bf73 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,6 +18,7 @@ ENDIF(NOT DEFINED CMAKE_INSTALL_LIBDIR)
FIND_PACKAGE( LibXml2 REQUIRED )
FIND_PACKAGE( GLIB2 REQUIRED )
FIND_PACKAGE( SWIG )
+FIND_PACKAGE( PythonInterp )
FIND_PACKAGE( PythonLibs )
INCLUDE_DIRECTORIES( "${CMAKE_CURRENT_SOURCE_DIR}/include" )
@@ -29,9 +30,9 @@ ADD_SUBDIRECTORY( plutil )
ADD_SUBDIRECTORY( include )
ADD_SUBDIRECTORY( test )
-IF ( SWIG_FOUND AND PYTHON_LIBRARY )
+IF ( SWIG_FOUND AND PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND )
ADD_SUBDIRECTORY( swig )
-ENDIF ( SWIG_FOUND AND PYTHON_LIBRARY )
+ENDIF ( SWIG_FOUND AND PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND )
# add uninstall target
CONFIGURE_FILE( "${CMAKE_SOURCE_DIR}/cmake/modules/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
@@ -39,6 +40,7 @@ ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/c
########## PkgConfig ############################
CONFIGURE_FILE( "libplist.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/libplist.pc" )
+
########## INSTALL ##############################
INSTALL( FILES "${CMAKE_CURRENT_BINARY_DIR}/libplist.pc" DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/ )
diff --git a/swig/CMakeLists.txt b/swig/CMakeLists.txt
index a139859..f79b3dc 100644
--- a/swig/CMakeLists.txt
+++ b/swig/CMakeLists.txt
@@ -7,12 +7,17 @@ INCLUDE_DIRECTORIES( ${PYTHON_INCLUDE_PATH} )
SWIG_ADD_MODULE( PList python plist.i )
SWIG_LINK_LIBRARIES( PList plist ${PYTHON_LIBRARIES} )
+EXEC_PROGRAM("${PYTHON_EXECUTABLE}"
+ ARGS "-c 'try:\n import distutils.sysconfig; print distutils.sysconfig.get_python_lib()\nexcept: pass\n'"
+ OUTPUT_VARIABLE DISTUTILS_PYTHON_ILIBRARY_PATH
+ )
+
INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/_PList${CMAKE_SHARED_MODULE_SUFFIX}
- DESTINATION ${CMAKE_INSTALL_LIBDIR}/python${PYTHON_VERSION}/site-packages/libplist/ )
+ DESTINATION ${DISTUTILS_PYTHON_ILIBRARY_PATH}/libplist/ )
INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/PList.py
- DESTINATION ${CMAKE_INSTALL_LIBDIR}/python${PYTHON_VERSION}/site-packages/libplist/ )
+ DESTINATION ${DISTUTILS_PYTHON_ILIBRARY_PATH}/libplist/ )
INSTALL( FILES ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py
- DESTINATION ${CMAKE_INSTALL_LIBDIR}/python${PYTHON_VERSION}/site-packages/libplist/ )
+ DESTINATION ${DISTUTILS_PYTHON_ILIBRARY_PATH}/libplist/ )
INSTALL( FILES ${CMAKE_CURRENT_SOURCE_DIR}/plist.i
DESTINATION include/plist/swig COMPONENT dev)