############################################# # # Step 1. Set Variable and Build Dependency # # set a name for the entire project PROJECT(sync-agent) SET(LIBNAME "lib${PROJECT_NAME}") SET(LIBDIR "${LIB_INSTALL_DIR}") # set variables SET(FW_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../include") SET(FW_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../src/framework") SET(FW_COMPONETS "account;data-adapter;device;device-manager;engine-controller;event;fsapi;initialization;network-access;platform-monitor;plugin;protocol-binder;security-assistant;utility") # checks for build dependency modules : a pkg-config module for CMake INCLUDE(FindPkgConfig) pkg_check_modules(LPKGS REQUIRED glib-2.0 sqlite3 libsoup-2.4 vconf uuid libxml-2.0 libwbxml2 dlog dbus-glib-1 sysman libtzplatform-config ) ############################################# # # Step 2. Set Compile Environment # # set extra cflags from build dependency STRING(REPLACE ";" " " EXTRA_CFLAGS "${LPKGS_CFLAGS}") #SET(EXTRA_CFLAGS "-fvisibility=hidden ${EXTRA_CFLAGS}") # find all source files in a directory. FOREACH(FW_COMPONENT ${FW_COMPONETS}) AUX_SOURCE_DIRECTORY(${FW_SRC_DIR}/${FW_COMPONENT} SRCS) ENDFOREACH(FW_COMPONENT) # add include directories to the build. INCLUDE_DIRECTORIES(${FW_INCLUDE_DIR}) FOREACH(FW_COMPONENT ${FW_COMPONETS}) INCLUDE_DIRECTORIES(${FW_INCLUDE_DIR}/${FW_COMPONENT}) ENDFOREACH(FW_COMPONENT) INCLUDE_DIRECTORIES(${FW_SRC_DIR}) FOREACH(FW_COMPONENT ${FW_COMPONETS}) INCLUDE_DIRECTORIES(${FW_SRC_DIR}/${FW_COMPONENT}) ENDFOREACH(FW_COMPONENT) ############################################# # # Step 3. Set Link Environment # # add a library to the project using the specified source files. ADD_LIBRARY(${LIBNAME} SHARED ${SRCS}) # link a target to given libraries from pkg-config. TARGET_LINK_LIBRARIES(${LIBNAME} ${LPKGS_LDFLAGS} "-lgcrypt") # sets additional compiler flags used to build sources within the target. SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES COMPILE_FLAGS "${EXTRA_CFLAGS}") # override the default target name prefix (such as "lib") SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES PREFIX "") # specify the build version SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES VERSION ${VERSION}) # specify the api version SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES SOVERSION ${VERSION_MAJOR}) ############################################# # # Step 4. Install packages # # install library files INSTALL(TARGETS ${LIBNAME} DESTINATION ${LIB_INSTALL_DIR}) # install .pc file CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) # install header files INSTALL(FILES ${FW_INCLUDE_DIR}/sync_agent.h DESTINATION include/) FOREACH(FW_COMPONENT ${FW_COMPONETS}) INSTALL(DIRECTORY ${FW_INCLUDE_DIR}/${FW_COMPONENT}/ DESTINATION include/sync-agent/${FW_COMPONENT} FILES_MATCHING PATTERN "*.h") ENDFOREACH(FW_COMPONENT) ADD_DEFINITIONS("-DGLIB_VERSION_MIN_REQUIRED=(2<<16|32<<8) ")