2 FIND_PACKAGE(PythonLibs REQUIRED)
3 MESSAGE( STATUS "Python include path: ${PYTHON_INCLUDE_PATH}" )
6 SET(PYTHON_LIB_PATH "/usr/${LIB}/python2.5/site-packages/")
8 SET(PYTHON_LIB_PATH "/usr/lib/python2.5/site-packages/")
10 MESSAGE(STATUS "Python lib path: ${PYTHON_LIB_PATH}")
12 SET( SWIG_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/zypp_wrap.cxx" )
13 SET( SWIG_INPUT "${CMAKE_CURRENT_SOURCE_DIR}/zypp.i" )
16 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zypp_wrap.cxx
17 COMMAND ${CMAKE_COMMAND} -E echo_append "Creating wrapper code for python..."
18 COMMAND ${SWIG_EXECUTABLE} -c++ -python -xmlout ${CMAKE_CURRENT_BINARY_DIR}/parse.xml -o ${CMAKE_CURRENT_BINARY_DIR}/zypp_wrap.cxx -I${ZYPP_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../zypp.i
19 COMMAND ${CMAKE_COMMAND} -E echo "Done."
20 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
21 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../*.i
24 ADD_CUSTOM_TARGET( glue
25 DEPENDS ${SWIG_OUTPUT}
28 ADD_LIBRARY( _zypp SHARED "${CMAKE_CURRENT_BINARY_DIR}/zypp_wrap.cxx" )
29 SET_TARGET_PROPERTIES( _zypp PROPERTIES PREFIX "" )
30 ADD_DEPENDENCIES( _zypp glue )
32 INCLUDE_DIRECTORIES( ${PYTHON_INCLUDE_PATH} )
33 INCLUDE_DIRECTORIES( ${ZYPP_INCLUDE_DIR} )
34 TARGET_LINK_LIBRARIES( _zypp ${ZYPP_LIBRARY} )
36 INSTALL(TARGETS _zypp LIBRARY DESTINATION ${PYTHON_LIB_PATH})
37 INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/zypp.py DESTINATION ${PYTHON_LIB_PATH})