blob: 8511943d74bb386f07254aeddfdee99bf76970cb [file] [log] [blame]
AppaRao Puli00840472018-10-03 19:37:46 +05301cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
2project(phosphor-srvcfg-manager CXX)
3set(CMAKE_CXX_STANDARD 17)
4set(CMAKE_CXX_STANDARD_REQUIRED ON)
AppaRao Puli00840472018-10-03 19:37:46 +05305
6set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
7
8include(GNUInstallDirs)
9include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc)
10find_package(Boost REQUIRED)
11include_directories(${Boost_INCLUDE_DIRS})
12add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY)
13add_definitions(-DBOOST_SYSTEM_NO_DEPRECATED)
14add_definitions(-DBOOST_ALL_NO_LIB)
15add_definitions(-DBOOST_NO_RTTI)
16add_definitions(-DBOOST_NO_TYPEID)
17add_definitions(-DBOOST_ASIO_DISABLE_THREADS)
Richard Marian Thomaiyar90f2da32019-05-23 05:37:50 +053018add_definitions(-DBOOST_COROUTINES_NO_DEPRECATION_WARNING)
AppaRao Puli00840472018-10-03 19:37:46 +053019
20set(SRC_FILES src/main.cpp src/srvcfg_manager.cpp src/utils.cpp)
21
22# import libsystemd
23find_package(PkgConfig REQUIRED)
24pkg_check_modules(SYSTEMD libsystemd REQUIRED)
25include_directories(${SYSTEMD_INCLUDE_DIRS})
26link_directories(${SYSTEMD_LIBRARY_DIRS})
27
28# import sdbusplus
29find_package(PkgConfig REQUIRED)
30pkg_check_modules(SDBUSPLUSPLUS sdbusplus REQUIRED)
31include_directories(${SDBUSPLUSPLUS_INCLUDE_DIRS})
32link_directories(${SDBUSPLUSPLUS_LIBRARY_DIRS})
33find_program(SDBUSPLUSPLUS sdbus++)
34
35# phosphor-dbus-interfaces
36find_package(PkgConfig REQUIRED)
37pkg_check_modules(DBUSINTERFACE phosphor-dbus-interfaces REQUIRED)
38include_directories(${DBUSINTERFACE_INCLUDE_DIRS})
39link_directories(${DBUSINTERFACE_LIBRARY_DIRS})
40
41# import phosphor-logging
42find_package(PkgConfig REQUIRED)
43pkg_check_modules(LOGGING phosphor-logging REQUIRED)
44include_directories(${LOGGING_INCLUDE_DIRS})
45link_directories(${LOGGING_LIBRARY_DIRS})
46
47add_executable(${PROJECT_NAME} ${SRC_FILES})
48target_link_libraries(${PROJECT_NAME} systemd)
49target_link_libraries(${PROJECT_NAME} "${SDBUSPLUSPLUS_LIBRARIES} -lstdc++fs")
50target_link_libraries(${PROJECT_NAME} ${DBUSINTERFACE_LIBRARIES})
51target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES})
Richard Marian Thomaiyar90f2da32019-05-23 05:37:50 +053052target_link_libraries(${PROJECT_NAME} boost_coroutine)
AppaRao Puli00840472018-10-03 19:37:46 +053053target_link_libraries(${PROJECT_NAME} phosphor_logging)
54
55set(SERVICE_FILES ${PROJECT_SOURCE_DIR}/srvcfg-manager.service)
56
Richard Marian Thomaiyar90f2da32019-05-23 05:37:50 +053057install(TARGETS ${PROJECT_NAME} DESTINATION bin)
AppaRao Puli00840472018-10-03 19:37:46 +053058install(FILES ${SERVICE_FILES} DESTINATION /lib/systemd/system/)