1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
2 PROJECT(context-common)
3 INCLUDE(GNUInstallDirs)
6 SET(target_lib "ctx-common")
9 FILE(GLOB_RECURSE SRCS src/*.cpp)
10 MESSAGE("Sources: ${SRCS}")
13 SET(DEPS "glib-2.0 gio-2.0 json-glib-1.0 dlog capi-base-common")
15 INCLUDE(FindPkgConfig)
17 ${CMAKE_CURRENT_SOURCE_DIR}/include
18 ${CMAKE_CURRENT_SOURCE_DIR}/src/shared
20 ADD_DEFINITIONS(-g -O2 -Wall -fPIC -Wl,--as-needed)
23 pkg_check_modules(lib_pkg REQUIRED ${DEPS})
25 FOREACH(flag ${lib_pkg_CFLAGS})
26 SET(LIB_EXTRA_CFLAGS "${LIB_EXTRA_CFLAGS} ${flag}")
29 ADD_LIBRARY(${target_lib} SHARED ${SRCS})
30 TARGET_LINK_LIBRARIES(${target_lib} ${lib_pkg_LDFLAGS})
31 SET_TARGET_PROPERTIES(${target_lib} PROPERTIES COMPILE_FLAGS ${LIB_EXTRA_CFLAGS})
32 SET_TARGET_PROPERTIES(${target_lib} PROPERTIES COMPILE_DEFINITIONS "LOG_TAG=\"CONTEXT\"")
33 SET_TARGET_PROPERTIES(${target_lib} PROPERTIES SOVERSION ${MAJORVER})
34 SET_TARGET_PROPERTIES(${target_lib} PROPERTIES VERSION ${FULLVER})
37 INSTALL(TARGETS ${target_lib} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT RuntimeLibraries)
39 DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/context-service/internal
40 FILES_MATCHING PATTERN "*.h"
43 SET(VERSION ${FULLVER})
44 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
45 SET(PC_NAME ${PROJECT_NAME})
46 SET(PC_INCLUDE "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/context-service/internal")
47 SET(PC_LIBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
48 SET(PC_DESCRIPTION "Tizen Context-Service Shared Library")
49 SET(PC_REQUIRED ${DEPS})
50 SET(PC_LDFLAGS -l${target_lib})
51 SET(PC_CFLAGS -I\${includedir}/context-service/internal)
55 ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc
58 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)