Sync with the renamed packages of app-history & sensor-recorder
[platform/core/context/context-service.git] / CMakeLists.txt
1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
2 PROJECT(context-service)
3 INCLUDE(GNUInstallDirs)
4
5 SET(target "contextd")
6
7 SET(DEPS "libsystemd-login glib-2.0 gio-2.0 dlog capi-base-common alarm-service")
8 SET(DEPS "${DEPS} context-common-server")
9 SET(DEPS "${DEPS} context-app-history-server")
10 SET(DEPS "${DEPS} context-sensor-recorder-server")
11 SET(DEPS "${DEPS} context-store-server")
12
13 FILE(GLOB_RECURSE SRCS src/*.cpp)
14 MESSAGE("Sources: ${SRCS}")
15
16 ADD_DEFINITIONS(-O2 -Wall -fPIC -fPIE -fdata-sections -ffunction-sections -fvisibility=hidden)
17 ADD_DEFINITIONS(-DLOG_TAG="CONTEXT")
18 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fPIC -pie -Wl,--as-needed -Wl,--gc-section -Wl,--print-gc-section")
19
20 INCLUDE(FindPkgConfig)
21 pkg_check_modules(DEPS_PKG REQUIRED ${DEPS})
22
23 FOREACH(flag ${DEPS_PKG_CFLAGS})
24         SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
25 ENDFOREACH(flag)
26
27 ADD_EXECUTABLE(${target} ${SRCS})
28 TARGET_LINK_LIBRARIES(${target} ${DEPS_PKG_LDFLAGS})
29
30 INSTALL(TARGETS ${target} DESTINATION ${CMAKE_INSTALL_BINDIR})