2 SET( PACKAGE "libzypp" )
3 # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
4 SET( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules )
7 INCLUDE( ${CMAKE_SOURCE_DIR}/VERSION.cmake )
9 MATH( EXPR LIBZYPP_CURRENT "${LIBZYPP_MAJOR} * 100 + ${LIBZYPP_MINOR}" )
10 MATH( EXPR LIBZYPP_AGE "${LIBZYPP_MINOR} - ${LIBZYPP_COMPATMINOR}" )
11 # Libtool wanted current:patch:age
12 # But cmake is not libtool, it wants the verbatim suffix to libzypp.so
13 MATH( EXPR LIBZYPP_SO_FIRST "${LIBZYPP_CURRENT}-${LIBZYPP_AGE}" )
14 SET( VERSION "${LIBZYPP_MAJOR}.${LIBZYPP_MINOR}.${LIBZYPP_PATCH}" )
16 SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Woverloaded-virtual" )
17 SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Wall" )
18 set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O3" )
19 set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3" )
21 ADD_DEFINITIONS( -D_FILE_OFFSET_BITS=64 )
22 ADD_DEFINITIONS( -DVERSION=\\\"${VERSION}\\\" )
23 SET( LIBZYPP_VERSION_INFO "${LIBZYPP_SO_FIRST}.${LIBZYPP_AGE}.${LIBZYPP_PATCH}" )
24 SET( LIBZYPP_SOVERSION_INFO "${LIBZYPP_SO_FIRST}" )
26 GENERATE_PACKAGING(${PACKAGE} ${VERSION})
31 FOREACH( loop_var ${ARGV} )
32 SET_SOURCE_FILES_PROPERTIES( ${loop_var}_test.cc COMPILE_FLAGS "-DBOOST_TEST_DYN_LINK -DBOOST_TEST_MAIN" )
33 ADD_EXECUTABLE( ${loop_var}_test ${loop_var}_test.cc )
34 TARGET_LINK_LIBRARIES( ${loop_var}_test zypp boost_unit_test_framework)
35 ADD_TEST( ${loop_var}_test ${CMAKE_CURRENT_BINARY_DIR}/${loop_var}_test)
36 ENDFOREACH( loop_var )
39 ####################################################################
41 FIND_PACKAGE(Rpm REQUIRED)
43 MESSAGE( FATAL_ERROR " rpm not found" )
45 INCLUDE_DIRECTORIES(${RPM_INCLUDE_DIR})
48 FIND_PACKAGE(Boost REQUIRED)
50 MESSAGE( STATUS "boost found: includes in ${Boost_INCLUDE_DIRS}, library in ${Boost_LIBRARY_DIRS}")
51 INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
52 LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
55 FIND_PACKAGE(Gettext REQUIRED)
57 MESSAGE(STATUS "Found Gettext: ${GETTEXT_SOURCE}")
58 INCLUDE_DIRECTORIES(${GETTEXT_INCLUDE_DIR})
60 MESSAGE( FATAL_ERROR "Gettext not found" )
63 FIND_PACKAGE(Hal REQUIRED)
65 MESSAGE( FATAL_ERROR " Hal not found" )
67 INCLUDE_DIRECTORIES(${HAL_INCLUDE_DIR})
68 # hal/libhal-storage.h is broken grrr
69 INCLUDE_DIRECTORIES(${HAL_INCLUDE_DIR}/hal)
72 FIND_PACKAGE(Dbus REQUIRED)
74 MESSAGE( FATAL_ERROR " dbus not found" )
75 ELSE ( NOT DBUS_FOUND)
76 INCLUDE_DIRECTORIES(${DBUS_INCLUDE_DIR})
77 INCLUDE_DIRECTORIES(${DBUS_ARCH_INCLUDE_DIR})
78 ENDIF( NOT DBUS_FOUND)
80 FIND_PACKAGE(Glib REQUIRED)
82 MESSAGE( STATUS "glib found: includes in ${GLIB_INCLUDE_DIR}, library in ${GLIB_LIBRARY}")
83 INCLUDE_DIRECTORIES(${GLIB_INCLUDE_DIR})
84 INCLUDE_DIRECTORIES(${GLIB_CONFIG_INCLUDE_DIR})
86 MESSAGE( FATAL_ERROR "glib not found" )
89 FIND_PACKAGE(Curl REQUIRED)
91 MESSAGE( FATAL_ERROR " curl not found" )
92 ELSE ( NOT CURL_FOUND)
93 INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIR})
94 ENDIF( NOT CURL_FOUND)
96 FIND_PACKAGE(Libxml REQUIRED)
97 IF ( NOT LIBXML_FOUND)
98 MESSAGE( FATAL_ERROR " libxml not found" )
99 ELSE ( NOT LIBXML_FOUND)
100 INCLUDE_DIRECTORIES(${LIBXML_INCLUDE_DIR})
101 ENDIF( NOT LIBXML_FOUND)
103 FIND_PACKAGE(ZLIB REQUIRED)
105 MESSAGE( FATAL_ERROR " zlib not found" )
106 ELSE ( NOT ZLIB_FOUND)
107 INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
108 ENDIF( NOT ZLIB_FOUND)
110 FIND_PACKAGE(Satsolver REQUIRED)
111 IF ( NOT SATSOLVER_FOUND )
112 MESSAGE( FATAL_ERROR " libsatsolver not found" )
113 ELSE ( NOT SATSOLVER_FOUND )
114 INCLUDE_DIRECTORIES( ${SATSOLVER_INCLUDE_DIR} )
115 ENDIF( NOT SATSOLVER_FOUND )
117 FIND_PROGRAM( DOXYGEN doxygen )
119 MESSAGE( FATAL_ERROR "doxygen not found: install doxygen to build the documentation." )
121 MESSAGE( STATUS "doxygen found: ${DOXYGEN}" )
122 ENDIF ( NOT DOXYGEN )
124 MESSAGE(STATUS "soname: ${LIBZYPP_VERSION_INFO}")
125 MESSAGE(STATUS "version: ${VERSION}")
127 MESSAGE(STATUS "Writing pkg-config file...")
128 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/libzypp.pc.cmake ${CMAKE_BINARY_DIR}/libzypp.pc @ONLY)
129 INSTALL( FILES ${CMAKE_BINARY_DIR}/libzypp.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig )
131 MESSAGE(STATUS "FindZypp.cmake will be installed in ${CMAKE_INSTALL_PREFIX}/share/cmake/Modules")
132 INSTALL( FILES ${CMAKE_SOURCE_DIR}/cmake/modules/FindZypp.cmake DESTINATION ${CMAKE_INSTALL_PREFIX}/share/cmake/Modules )
133 INSTALL( FILES ${CMAKE_SOURCE_DIR}/cmake/modules/ZyppCommon.cmake DESTINATION ${CMAKE_INSTALL_PREFIX}/share/cmake/Modules )
135 MESSAGE(STATUS "zypp.conf will be installed in ${SYSCONFDIR}/zypp")
136 INSTALL( FILES ${CMAKE_SOURCE_DIR}/zypp.conf DESTINATION ${SYSCONFDIR}/zypp )
138 ####################################################################
140 ####################################################################
142 ADD_SUBDIRECTORY( zypp )
143 #ADD_SUBDIRECTORY( zypp2 )
144 # do not build devel by default
145 ADD_SUBDIRECTORY( devel EXCLUDE_FROM_ALL )
146 ADD_SUBDIRECTORY( tools )
147 #ADD_SUBDIRECTORY( examples )
148 ADD_SUBDIRECTORY( po EXCLUDE_FROM_ALL )
149 ADD_SUBDIRECTORY( doc EXCLUDE_FROM_ALL )
150 ADD_SUBDIRECTORY( tests EXCLUDE_FROM_ALL )