CMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(storage C) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(EXEC_PREFIX "${PREFIX}/bin") SET(LIBDIR ${LIB_INSTALL_DIR}) SET(INCLUDEDIR "${PREFIX}/include/${PROJECT_NAME}") SET(VERSION 0.1) SET(INC_DIR include) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/${INC_DIR}) SET(dependents dlog capi-base-common vconf glib-2.0 gio-2.0 libtzplatform-config mount ) SET(pc_dependents "capi-base-common") INCLUDE(FindPkgConfig) pkg_check_modules(rpkgs REQUIRED ${dependents}) FOREACH(flag ${rpkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) SET(HEADERS include/storage.h include/storage-expand.h include/storage-internal.h include/storage-experimental.h) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden") SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g") SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Werror") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") ADD_DEFINITIONS("-D_FILE_OFFSET_BITS=64") ADD_DEFINITIONS("-DENABLE_STORAGE_DLOG") SET(SRCS src/statvfs.c src/storage.c src/storage-internal.c src/storage-external.c src/storage-external-dbus.c src/storage-inhouse.c src/storage-common.c ) ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS} ${TARGET_SRCS}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${rpkgs_LDFLAGS}) SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION}) INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries) CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/libstorage.conf DESTINATION /etc/${PROJECT_NAME} RENAME libstorage.conf) FOREACH(hfile ${HEADERS}) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${hfile} DESTINATION include/${PROJECT_NAME}) ENDFOREACH(hfile)