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}" )
14 SET( PACKAGE "libzypp" )
15 SET( VERSION "${LIBZYPP_MAJOR}.${LIBZYPP_MINOR}.${LIBZYPP_PATCH}" )
17 ADD_DEFINITIONS( -DVERSION=\\\"${VERSION}\\\" )
18 SET( LIBZYPP_VERSION_INFO "-version-info ${LIBZYPP_CURRENT}:${LIBZYPP_PATCH}:${LIBZYPP_AGE}" )
21 SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Novell's package management core engine.")
22 SET(CPACK_PACKAGE_VENDOR "Novell Inc.")
23 #SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/ReadMe.txt")
24 #SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
25 SET(CPACK_PACKAGE_VERSION_MAJOR ${LIBZYPP_MAJOR})
26 SET(CPACK_PACKAGE_VERSION_MINOR ${LIBZYPP_MINOR})
27 SET(CPACK_PACKAGE_VERSION_PATCH ${LIBZYPP_PATCH})
28 SET( CPACK_GENERATOR "TBZ2")
29 SET( CPACK_SOURCE_GENERATOR "TBZ2")
30 SET( CPACK_SOURCE_PACKAGE_FILE_NAME "${PACKAGE}-${VERSION}" )
32 # The following components are regex's to match anywhere (unless anchored)
33 # in absolute path + filename to find files or directories to be excluded
34 # from source tarball.
35 SET (CPACK_SOURCE_IGNORE_FILES
36 "/CVS/;/.svn/;/.libs/;/.deps/;.swp$;.#;/#;/build/;.o$;.lo$;.la$"
43 INCLUDE(DefineInstallationPaths)
45 FIND_PACKAGE(Rpm REQUIRED)
47 MESSAGE( FATAL_ERROR " rpm not found" )
49 INCLUDE_DIRECTORIES(${RPM_INCLUDE_DIR})
52 FIND_PACKAGE(Boost REQUIRED)
54 MESSAGE( STATUS "boost found: includes in ${Boost_INCLUDE_DIRS}, library in ${Boost_LIBRARY_DIRS}")
55 INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
56 LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
59 FIND_PACKAGE(Gettext REQUIRED)
61 MESSAGE(STATUS "Found Gettext: ${GETTEXT_SOURCE}")
62 INCLUDE_DIRECTORIES(${GETTEXT_INCLUDE_DIR})
64 MESSAGE( FATAL_ERROR "Gettext not found" )
67 FIND_PACKAGE(Hal REQUIRED)
69 MESSAGE( FATAL_ERROR " Hal not found" )
71 INCLUDE_DIRECTORIES(${HAL_INCLUDE_DIR})
72 # hal/libhal-storage.h is broken grrr
73 INCLUDE_DIRECTORIES(${HAL_INCLUDE_DIR}/hal)
76 FIND_PACKAGE(Dbus REQUIRED)
78 MESSAGE( FATAL_ERROR " dbus not found" )
79 ELSE ( NOT DBUS_FOUND)
80 INCLUDE_DIRECTORIES(${DBUS_INCLUDE_DIR})
81 INCLUDE_DIRECTORIES(${DBUS_ARCH_INCLUDE_DIR})
82 ENDIF( NOT DBUS_FOUND)
84 FIND_PACKAGE(Glib REQUIRED)
86 MESSAGE( STATUS "glib found: includes in ${GLIB_INCLUDE_DIR}, library in ${GLIB_LIBRARY}")
87 INCLUDE_DIRECTORIES(${GLIB_INCLUDE_DIR})
88 INCLUDE_DIRECTORIES(${GLIB_CONFIG_INCLUDE_DIR})
90 MESSAGE( FATAL_ERROR "glib not found" )
94 # MESSAGE( STATUS "dbus-glib found" )
95 # INCLUDE_DIRECTORIES(${DBUS_GLIB_INCLUDE_DIR})
96 # LINK_DIRECTORIES(${DBUS_GLIB_LINK_DIR})
97 #ELSE(DBUS_GLIB_FOUND)
98 # MESSAGE( ERROR "dbus-glib not found" )
99 #ENDIF(DBUS_GLIB_FOUND)
101 FIND_PACKAGE(Curl REQUIRED)
103 MESSAGE( FATAL_ERROR " curl not found" )
104 ELSE ( NOT CURL_FOUND)
105 INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIR})
106 ENDIF( NOT CURL_FOUND)
108 FIND_PACKAGE(Libxml REQUIRED)
109 IF ( NOT LIBXML_FOUND)
110 MESSAGE( FATAL_ERROR " libxml not found" )
111 ELSE ( NOT LIBXML_FOUND)
112 INCLUDE_DIRECTORIES(${LIBXML_INCLUDE_DIR})
113 ENDIF( NOT LIBXML_FOUND)
115 FIND_PACKAGE(Sqlite REQUIRED)
117 FIND_PACKAGE(ZLIB REQUIRED)
119 MESSAGE( FATAL_ERROR " zlib not found" )
120 ELSE ( NOT ZLIB_FOUND)
121 INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
122 ENDIF( NOT ZLIB_FOUND)
124 FIND_PROGRAM( DOXYGEN doxygen )
126 MESSAGE( FATAL_ERROR "doxygen not found: install doxygen to build the documentation." )
128 MESSAGE( STATUS "doxygen found: ${DOXYGEN}" )
129 ENDIF ( NOT DOXYGEN )
131 MESSAGE(STATUS "soname: ${LIBZYPP_CURRENT}.${LIBZYPP_PATCH}.${LIBZYPP_AGE}")
132 MESSAGE(STATUS "version: ${VERSION}")
134 ####################################################################
136 ####################################################################
138 MESSAGE(STATUS "Writing spec file...")
139 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/libzypp.spec.cmake ${CMAKE_BINARY_DIR}/package/libzypp.spec @ONLY)
141 MESSAGE(STATUS "Writing pkg-config file...")
142 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/libzypp.pc.cmake ${CMAKE_BINARY_DIR}/libzypp.pc @ONLY)
144 INSTALL( FILES ${CMAKE_BINARY_DIR}/libzypp.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig )
146 MACRO(add_subdir_sources subdir real_sources)
147 MESSAGE( STATUS "Adding ${subdir} to sources..." )
149 INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/${subdir}/CMakeLists.txt")
150 FOREACH(src ${sources})
151 MESSAGE( STATUS " - ${CMAKE_CURRENT_SOURCE_DIR}/${subdir}/${src}" )
152 SET(real_sources ${real_sources} "${CMAKE_CURRENT_SOURCE_DIR}/${subdir}/${src}")
154 ENDMACRO(add_subdir_sources)
156 ####################################################################
158 ####################################################################
160 ADD_SUBDIRECTORY( zypp )
161 ADD_SUBDIRECTORY( zypp2 )
162 # do not build devel by default
163 ADD_SUBDIRECTORY( devel EXCLUDE_FROM_ALL )
164 ADD_SUBDIRECTORY( tools EXCLUDE_FROM_ALL )
165 #ADD_SUBDIRECTORY( examples )
166 #ADD_SUBDIRECTORY( po )
167 ADD_SUBDIRECTORY( doc EXCLUDE_FROM_ALL )
169 ####################################################################
171 ####################################################################
173 INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
175 ####################################################################
177 ####################################################################
179 #configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
180 #yumschemadir=${zyppdir}/schema/yum
181 #xmlstoreschemadir=${zyppdir}/schema/xmlstore
183 ####################################################################
185 ####################################################################
187 #INSTALL_FILES( FILES libzypp.pc )
189 ADD_CUSTOM_TARGET( svncheck
190 COMMAND cd $(CMAKE_SOURCE_DIR) && ! LC_ALL=C svn status --show-updates --quiet | grep -v '^Status against revision'
193 SET( AUTOBUILD_COMMAND
194 COMMAND ${CMAKE_MAKE_PROGRAM} package_source
195 COMMAND ${CMAKE_COMMAND} -E copy ${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.bz2 ${CMAKE_BINARY_DIR}/package
196 COMMAND ${CMAKE_COMMAND} -E remove ${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.bz2
197 COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_SOURCE_DIR}/package/${PACKAGE}.changes" "${CMAKE_BINARY_DIR}/package/${PACKAGE}.changes"
200 ADD_CUSTOM_TARGET( autobuild_local
204 ADD_CUSTOM_TARGET( autobuild
205 COMMAND ${CMAKE_MAKE_PROGRAM} svncheck