372b2fedcb4c6768cf0c827cf35bc079037c368f
[platform/core/system/sync-agent.git] / src / framework / CMakeLists.txt
1
2 #############################################
3 #
4 # Step 1. Set Variable and Build Dependency
5 #
6
7 # set a name for the entire project
8 PROJECT(sync-agent)
9
10 SET(LIBNAME "lib${PROJECT_NAME}")
11 SET(LIBDIR "${LIB_INSTALL_DIR}")
12
13 # set variables
14 SET(FW_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../include")
15 SET(FW_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../src/framework")
16 SET(FW_COMPONETS "account;data-adapter;device;device-manager;engine-controller;event;fsapi;initialization;network-access;platform-monitor;plugin;protocol-binder;security-assistant;utility")
17
18 # checks for build dependency modules : a pkg-config module for CMake
19 INCLUDE(FindPkgConfig)
20 pkg_check_modules(LPKGS REQUIRED
21                                         glib-2.0
22                                         sqlite3
23                                         libsoup-2.4
24                                         vconf
25                                         uuid
26                                         libxml-2.0
27                                         libwbxml2
28                                         dlog
29                                         dbus-glib-1
30                                         sysman
31                                         )
32
33 #############################################
34 #
35 # Step 2. Set Compile Environment
36 #
37
38 # set extra cflags from build dependency
39 STRING(REPLACE ";" " " EXTRA_CFLAGS "${LPKGS_CFLAGS}")
40 #SET(EXTRA_CFLAGS "-fvisibility=hidden ${EXTRA_CFLAGS}")
41
42 # find all source files in a directory.
43 FOREACH(FW_COMPONENT ${FW_COMPONETS})
44         AUX_SOURCE_DIRECTORY(${FW_SRC_DIR}/${FW_COMPONENT} SRCS)
45 ENDFOREACH(FW_COMPONENT)
46
47 # add include directories to the build.
48 INCLUDE_DIRECTORIES(${FW_INCLUDE_DIR})
49 FOREACH(FW_COMPONENT ${FW_COMPONETS})
50         INCLUDE_DIRECTORIES(${FW_INCLUDE_DIR}/${FW_COMPONENT})
51 ENDFOREACH(FW_COMPONENT)
52 INCLUDE_DIRECTORIES(${FW_SRC_DIR})
53 FOREACH(FW_COMPONENT ${FW_COMPONETS})
54         INCLUDE_DIRECTORIES(${FW_SRC_DIR}/${FW_COMPONENT})
55 ENDFOREACH(FW_COMPONENT)
56
57 #############################################
58 #
59 # Step 3. Set Link Environment
60 #
61
62 # add a library to the project using the specified source files.
63 ADD_LIBRARY(${LIBNAME} SHARED ${SRCS})
64
65 # link a target to given libraries from pkg-config.
66 TARGET_LINK_LIBRARIES(${LIBNAME} ${LPKGS_LDFLAGS} "-lgcrypt")
67
68 # sets additional compiler flags used to build sources within the target.
69 SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES COMPILE_FLAGS "${EXTRA_CFLAGS}")
70
71 # override the default target name prefix (such as "lib")
72 SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES PREFIX "")
73
74 # specify the build version
75 SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES VERSION ${VERSION})
76
77 # specify the api version
78 SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
79
80
81 #############################################
82 #
83 # Step 4. Install packages
84 #
85
86 # install library files
87 INSTALL(TARGETS ${LIBNAME} DESTINATION ${LIB_INSTALL_DIR})
88
89 # install .pc file
90 CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
91 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
92
93 # install header files
94 INSTALL(FILES ${FW_INCLUDE_DIR}/sync_agent.h DESTINATION include/)
95 FOREACH(FW_COMPONENT ${FW_COMPONETS})
96         INSTALL(DIRECTORY ${FW_INCLUDE_DIR}/${FW_COMPONENT}/ DESTINATION include/sync-agent/${FW_COMPONENT} FILES_MATCHING PATTERN "*.h")
97 ENDFOREACH(FW_COMPONENT)
98
99 ADD_DEFINITIONS("-DGLIB_VERSION_MIN_REQUIRED=(2<<16|32<<8) ")