1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
4 IF("${VERSION}" STREQUAL "")
5 MESSAGE(FATAL_ERROR "VERSION is not defined")
7 STRING(REGEX MATCH "^[0-9]+" VERSION_MAJOR ${VERSION})
8 IF("${VERSION_MAJOR}" STREQUAL "")
9 MESSAGE(FATAL_ERROR "can't get VERSION_MAJOR")
13 INCLUDE(FindPkgConfig)
14 pkg_check_modules(pkgs REQUIRED glib-2.0 dlog capi-base-common)
15 FOREACH(flag ${pkgs_CFLAGS})
16 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
19 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
21 ### Local include directories
22 include_directories(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src)
25 add_library(bundle SHARED
31 set_target_properties(bundle PROPERTIES SOVERSION ${VERSION_MAJOR})
32 set_target_properties(bundle PROPERTIES VERSION "${VERSION}")
33 message(STATUS "Version from debian/changelog: ${VERSION}, Major version: ${VERSION_MAJOR}")
34 target_link_libraries(bundle ${pkgs_LDFLAGS})
37 ### Make pkgconfig file
38 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
39 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/bundle.pc.in ${CMAKE_BINARY_DIR}/bundle.pc @ONLY)
43 install(TARGETS bundle
44 DESTINATION ${LIB_INSTALL_DIR}
47 ${CMAKE_SOURCE_DIR}/include/bundle.h
48 ${CMAKE_SOURCE_DIR}/include/SLP_bundle_PG.h
51 install(FILES ${CMAKE_BINARY_DIR}/bundle.pc
52 DESTINATION ${LIB_INSTALL_DIR}/pkgconfig/
57 add_subdirectory(test)