2 #############################################
4 # Step 1. Set Variable and Build Dependency
7 # set a name for the entire project
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")
16 # checks for build dependency modules : a pkg-config module for CMake
17 INCLUDE(FindPkgConfig)
18 pkg_check_modules(LPKGS REQUIRED
34 #############################################
36 # Step 2. Set Compile Environment
39 # set extra cflags from build dependency
40 STRING(REPLACE ";" " " EXTRA_CFLAGS "${LPKGS_CFLAGS}")
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)
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)
53 ADD_DEFINITIONS("-DGLIB_VERSION_MIN_REQUIRED=(2<<16|32<<8) ")
55 #############################################
57 # Step 3. Set Link Environment
60 # add an executable to the project using the specified source files.
61 ADD_EXECUTABLE(${EXENAME} ${SRCS})
63 # link a target to given libraries.
64 TARGET_LINK_LIBRARIES(${EXENAME} ${LPKGS_LIBRARIES})
66 # sets additional compiler flags used to build sources within the target.
67 SET_TARGET_PROPERTIES(${EXENAME} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS})
69 #############################################
71 # Step 4. Install packages
74 # install executable file
75 INSTALL(TARGETS ${EXENAME} DESTINATION ${BINDIR})
77 # install dm configuration files
78 INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/oma-dm-cfg DESTINATION /usr/share)
80 # install oma ds dbus file
81 INSTALL(FILES ${CMAKE_SOURCE_DIR}/com.samsung.omadmagent.service DESTINATION /usr/share/dbus-1/services)
83 # install booting script file
84 INSTALL(PROGRAMS ${CMAKE_SOURCE_DIR}/${PROJECT_NAME} DESTINATION /etc/init.d/)
86 # install smack rule file
87 Install(FILES ${CMAKE_SOURCE_DIR}/oma-dm-agent.rule DESTINATION /etc/smack/accesses2.d)