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