1 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
2 PROJECT(libsyscommon C)
4 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src)
5 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/src/shared)
6 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
7 ADD_SUBDIRECTORY(src/plugin-api/common)
8 ADD_SUBDIRECTORY(src/plugin-api/resourced)
9 ADD_SUBDIRECTORY(src/plugin-api/deviced)
10 # ADD_SUBDIRECTORY(src/libgdbus)
12 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
13 SET(EXEC_PREFIX "${PREFIX}/bin")
14 SET(LIBDIR ${LIB_INSTALL_DIR})
15 SET(INCLUDEDIR "${PREFIX}/include")
16 SET(VERSION ${FULLVER})
19 src/libgdbus/libgdbus.c
20 src/libsystemd/libsystemd.c
21 src/libcommon/ini-parser.c
23 src/libcommon/common.c
24 src/libcommon/bitmap.c
25 src/resource-manager/resource-manager.c
26 src/resource-manager/resource-device.c
27 src/resource-manager/resource-listener-epoll.c
31 INCLUDE(FindPkgConfig)
32 pkg_check_modules(syscommon REQUIRED
40 FOREACH(flag ${syscommon_CFLAGS})
41 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
44 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
47 ADD_LIBRARY(${PROJECT_NAME} SHARED ${libsyscommon_SRCS})
48 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${syscommon_LDFLAGS} "-ldl" pthread)
49 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-fPIC")
50 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION})
51 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES OUTPUT_NAME syscommon)
54 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
57 FOREACH(flag ${syscommon_INCLUDE_DIRS})
58 SET(SYSCOMMON_INCLUDEDIR "${SYSCOMMON_INCLUDEDIR} -I${flag}")
61 FOREACH(flag ${syscommon_LIBRARIES})
62 SET(SYSCOMMON_LIBS "${SYSCOMMON_LIBS} -l${flag}")
65 CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
66 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
69 INSTALL(DIRECTORY include/libsyscommon DESTINATION include)
71 ADD_SUBDIRECTORY(tests)