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 -DBOOST_AUTO_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-devel not found" )
45 INCLUDE_DIRECTORIES(${RPM_INCLUDE_DIR})
46 # fix includes not relative to rpm
47 INCLUDE_DIRECTORIES(${RPM_INCLUDE_DIR}/rpm)
50 FIND_PACKAGE(Boost REQUIRED)
52 MESSAGE( STATUS "boost found: includes in ${Boost_INCLUDE_DIRS}, library in ${Boost_LIBRARY_DIRS}")
53 INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
54 LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
57 FIND_PACKAGE(Gettext REQUIRED)
59 MESSAGE(STATUS "Found Gettext: ${GETTEXT_SOURCE}")
60 INCLUDE_DIRECTORIES(${GETTEXT_INCLUDE_DIR})
62 MESSAGE( FATAL_ERROR "Gettext not found" )
65 FIND_PACKAGE(Hal REQUIRED)
67 MESSAGE( FATAL_ERROR " Hal not found" )
69 INCLUDE_DIRECTORIES(${HAL_INCLUDE_DIR})
70 # hal/libhal-storage.h is broken grrr
71 INCLUDE_DIRECTORIES(${HAL_INCLUDE_DIR}/hal)
74 FIND_PACKAGE(Dbus REQUIRED)
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)
82 FIND_PACKAGE(Curl REQUIRED)
84 MESSAGE( FATAL_ERROR " curl not found" )
85 ELSE ( NOT CURL_FOUND)
86 INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIR})
87 ENDIF( NOT CURL_FOUND)
89 FIND_PACKAGE(Libxml REQUIRED)
90 IF ( NOT LIBXML_FOUND)
91 MESSAGE( FATAL_ERROR " libxml not found" )
92 ELSE ( NOT LIBXML_FOUND)
93 INCLUDE_DIRECTORIES(${LIBXML_INCLUDE_DIR})
94 ENDIF( NOT LIBXML_FOUND)
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_PACKAGE(OpenSSL REQUIRED)
112 FIND_PROGRAM( DOXYGEN doxygen )
114 MESSAGE( FATAL_ERROR "doxygen not found: install doxygen to build the documentation." )
116 MESSAGE( STATUS "doxygen found: ${DOXYGEN}" )
117 ENDIF ( NOT DOXYGEN )
119 MESSAGE(STATUS "soname: ${LIBZYPP_VERSION_INFO}")
120 MESSAGE(STATUS "version: ${VERSION}")
122 MESSAGE(STATUS "Writing pkg-config file...")
123 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/libzypp.pc.cmake ${CMAKE_BINARY_DIR}/libzypp.pc @ONLY)
124 INSTALL( FILES ${CMAKE_BINARY_DIR}/libzypp.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig )
126 MESSAGE(STATUS "FindZypp.cmake will be installed in ${CMAKE_INSTALL_PREFIX}/share/cmake/Modules")
127 INSTALL( FILES ${CMAKE_SOURCE_DIR}/cmake/modules/FindZypp.cmake DESTINATION ${CMAKE_INSTALL_PREFIX}/share/cmake/Modules )
128 INSTALL( FILES ${CMAKE_SOURCE_DIR}/cmake/modules/ZyppCommon.cmake DESTINATION ${CMAKE_INSTALL_PREFIX}/share/cmake/Modules )
130 MESSAGE(STATUS "zypp.conf will be installed in ${SYSCONFDIR}/zypp")
131 INSTALL( FILES ${CMAKE_SOURCE_DIR}/zypp.conf DESTINATION ${SYSCONFDIR}/zypp )
133 ####################################################################
135 ####################################################################
137 ADD_SUBDIRECTORY( zypp )
138 #ADD_SUBDIRECTORY( zypp2 )
139 # do not build devel by default
140 ADD_SUBDIRECTORY( devel EXCLUDE_FROM_ALL )
141 ADD_SUBDIRECTORY( tools )
142 #ADD_SUBDIRECTORY( examples )
143 ADD_SUBDIRECTORY( po EXCLUDE_FROM_ALL )
144 ADD_SUBDIRECTORY( doc EXCLUDE_FROM_ALL )
145 ADD_SUBDIRECTORY( tests EXCLUDE_FROM_ALL )