CMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(rua C) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) SET(EXEC_PREFIX "\${prefix}") SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}") SET(VERSION 0.1.0) SET(SRCS src/rua.c src/rua_internal.c src/rua_stat.c src/rua_stat_internal.c ) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) INCLUDE(FindPkgConfig) pkg_check_modules(pkgs REQUIRED sqlite3 db-util libtzplatform-config bundle aul) 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}") ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"") ADD_DEFINITIONS("-DFACTORYFS=\"$ENV{FACTORYFS}\"") ADD_DEFINITIONS("-DDATAFS=\"$ENV{DATADIR}\"") ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS}) SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION 0) SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS}) CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY) #CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc @ONLY) INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/rua.h DESTINATION include/${PROJECT_NAME}) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/rua_internal.h DESTINATION include/${PROJECT_NAME}) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/rua_stat.h DESTINATION include/${PROJECT_NAME}) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/rua_stat_internal.h DESTINATION include/${PROJECT_NAME}) ADD_SUBDIRECTORY(test)