[systemd] Fix oma-dm-agent service fail to start
[framework/system/oma-dm-agent.git] / src / agent / 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(oma-dm)
9
10 # set variables
11 SET(EXENAME "${PROJECT_NAME}-agent")
12 SET(BINDIR "${PREFIX}/bin")
13 SET(OMADM_SRC_DIR "${CMAKE_SOURCE_DIR}/src/agent")
14 SET(OMADM_COMPONETS "common;common/dm-status;common/util;framework;framework/task;framework/ui-event-handler;framework/ui-event-handler/user-interaction;framework/platform-event-handler;framework/san-parser;dm-engine;dm-engine/fumo;dm-engine/lawmo;dm-engine/bootstrap;dm-engine/cp;dm-engine/dl-manager;mo-handler;serviceadapter;serviceadapter/dm-phase-handler;serviceadapter/protocolbinder;serviceadapter/networkbinder")
15
16 # checks for build dependency modules : a pkg-config module for CMake
17 INCLUDE(FindPkgConfig)
18 pkg_check_modules(LPKGS REQUIRED
19                                         glib-2.0
20                                         libsoup-2.4
21                                         sqlite3
22                                         sync-agent
23                                         vconf
24                                         libxml-2.0
25                                         aul
26                                         libwbxml2
27 #                                       oauth
28                                         appsvc
29                                         dlog
30                                         dbus-glib-1
31 #                                       appcore-efl
32                                         )
33
34 #############################################
35 #
36 # Step 2. Set Compile Environment
37 #
38
39 # set extra cflags from build dependency
40 STRING(REPLACE ";" " " EXTRA_CFLAGS "${LPKGS_CFLAGS}")
41
42 # find all source files in a directory.
43 AUX_SOURCE_DIRECTORY(${OMADM_SRC_DIR} SRCS)
44 FOREACH(OMADM_COMPONET ${OMADM_COMPONETS})
45         AUX_SOURCE_DIRECTORY(${OMADM_SRC_DIR}/${OMADM_COMPONET} SRCS)
46 ENDFOREACH(OMADM_COMPONET)
47
48 # add internal include directories to the build.
49 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
50 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include/framework/ui-event-handler)
51
52 # add define macros
53 ADD_DEFINITIONS("-DGLIB_VERSION_MIN_REQUIRED=(2<<16|32<<8) ")
54
55 #############################################
56 #
57 # Step 3. Set Link Environment
58 #
59
60 # add an executable to the project using the specified source files.
61 ADD_EXECUTABLE(${EXENAME} ${SRCS})
62
63 # link a target to given libraries.
64 TARGET_LINK_LIBRARIES(${EXENAME} ${LPKGS_LIBRARIES})
65
66 # sets additional compiler flags used to build sources within the target.
67 SET_TARGET_PROPERTIES(${EXENAME} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS})
68
69 #############################################
70 #
71 # Step 4. Install packages
72 #
73
74 # install executable file
75 INSTALL(TARGETS ${EXENAME} DESTINATION ${BINDIR})
76
77 # install dm configuration files
78 INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/oma-dm-cfg DESTINATION /usr/share)
79
80 # install oma ds dbus file
81 INSTALL(FILES ${CMAKE_SOURCE_DIR}/com.samsung.omadmagent.service DESTINATION /usr/share/dbus-1/services)
82
83 # install smack rule file
84 Install(FILES ${CMAKE_SOURCE_DIR}/oma-dm-agent.rule DESTINATION /etc/smack/accesses2.d)