PROJECT(libzypp) SET( PACKAGE "libzypp" ) # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked SET( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules ) INCLUDE(ZyppCommon) INCLUDE( ${CMAKE_SOURCE_DIR}/VERSION.cmake ) MATH( EXPR LIBZYPP_CURRENT "${LIBZYPP_MAJOR} * 100 + ${LIBZYPP_MINOR}" ) MATH( EXPR LIBZYPP_AGE "${LIBZYPP_MINOR} - ${LIBZYPP_COMPATMINOR}" ) # Libtool wanted current:patch:age # But cmake is not libtool, it wants the verbatim suffix to libzypp.so MATH( EXPR LIBZYPP_SO_FIRST "${LIBZYPP_CURRENT}-${LIBZYPP_AGE}" ) SET( VERSION "${LIBZYPP_MAJOR}.${LIBZYPP_MINOR}.${LIBZYPP_PATCH}" ) SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Woverloaded-virtual" ) SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Wall" ) set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O3" ) set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3" ) ADD_DEFINITIONS( -D_FILE_OFFSET_BITS=64 ) ADD_DEFINITIONS( -DVERSION=\\\"${VERSION}\\\" ) SET( LIBZYPP_VERSION_INFO "${LIBZYPP_SO_FIRST}.${LIBZYPP_AGE}.${LIBZYPP_PATCH}" ) SET( LIBZYPP_SOVERSION_INFO "${LIBZYPP_SO_FIRST}" ) GENERATE_PACKAGING(${PACKAGE} ${VERSION}) INCLUDE(CPack) MACRO(ADD_TESTS) FOREACH( loop_var ${ARGV} ) SET_SOURCE_FILES_PROPERTIES( ${loop_var}_test.cc COMPILE_FLAGS "-DBOOST_TEST_DYN_LINK -DBOOST_TEST_MAIN -DBOOST_AUTO_TEST_MAIN=\"\" " ) ADD_EXECUTABLE( ${loop_var}_test ${loop_var}_test.cc ) TARGET_LINK_LIBRARIES( ${loop_var}_test zypp boost_unit_test_framework) ADD_TEST( ${loop_var}_test ${CMAKE_CURRENT_BINARY_DIR}/${loop_var}_test) ENDFOREACH( loop_var ) ENDMACRO(ADD_TESTS) #################################################################### FIND_PACKAGE(Rpm REQUIRED) IF ( NOT RPM_FOUND) MESSAGE( FATAL_ERROR " rpm-devel not found" ) ELSE ( NOT RPM_FOUND) INCLUDE_DIRECTORIES(${RPM_INCLUDE_DIR}) ENDIF( NOT RPM_FOUND) FIND_PACKAGE(Boost REQUIRED) IF (Boost_FOUND) MESSAGE( STATUS "boost found: includes in ${Boost_INCLUDE_DIRS}, library in ${Boost_LIBRARY_DIRS}") INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) ENDIF(Boost_FOUND) FIND_PACKAGE(Gettext REQUIRED) IF (GETTEXT_FOUND) MESSAGE(STATUS "Found Gettext: ${GETTEXT_SOURCE}") INCLUDE_DIRECTORIES(${GETTEXT_INCLUDE_DIR}) ELSE (GETTEXT_FOUND) MESSAGE( FATAL_ERROR "Gettext not found" ) ENDIF (GETTEXT_FOUND) FIND_PACKAGE(Hal REQUIRED) IF ( NOT HAL_FOUND) MESSAGE( FATAL_ERROR " Hal not found" ) ELSE ( NOT HAL_FOUND) INCLUDE_DIRECTORIES(${HAL_INCLUDE_DIR}) # hal/libhal-storage.h is broken grrr INCLUDE_DIRECTORIES(${HAL_INCLUDE_DIR}/hal) ENDIF( NOT HAL_FOUND) FIND_PACKAGE(Dbus REQUIRED) IF ( NOT DBUS_FOUND) MESSAGE( FATAL_ERROR " dbus not found" ) ELSE ( NOT DBUS_FOUND) INCLUDE_DIRECTORIES(${DBUS_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${DBUS_ARCH_INCLUDE_DIR}) ENDIF( NOT DBUS_FOUND) FIND_PACKAGE(Glib REQUIRED) IF (GLIB_FOUND) MESSAGE( STATUS "glib found: includes in ${GLIB_INCLUDE_DIR}, library in ${GLIB_LIBRARY}") INCLUDE_DIRECTORIES(${GLIB_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${GLIB_CONFIG_INCLUDE_DIR}) ELSE(GLIB_FOUND) MESSAGE( FATAL_ERROR "glib not found" ) ENDIF(GLIB_FOUND) FIND_PACKAGE(Curl REQUIRED) IF ( NOT CURL_FOUND) MESSAGE( FATAL_ERROR " curl not found" ) ELSE ( NOT CURL_FOUND) INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIR}) ENDIF( NOT CURL_FOUND) FIND_PACKAGE(Libxml REQUIRED) IF ( NOT LIBXML_FOUND) MESSAGE( FATAL_ERROR " libxml not found" ) ELSE ( NOT LIBXML_FOUND) INCLUDE_DIRECTORIES(${LIBXML_INCLUDE_DIR}) ENDIF( NOT LIBXML_FOUND) FIND_PACKAGE(ZLIB REQUIRED) IF ( NOT ZLIB_FOUND) MESSAGE( FATAL_ERROR " zlib not found" ) ELSE ( NOT ZLIB_FOUND) INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) ENDIF( NOT ZLIB_FOUND) FIND_PACKAGE(Satsolver REQUIRED) IF ( NOT SATSOLVER_FOUND ) MESSAGE( FATAL_ERROR " libsatsolver not found" ) ELSE ( NOT SATSOLVER_FOUND ) INCLUDE_DIRECTORIES( ${SATSOLVER_INCLUDE_DIR} ) ENDIF( NOT SATSOLVER_FOUND ) FIND_PROGRAM( DOXYGEN doxygen ) IF ( NOT DOXYGEN ) MESSAGE( FATAL_ERROR "doxygen not found: install doxygen to build the documentation." ) ELSE ( NOT DOXYGEN ) MESSAGE( STATUS "doxygen found: ${DOXYGEN}" ) ENDIF ( NOT DOXYGEN ) MESSAGE(STATUS "soname: ${LIBZYPP_VERSION_INFO}") MESSAGE(STATUS "version: ${VERSION}") MESSAGE(STATUS "Writing pkg-config file...") CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/libzypp.pc.cmake ${CMAKE_BINARY_DIR}/libzypp.pc @ONLY) INSTALL( FILES ${CMAKE_BINARY_DIR}/libzypp.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig ) MESSAGE(STATUS "FindZypp.cmake will be installed in ${CMAKE_INSTALL_PREFIX}/share/cmake/Modules") INSTALL( FILES ${CMAKE_SOURCE_DIR}/cmake/modules/FindZypp.cmake DESTINATION ${CMAKE_INSTALL_PREFIX}/share/cmake/Modules ) INSTALL( FILES ${CMAKE_SOURCE_DIR}/cmake/modules/ZyppCommon.cmake DESTINATION ${CMAKE_INSTALL_PREFIX}/share/cmake/Modules ) MESSAGE(STATUS "zypp.conf will be installed in ${SYSCONFDIR}/zypp") INSTALL( FILES ${CMAKE_SOURCE_DIR}/zypp.conf DESTINATION ${SYSCONFDIR}/zypp ) #################################################################### # SUBDIRECTORIES # #################################################################### ADD_SUBDIRECTORY( zypp ) #ADD_SUBDIRECTORY( zypp2 ) # do not build devel by default ADD_SUBDIRECTORY( devel EXCLUDE_FROM_ALL ) ADD_SUBDIRECTORY( tools ) #ADD_SUBDIRECTORY( examples ) ADD_SUBDIRECTORY( po EXCLUDE_FROM_ALL ) ADD_SUBDIRECTORY( doc EXCLUDE_FROM_ALL ) ADD_SUBDIRECTORY( tests EXCLUDE_FROM_ALL )