3 ####################################################################
5 ####################################################################
7 # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
8 SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules )
10 INCLUDE(${CMAKE_SOURCE_DIR}/VERSION.cmake)
11 MATH ( EXPR LIBZYPP_CURRENT "${LIBZYPP_MAJOR} * 100 + ${LIBZYPP_MINOR}" )
12 MATH ( EXPR LIBZYPP_AGE "${LIBZYPP_MINOR} - ${LIBZYPP_COMPATMINOR}" )
13 SET ( LIBZYPP_VERSION_INFO "-version-info ${LIBZYPP_CURRENT}:${LIBZYPP_PATCH}:${LIBZYPP_AGE}" )
15 SET(VERSION "${LIBZYPP_MAJOR}.${LIBZYPP_MINOR}.${LIBZYPP_PATCH}")
17 ADD_DEFINITIONS( -DVERSION=\\\"${VERSION}\\\" )
19 FIND_PACKAGE(Rpm REQUIRED)
20 FIND_PACKAGE(Boost REQUIRED)
21 FIND_PACKAGE(Gettext REQUIRED)
22 FIND_PACKAGE(Hal REQUIRED)
23 FIND_PACKAGE(Dbus REQUIRED)
24 FIND_PACKAGE(Glib REQUIRED)
25 FIND_PACKAGE(Curl REQUIRED)
26 FIND_PACKAGE(Libxml REQUIRED)
27 FIND_PACKAGE(Sqlite REQUIRED)
28 FIND_PACKAGE(ZLIB REQUIRED)
31 MESSAGE( FATAL_ERROR " rpm not found" )
33 INCLUDE_DIRECTORIES(${RPM_INCLUDE_DIR})
37 MESSAGE( FATAL_ERROR " zlib not found" )
38 ELSE ( NOT ZLIB_FOUND)
39 INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
40 ENDIF( NOT ZLIB_FOUND)
43 MESSAGE(STATUS "Found Gettext: ${GETTEXT_SOURCE}")
44 INCLUDE_DIRECTORIES(${GETTEXT_INCLUDE_DIR})
46 MESSAGE( FATAL_ERROR "Gettext not found" )
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 IF ( NOT LIBXML_FOUND)
56 MESSAGE( FATAL_ERROR " libxml not found" )
57 ELSE ( NOT LIBXML_FOUND)
58 INCLUDE_DIRECTORIES(${LIBXML_INCLUDE_DIR})
59 ENDIF( NOT LIBXML_FOUND)
62 MESSAGE( FATAL_ERROR " curl not found" )
63 ELSE ( NOT CURL_FOUND)
64 INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIR})
65 ENDIF( NOT CURL_FOUND)
68 MESSAGE( FATAL_ERROR " Hal not found" )
70 INCLUDE_DIRECTORIES(${HAL_INCLUDE_DIR})
71 # hal/libhal-storage.h is broken grrr
72 INCLUDE_DIRECTORIES(${HAL_INCLUDE_DIR}/hal)
76 MESSAGE( FATAL_ERROR " dbus not found" )
77 ELSE ( NOT DBUS_FOUND)
78 INCLUDE_DIRECTORIES(${DBUS_INCLUDE_DIR})
79 INCLUDE_DIRECTORIES(${DBUS_ARCH_INCLUDE_DIR})
80 ENDIF( NOT DBUS_FOUND)
83 MESSAGE( STATUS "glib found: includes in ${GLIB_INCLUDE_DIR}, library in ${GLIB_LIBRARY}")
84 INCLUDE_DIRECTORIES(${GLIB_INCLUDE_DIR})
85 INCLUDE_DIRECTORIES(${GLIB_CONFIG_INCLUDE_DIR})
87 MESSAGE( FATAL_ERROR "glib not found" )
91 # MESSAGE( STATUS "dbus-glib found" )
92 # INCLUDE_DIRECTORIES(${DBUS_GLIB_INCLUDE_DIR})
93 # LINK_DIRECTORIES(${DBUS_GLIB_LINK_DIR})
94 #ELSE(DBUS_GLIB_FOUND)
95 # MESSAGE( ERROR "dbus-glib not found" )
96 #ENDIF(DBUS_GLIB_FOUND)
98 MESSAGE(STATUS "soname: ${LIBZYPP_CURRENT}.${LIBZYPP_PATCH}.${LIBZYPP_AGE}")
99 MESSAGE(STATUS "version: ${VERSION}")
100 #yumschemadir=${zyppdir}/schema/yum
101 #xmlstoreschemadir=${zyppdir}/schema/xmlstore
103 ####################################################################
105 ####################################################################
107 MESSAGE(STATUS "Writing spec file...")
108 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/libzypp.spec.in ${CMAKE_BINARY_DIR}/package/libzypp.spec @ONLY)
110 MACRO(add_subdir_sources subdir real_sources)
111 MESSAGE( STATUS "Adding ${subdir} to sources..." )
113 INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/${subdir}/CMakeLists.txt")
114 FOREACH(src ${sources})
115 MESSAGE( STATUS " - ${CMAKE_CURRENT_SOURCE_DIR}/${subdir}/${src}" )
116 SET(real_sources ${real_sources} "${CMAKE_CURRENT_SOURCE_DIR}/${subdir}/${src}")
118 ENDMACRO(add_subdir_sources)
120 ####################################################################
122 ####################################################################
124 ADD_SUBDIRECTORY( zypp )
125 ADD_SUBDIRECTORY( zypp2 )
126 # do not build devel by default
127 ADD_SUBDIRECTORY( devel EXCLUDE_FROM_ALL )
128 ADD_SUBDIRECTORY( tools EXCLUDE_FROM_ALL )
129 #ADD_SUBDIRECTORY( examples )
130 ADD_SUBDIRECTORY( testsuite EXCLUDE_FROM_ALL )
131 #ADD_SUBDIRECTORY( po )
132 #ADD_SUBDIRECTORY( doc )
134 ####################################################################
136 ####################################################################
138 INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
140 ####################################################################
142 ####################################################################
144 #configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
146 ####################################################################
148 ####################################################################
150 #INSTALL_FILES( FILES libzypp.pc )