1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
3 INCLUDE(GNUInstallDirs)
5 # Target lib (for backward compatibility, the below old naming is used)
6 SET(target "core-context-manager")
9 FILE(GLOB_RECURSE SRCS src/*.cpp)
11 SET(inc_subdir "context-service")
12 SET(dependency "glib-2.0 dlog capi-base-common capi-system-info sensor")
15 INCLUDE(FindPkgConfig)
17 ${CMAKE_CURRENT_SOURCE_DIR}/include
18 ${CMAKE_CURRENT_SOURCE_DIR}/src/shared
21 ADD_DEFINITIONS(-O2 -Wall -fPIC -fdata-sections -ffunction-sections -fvisibility=hidden)
22 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fPIC -Wl,--as-needed -Wl,--gc-section -Wl,--print-gc-section")
25 pkg_check_modules(pkgs REQUIRED ${dependency})
27 FOREACH(flag ${pkgs_CFLAGS})
28 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
31 ADD_LIBRARY(${target} SHARED ${SRCS})
32 TARGET_LINK_LIBRARIES(${target} ${pkgs_LDFLAGS})
33 SET_TARGET_PROPERTIES(${target} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS})
34 SET_TARGET_PROPERTIES(${target} PROPERTIES COMPILE_DEFINITIONS "LOG_TAG=\"CONTEXT-LIB\"")
35 SET_TARGET_PROPERTIES(${target} PROPERTIES SOVERSION ${MAJORVER})
36 SET_TARGET_PROPERTIES(${target} PROPERTIES VERSION ${FULLVER})
39 INSTALL(TARGETS ${target} DESTINATION ${CMAKE_INSTALL_LIBDIR})
41 DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${inc_subdir}
42 FILES_MATCHING PATTERN "*.h"
45 SET(VERSION ${FULLVER})
46 SET(PC_PREFIX ${CMAKE_INSTALL_PREFIX})
47 SET(PC_NAME ${PROJECT_NAME})
48 SET(PC_LIBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
49 SET(PC_INCLUDE "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/${inc_subdir}")
50 SET(PC_DESCRIPTION "Tizen Native Motion Recognition API")
51 SET(PC_REQUIRED ${dependency})
52 SET(PC_LDFLAGS -l${target})
53 SET(PC_CFLAGS -I\${includedir}/${inc_subdir})
57 ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc
60 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)