1 # cmake likes unique target names
4 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing")
6 FIND_PACKAGE(Ruby REQUIRED)
8 EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['vendorarchdir']" OUTPUT_VARIABLE RUBY_VENDOR_ARCH_DIR)
10 MESSAGE(STATUS "Ruby executable: ${RUBY_EXECUTABLE}")
11 MESSAGE(STATUS "Ruby vendor arch dir: ${RUBY_VENDOR_ARCH_DIR}")
12 MESSAGE(STATUS "Ruby include path: ${RUBY_INCLUDE_PATH}")
14 SET( SWIG_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/zypp_wrap.cxx" )
15 SET( SWIG_INPUT "${CMAKE_CURRENT_SOURCE_DIR}/zypp.i" )
18 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zypp_wrap.cxx
19 COMMAND ${CMAKE_COMMAND} -E echo_append "Creating wrapper code for ruby..."
20 COMMAND ${SWIG_EXECUTABLE} -DZYPP_DEPRECATED -c++ -ruby -autorename -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
21 COMMAND ${CMAKE_COMMAND} -E echo "Done."
22 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
23 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../*.i ${CMAKE_CURRENT_SOURCE_DIR}/*.i
26 ADD_CUSTOM_TARGET( ${WRAP}_glue
27 DEPENDS ${SWIG_OUTPUT}
30 ADD_LIBRARY( ${WRAP}_zypp SHARED "${CMAKE_CURRENT_BINARY_DIR}/zypp_wrap.cxx" )
31 SET_TARGET_PROPERTIES(${WRAP}_zypp
36 ADD_DEPENDENCIES( ${WRAP}_zypp ${WRAP}_glue )
38 INCLUDE_DIRECTORIES( ${RUBY_INCLUDE_PATH} )
39 INCLUDE_DIRECTORIES( ${ZYPP_INCLUDE_DIR} )
40 TARGET_LINK_LIBRARIES( ${WRAP}_zypp ${ZYPP_LIBRARY} )
41 TARGET_LINK_LIBRARIES( ${WRAP}_zypp ${RUBY_LIBRARY} )
43 INSTALL(TARGETS ${WRAP}_zypp LIBRARY DESTINATION ${RUBY_VENDOR_ARCH_DIR})