blob: 10377f14d37b2aba21b7b4efba3914b6930bf565 [file] [log] [blame]
AppaRao Pulie63eeda2019-07-05 16:25:38 +05301cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
2project(intel-pfr-manager CXX)
3set(CMAKE_CXX_STANDARD 17)
4set(CMAKE_CXX_STANDARD_REQUIRED ON)
5set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
6
7set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
8
9include(GNUInstallDirs)
10include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc)
11
12set(SRC_FILES src/mainapp.cpp src/pfr_mgr.cpp)
13
14find_package(Boost REQUIRED)
15include_directories(${Boost_INCLUDE_DIRS})
16add_definitions(-DBOOST_ERROR_CODE_HEADER_ONLY)
17add_definitions(-DBOOST_SYSTEM_NO_DEPRECATED)
18add_definitions(-DBOOST_ALL_NO_LIB)
19add_definitions(-DBOOST_NO_RTTI)
20add_definitions(-DBOOST_NO_TYPEID)
21add_definitions(-DBOOST_ASIO_DISABLE_THREADS)
22
23# import libsystemd
24find_package(PkgConfig REQUIRED)
25pkg_check_modules(SYSTEMD libsystemd REQUIRED)
26include_directories(${SYSTEMD_INCLUDE_DIRS})
27link_directories(${SYSTEMD_LIBRARY_DIRS})
28
29# import sdbusplus
30find_package(PkgConfig REQUIRED)
31pkg_check_modules(SDBUSPLUSPLUS sdbusplus REQUIRED)
32include_directories(${SDBUSPLUSPLUS_INCLUDE_DIRS})
33link_directories(${SDBUSPLUSPLUS_LIBRARY_DIRS})
34find_program(SDBUSPLUSPLUS sdbus++)
35
36# import phosphor-logging
37find_package(PkgConfig REQUIRED)
38pkg_check_modules(LOGGING phosphor-logging REQUIRED)
39include_directories(${LOGGING_INCLUDE_DIRS})
40link_directories(${LOGGING_LIBRARY_DIRS})
41
42add_executable(${PROJECT_NAME} ${SRC_FILES})
43target_link_libraries(${PROJECT_NAME} systemd)
44target_link_libraries(${PROJECT_NAME} "${SDBUSPLUSPLUS_LIBRARIES} -lstdc++fs")
45target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES})
46target_link_libraries(${PROJECT_NAME} phosphor_logging)
47target_link_libraries(${PROJECT_NAME} pfr)
48target_link_libraries(${PROJECT_NAME} i2c)
49
50install(TARGETS ${PROJECT_NAME} DESTINATION bin)