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(OMADS_SRC_DIR "${CMAKE_SOURCE_DIR}/src/agent")
14 SET(OMADS_COMPONETS "main;common;framework/san-parser;framework/event;framework/task;service-adapter;service-adapter/network-binder;service-adapter/protocol-binder;service-engine")
16 # checks for build dependency modules : a pkg-config module for CMake
17 INCLUDE(FindPkgConfig)
18 pkg_check_modules(LPKGS REQUIRED
30 #############################################
32 # Step 2. Set Compile Environment
35 # set extra cflags from build dependency
36 STRING(REPLACE ";" " " EXTRA_CFLAGS "${LPKGS_CFLAGS}")
38 # find all source files in a directory.
39 FOREACH(OMADS_COMPONET ${OMADS_COMPONETS})
40 AUX_SOURCE_DIRECTORY(${OMADS_SRC_DIR}/${OMADS_COMPONET} SRCS)
41 ENDFOREACH(OMADS_COMPONET)
43 # add internal include directories to the build.
44 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
45 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include/san-parser)
48 ADD_DEFINITIONS("-DGLIB_VERSION_MIN_REQUIRED=(2<<16|32<<8) ")
50 #############################################
52 # Step 3. Set Link Environment
55 # add an executable to the project using the specified source files.
56 ADD_EXECUTABLE(${EXENAME} ${SRCS})
58 # link a target to given libraries.
59 TARGET_LINK_LIBRARIES(${EXENAME} ${LPKGS_LIBRARIES})
61 # sets additional compiler flags used to build sources within the target.
62 SET_TARGET_PROPERTIES(${EXENAME} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS})
64 #############################################
66 # Step 4. Install packages
69 # install executable file
70 INSTALL(TARGETS ${EXENAME} DESTINATION ${BINDIR})
72 # install oma ds configuration files
73 INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/oma-ds-cfg DESTINATION /usr/share)
75 # install oma ds dbus file
76 INSTALL(FILES ${CMAKE_SOURCE_DIR}/com.samsung.omadsagent.service DESTINATION /usr/share/dbus-1/services)
78 # install booting script file
79 INSTALL(PROGRAMS ${CMAKE_SOURCE_DIR}/${PROJECT_NAME} DESTINATION /etc/init.d/)