CMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(contacts-service C) #IF("${CMAKE_BUILD_TYPE}" STREQUAL "") # SET(CMAKE_BUILD_TYPE "Release") #ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "") #MESSAGE("Build type: ${CMAKE_BUILD_TYPE}") SET(DEST_INCLUDE_DIR "include/contacts-svc") SET(SRC_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/include") SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(EXEC_PREFIX "\${prefix}") SET(LIBDIR "\${prefix}/lib") SET(INCLUDEDIR "\${prefix}/${DEST_INCLUDE_DIR}") SET(VERSION_MAJOR 0) SET(VERSION "${VERSION_MAJOR}.6.1") EXECUTE_PROCESS(COMMAND build-util/generator.sh) #INCLUDE_DIRECTORIES(${SRC_INCLUDE_DIR}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -I${SRC_INCLUDE_DIR}") FILE(GLOB SRCS src/*.c) INCLUDE(FindPkgConfig) pkg_check_modules(pkgs REQUIRED glib-2.0 sqlite3 vconf dlog db-util) FOREACH(flag ${pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") #SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") #SET(CMAKE_C_FLAGS_RELEASE "-mabi=aapcs-linux -march=armv7-a -msoft-float -O2") ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"") ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS}) SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR}) SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} -lpthread) CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY) SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_NAME}.pc;include/contacts-svc-sub.h;include/contacts-svc.h;include/contacts-svc-struct.h;helper/schema.h") INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib) INSTALL(FILES ${PROJECT_NAME}.pc DESTINATION lib/pkgconfig) FILE(GLOB HEADER_FILES ${SRC_INCLUDE_DIR}/contacts-svc*.h) INSTALL(FILES ${HEADER_FILES} DESTINATION ${DEST_INCLUDE_DIR}) INSTALL(FILES ${SRC_INCLUDE_DIR}/ContactsService_PG.h DESTINATION ${DEST_INCLUDE_DIR}) FILE(GLOB NOTI_FILES ${CMAKE_SOURCE_DIR}/res/.CONTACTS_SVC_*) INSTALL(FILES ${NOTI_FILES} DESTINATION /opt/data/contacts-svc PERMISSIONS OWNER_WRITE OWNER_READ GROUP_WRITE GROUP_READ) INSTALL(DIRECTORY DESTINATION /opt/data/contacts-svc/img/vcard) ADD_SUBDIRECTORY(helper)