CMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(SLP-db-util) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(EXEC_PREFIX "\${prefix}") SET(LIBDIR "\${prefix}/lib") SET(INCLUDEDIR "\${prefix}/include/db-util") SET(VERSION_MAJOR 0) SET(VERSION "${VERSION_MAJOR}.1.0") SET(SRCS util_func.c collation.c) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) INCLUDE(FindPkgConfig) pkg_check_modules(pkgs REQUIRED sqlite3 dlog glib-2.0 icu-i18n ) FOREACH(flag ${pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -ldl -g") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"") ADD_DEFINITIONS("-DFACTORYFS=\"$ENV{FACTORYFS}\"") ADD_DEFINITIONS("-DDB_UTIL_USING_PLATFORM_DBG") ADD_DEFINITIONS("-DDB_UTIL_ENABLE_TRACE") ##ADD_DEFINITIONS("-DDB_UTIL_ENABLE_DEVDEBUG") ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} -ldl) SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR}) SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION}) CONFIGURE_FILE(db-util.pc.in db-util.pc @ONLY) INSTALL(TARGETS ${PROJECT_NAME} DESTINATION lib COMPONENT RuntimeLibraries) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/db-util.pc DESTINATION lib/pkgconfig) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/db-util.h DESTINATION include/db-util) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/db-util-common.h DESTINATION include/db-util) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/util-func.h DESTINATION include/db-util) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/collation.h DESTINATION include/db-util)