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})
30 ####################################################################
32 FIND_PACKAGE(Rpm REQUIRED)
34 MESSAGE( FATAL_ERROR " rpm not found" )
36 INCLUDE_DIRECTORIES(${RPM_INCLUDE_DIR})
39 FIND_PACKAGE(Boost REQUIRED)
41 MESSAGE( STATUS "boost found: includes in ${Boost_INCLUDE_DIRS}, library in ${Boost_LIBRARY_DIRS}")
42 INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
43 LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
46 FIND_PACKAGE(Gettext REQUIRED)
48 MESSAGE(STATUS "Found Gettext: ${GETTEXT_SOURCE}")
49 INCLUDE_DIRECTORIES(${GETTEXT_INCLUDE_DIR})
51 MESSAGE( FATAL_ERROR "Gettext not found" )
54 FIND_PACKAGE(Hal REQUIRED)
56 MESSAGE( FATAL_ERROR " Hal not found" )
58 INCLUDE_DIRECTORIES(${HAL_INCLUDE_DIR})
59 # hal/libhal-storage.h is broken grrr
60 INCLUDE_DIRECTORIES(${HAL_INCLUDE_DIR}/hal)
63 FIND_PACKAGE(Dbus REQUIRED)
65 MESSAGE( FATAL_ERROR " dbus not found" )
66 ELSE ( NOT DBUS_FOUND)
67 INCLUDE_DIRECTORIES(${DBUS_INCLUDE_DIR})
68 INCLUDE_DIRECTORIES(${DBUS_ARCH_INCLUDE_DIR})
69 ENDIF( NOT DBUS_FOUND)
71 FIND_PACKAGE(Glib REQUIRED)
73 MESSAGE( STATUS "glib found: includes in ${GLIB_INCLUDE_DIR}, library in ${GLIB_LIBRARY}")
74 INCLUDE_DIRECTORIES(${GLIB_INCLUDE_DIR})
75 INCLUDE_DIRECTORIES(${GLIB_CONFIG_INCLUDE_DIR})
77 MESSAGE( FATAL_ERROR "glib not found" )
80 FIND_PACKAGE(Curl REQUIRED)
82 MESSAGE( FATAL_ERROR " curl not found" )
83 ELSE ( NOT CURL_FOUND)
84 INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIR})
85 ENDIF( NOT CURL_FOUND)
87 FIND_PACKAGE(Libxml REQUIRED)
88 IF ( NOT LIBXML_FOUND)
89 MESSAGE( FATAL_ERROR " libxml not found" )
90 ELSE ( NOT LIBXML_FOUND)
91 INCLUDE_DIRECTORIES(${LIBXML_INCLUDE_DIR})
92 ENDIF( NOT LIBXML_FOUND)
94 FIND_PACKAGE(Sqlite REQUIRED)
96 FIND_PACKAGE(ZLIB REQUIRED)
98 MESSAGE( FATAL_ERROR " zlib not found" )
99 ELSE ( NOT ZLIB_FOUND)
100 INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
101 ENDIF( NOT ZLIB_FOUND)
103 FIND_PACKAGE(Satsolver REQUIRED)
104 IF ( NOT SATSOLVER_FOUND )
105 MESSAGE( FATAL_ERROR " libsatsolver not found" )
106 ELSE ( NOT SATSOLVER_FOUND )
107 INCLUDE_DIRECTORIES( ${SATSOLVER_INCLUDE_DIR} )
108 ENDIF( NOT SATSOLVER_FOUND )
110 FIND_PROGRAM( DOXYGEN doxygen )
112 MESSAGE( FATAL_ERROR "doxygen not found: install doxygen to build the documentation." )
114 MESSAGE( STATUS "doxygen found: ${DOXYGEN}" )
115 ENDIF ( NOT DOXYGEN )
117 MESSAGE(STATUS "soname: ${LIBZYPP_VERSION_INFO}")
118 MESSAGE(STATUS "version: ${VERSION}")
120 MESSAGE(STATUS "Writing pkg-config file...")
121 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/libzypp.pc.cmake ${CMAKE_BINARY_DIR}/libzypp.pc @ONLY)
122 INSTALL( FILES ${CMAKE_BINARY_DIR}/libzypp.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig )
124 MESSAGE(STATUS "FindZypp.cmake will be installed in ${CMAKE_INSTALL_PREFIX}/share/cmake/Modules")
125 INSTALL( FILES ${CMAKE_SOURCE_DIR}/cmake/modules/FindZypp.cmake DESTINATION ${CMAKE_INSTALL_PREFIX}/share/cmake/Modules )
126 INSTALL( FILES ${CMAKE_SOURCE_DIR}/cmake/modules/ZyppCommon.cmake DESTINATION ${CMAKE_INSTALL_PREFIX}/share/cmake/Modules )
128 MESSAGE(STATUS "zypp.conf will be installed in ${SYSCONFDIR}/zypp")
129 INSTALL( FILES ${CMAKE_SOURCE_DIR}/zypp.conf DESTINATION ${SYSCONFDIR}/zypp )
131 ####################################################################
133 ####################################################################
135 ADD_SUBDIRECTORY( zypp )
136 #ADD_SUBDIRECTORY( zypp2 )
137 # do not build devel by default
138 ADD_SUBDIRECTORY( devel EXCLUDE_FROM_ALL )
139 ADD_SUBDIRECTORY( tools )
140 #ADD_SUBDIRECTORY( examples )
141 ADD_SUBDIRECTORY( po EXCLUDE_FROM_ALL )
142 ADD_SUBDIRECTORY( doc EXCLUDE_FROM_ALL )
143 ADD_SUBDIRECTORY( tests EXCLUDE_FROM_ALL )