1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
2 PROJECT(context-service)
3 INCLUDE(GNUInstallDirs)
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")
13 FILE(GLOB_RECURSE SRCS src/*.cpp)
14 MESSAGE("Sources: ${SRCS}")
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")
20 INCLUDE(FindPkgConfig)
21 pkg_check_modules(DEPS_PKG REQUIRED ${DEPS})
23 FOREACH(flag ${DEPS_PKG_CFLAGS})
24 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
27 ADD_EXECUTABLE(${target} ${SRCS})
28 TARGET_LINK_LIBRARIES(${target} ${DEPS_PKG_LDFLAGS})
30 INSTALL(TARGETS ${target} DESTINATION ${CMAKE_INSTALL_BINDIR})