3 cmake_minimum_required(VERSION 2.4)
5 #IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERISION} GREATER 2.4)
6 #ENDIF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERISION} GREATER 2.4)
8 if(COMMAND cmake_policy)
9 # escape preprocessor, see -DVERSION below
10 cmake_policy(SET CMP0005 OLD)
11 endif(COMMAND cmake_policy)
16 SET ( LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${LIB}" )
18 IF (CMAKE_SIZEOF_VOID_P MATCHES "8")
19 SET( LIB_SUFFIX "64" )
20 ENDIF(CMAKE_SIZEOF_VOID_P MATCHES "8")
21 SET ( LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" )
23 MESSAGE(STATUS "Libraries will be installed in ${LIB_INSTALL_DIR}" )
24 SET( BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin" )
26 ####################################################################
28 ####################################################################
30 # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
31 SET( CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules )
33 INCLUDE( ${CMAKE_SOURCE_DIR}/VERSION.cmake )
35 FIND_PACKAGE(EXPAT REQUIRED)
36 FIND_LIBRARY(RPMDB_LIBRARY NAMES rpmdb)
37 FIND_LIBRARY(ZLIB_LIBRARY NAMES z)
39 SET( PACKAGE "satsolver" )
40 SET( VERSION "${LIBSATSOLVER_MAJOR}.${LIBSATSOLVER_MINOR}.${LIBSATSOLVER_PATCH}" )
42 ADD_DEFINITIONS( -D_FILE_OFFSET_BITS=64 )
43 ADD_DEFINITIONS( -DVERSION=\\\"${VERSION}\\\" )
45 SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "mls solver")
46 SET(CPACK_PACKAGE_VENDOR "Novell Inc.")
47 SET(CPACK_PACKAGE_VERSION_MAJOR ${LIBSATSOLVER_MAJOR})
48 SET(CPACK_PACKAGE_VERSION_MINOR ${LIBSATSOLVER_MINOR})
49 SET(CPACK_PACKAGE_VERSION_PATCH ${LIBSATSOLVER_PATCH})
50 SET( CPACK_GENERATOR "TBZ2")
51 SET( CPACK_SOURCE_GENERATOR "TBZ2")
52 SET( CPACK_SOURCE_PACKAGE_FILE_NAME "${PACKAGE}-${VERSION}" )
54 # The following components are regex's to match anywhere (unless anchored)
55 # in absolute path + filename to find files or directories to be excluded
56 # from source tarball.
57 SET (CPACK_SOURCE_IGNORE_FILES
84 "testsuite/data.libzypp/kernel-tests/kernel-hardware"
85 "testsuite/data.libzypp/yast-tests/kernel3-hardware"
93 ####################################################################
96 "${CMAKE_INSTALL_PREFIX}/share/doc/packages/${PACKAGE}"
97 CACHE PATH "The install dir for documentation (default prefix/share/doc/packages/${PACKAGE})"
101 ####################################################################
103 ####################################################################
105 #SET (CMAKE_INCLUDE_DIRECTORIES_BEFORE ON)
106 INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR} SYSTEM )
108 ####################################################################
110 MESSAGE(STATUS "Looking modules in ${CMAKE_MODULE_PATH}")
111 FIND_PROGRAM(SWIG_EXECUTABLE
113 PATHS ${SWIG_DIR} ${SWIG_DIR}/.. ${SWIG_DIR}/../../bin /usr/bin /usr/local/bin ${CMAKE_INSTALL_PREFIX}/bin
116 set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Wall" )
117 set ( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -g -O3" )
118 set ( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g3 -O0" )
120 ADD_SUBDIRECTORY(src)
121 ADD_SUBDIRECTORY(tools)
122 ADD_SUBDIRECTORY(applayer)
123 ADD_SUBDIRECTORY(testsuite)
125 IF ( NOT SWIG_EXECUTABLE )
126 MESSAGE( FATAL "SWIG not found." )
127 ELSE ( NOT SWIG_EXECUTABLE )
128 MESSAGE( STATUS "SWIG found at ${SWIG_EXECUTABLE}" )
129 ADD_SUBDIRECTORY(bindings)
130 ENDIF ( NOT SWIG_EXECUTABLE )
132 MESSAGE(STATUS "version: ${VERSION}")
134 ####################################################################
136 ####################################################################
139 MESSAGE(STATUS "Writing spec file...")
140 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/package/libsatsolver.spec.in ${CMAKE_BINARY_DIR}/package/libsatsolver.spec @ONLY)
141 #MESSAGE(STATUS "I hate you rpm-lint...!!!")
142 #CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/package/libsatsolver-rpmlint.cmake ${CMAKE_BINARY_DIR}/package/libsatsolver-rpmlintrc @ONLY)
147 ADD_CUSTOM_TARGET( svncheck
148 COMMAND cd $(CMAKE_SOURCE_DIR) && ! LC_ALL=C svn status --show-updates --quiet | grep -v '^Status against revision'
151 SET( AUTOBUILD_COMMAND
152 COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/package/*.tar.bz2
153 COMMAND ${CMAKE_MAKE_PROGRAM} package_source
154 COMMAND ${CMAKE_COMMAND} -E copy ${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.bz2 ${CMAKE_BINARY_DIR}/package
155 COMMAND ${CMAKE_COMMAND} -E remove ${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.bz2
156 COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_SOURCE_DIR}/package/libsatsolver.changes" "${CMAKE_BINARY_DIR}/package/libsatsolver.changes"
159 ADD_CUSTOM_TARGET( srcpackage_local
163 ADD_CUSTOM_TARGET( srcpackage
164 COMMAND ${CMAKE_MAKE_PROGRAM} svncheck