blob: 956e173396622c03f5be8ab3cbf5a17ed9434f6d [file] [log] [blame]
Ed Tanous1e439872018-05-18 11:48:52 -07001cmake_minimum_required (VERSION 3.5 FATAL_ERROR)
Ed Tanous0fdddb12017-02-28 11:06:34 -08002
Ed Tanous271584a2019-07-09 16:24:22 -07003project (bmc-webserver CXX)
4
Ed Tanous1e439872018-05-18 11:48:52 -07005cmake_policy (SET CMP0054 NEW)
Ed Tanouscfbe25d2017-05-23 16:34:35 -07006
Ed Tanous1e439872018-05-18 11:48:52 -07007set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
Ed Tanous0fdddb12017-02-28 11:06:34 -08008
Ed Tanous1e439872018-05-18 11:48:52 -07009option (BUILD_STATIC_LIBS "Built static libraries" ON)
Ed Tanous911ac312017-08-15 09:37:42 -070010
Joseph Reynolds7a777f52018-11-07 22:01:31 -060011option (YOCTO_DEPENDENCIES "Use YOCTO dependencies system" OFF)
Ed Tanous0fdddb12017-02-28 11:06:34 -080012
James Feist41d1d182019-10-18 13:57:16 -070013option (
14 BMCWEB_ENABLE_KVM
15 "Enable the KVM host video WebSocket. Path is '/kvm/0'. Video is from the
16 BMC's '/dev/video' device."
17 ON
18)
19option (
20 BMCWEB_ENABLE_VM_WEBSOCKET
21 "Enable the Virtual Media WebSocket. Path is '/vm/0/0'to open the websocket.
22 See https://github.com/openbmc/jsnbd/blob/master/README."
23 ON
24)
25option (
26 BMCWEB_ENABLE_DBUS_REST
27 "Enable Phosphor REST (D-Bus) APIs. Paths directly map Phosphor D-Bus
28 object paths, for example, '/xyz/openbmc_project/logging/entry/enumerate'.
29 See https://github.com/openbmc/docs/blob/master/rest-api.md."
30 ON
31)
32option (
33 BMCWEB_ENABLE_REDFISH
34 "Enable Redfish APIs. Paths are under '/redfish/v1/'. See
35 https://github.com/openbmc/bmcweb/blob/master/DEVELOPING.md#redfish."
36 ON
37)
38option (
39 BMCWEB_ENABLE_HOST_SERIAL_WEBSOCKET
40 "Enable host serial console WebSocket. Path is '/console0'. See
41 https://github.com/openbmc/docs/blob/master/console.md."
42 ON
43)
44option (
45 BMCWEB_ENABLE_STATIC_HOSTING
46 "Enable serving files from the '/usr/share/www' directory as paths under
47 '/'."
48 ON
49)
50option (
51 BMCWEB_ENABLE_REDFISH_BMC_JOURNAL
52 "Enable BMC journal access through Redfish. Paths are under
53 '/redfish/v1/Managers/bmc/LogServices/Journal'."
54 OFF
55)
56option (
57 BMCWEB_ENABLE_REDFISH_RAW_PECI
58 "Enable PECI transactions through Redfish. Paths are under
59 '/redfish/v1/Systems/system/LogServices/CpuLog/Actions/Oem/CpuLog.SendRawPeci'."
60 OFF
61)
62option (
63 BMCWEB_ENABLE_REDFISH_CPU_LOG
64 "Enable CPU log service transactions through Redfish. Paths are under
65 '/redfish/v1/Systems/system/LogServices/Crashdump'."
66 OFF
67)
68option (
69 BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES
70 "Enable DBUS log service transactions through Redfish. Paths are under
71 '/redfish/v1/Systems/system/LogServices/EventLog/Entries'."
72 OFF
73)
AppaRao Pulia6349912019-10-18 17:16:08 +053074option (
75 BMCWEB_ENABLE_REDFISH_PROVISIONING_FEATURE
76 "Enable provisioning feature support in redfish. Paths are under
77 '/redfish/v1/Systems/system/'."
78 OFF
79)
Ed Tanous1da66f72018-07-27 16:13:37 -070080
Ed Tanousbdd1c832018-10-12 11:00:30 -070081# Insecure options. Every option that starts with a BMCWEB_INSECURE flag should
Ed Tanous1e439872018-05-18 11:48:52 -070082# not be enabled by default for any platform, unless the author fully
83# comprehends the implications of doing so. In general, enabling these options
84# will cause security problems of varying degrees
James Feist41d1d182019-10-18 13:57:16 -070085option (
86 BMCWEB_INSECURE_DISABLE_CSRF_PREVENTION
87 "Disable CSRF prevention checks. Should be set to OFF for production
88 systems."
89 OFF
90)
Ed Tanousf3d847c2017-06-12 16:01:42 -070091
James Feist41d1d182019-10-18 13:57:16 -070092option (BMCWEB_INSECURE_DISABLE_SSL
93 "Disable SSL ports. Should be set to OFF for production systems." OFF)
Ed Tanous0fdddb12017-02-28 11:06:34 -080094
James Feist41d1d182019-10-18 13:57:16 -070095option (
96 BMCWEB_INSECURE_DISABLE_AUTHENTICATION
97 "Disable authentication on all ports. Should be set to OFF for production
98 systems"
99 OFF
100)
Ed Tanous0fdddb12017-02-28 11:06:34 -0800101
Ed Tanous1e439872018-05-18 11:48:52 -0700102option (BMCWEB_INSECURE_DISABLE_XSS_PREVENTION "Disable XSS preventions" OFF)
Ed Tanous0d485ef2017-05-23 09:23:53 -0700103
James Feist41d1d182019-10-18 13:57:16 -0700104option (
105 BMCWEB_INSECURE_ENABLE_REDFISH_FW_TFTP_UPDATE
106 "Enable TFTP based firmware update transactions through Redfish
107 UpdateService.SimpleUpdate."
108 OFF
109)
Andrew Geissler0554c982019-04-23 14:40:12 -0500110
Ed Tanous1e439872018-05-18 11:48:52 -0700111include (CTest)
112
Ed Tanous62288742018-10-16 14:58:20 -0700113set (CMAKE_CXX_STANDARD 17)
Ed Tanous1e439872018-05-18 11:48:52 -0700114set (CMAKE_CXX_STANDARD_REQUIRED ON)
115
116set (CMAKE_EXPORT_COMPILE_COMMANDS ON)
117
Ed Tanousb01bf292019-03-25 19:25:26 +0000118set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -Wall")
Ed Tanous1e439872018-05-18 11:48:52 -0700119
Ed Tanous271584a2019-07-09 16:24:22 -0700120set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
121 -fno-rtti \
122")
123
James Feist41d1d182019-10-18 13:57:16 -0700124set (
125 CMAKE_CXX_FLAGS
126 "${CMAKE_CXX_FLAGS} \
Ed Tanous271584a2019-07-09 16:24:22 -0700127-Wall \
128-Wextra \
129-Wnon-virtual-dtor \
130-Wold-style-cast \
131-Wcast-align \
132-Wunused \
133-Woverloaded-virtual \
134-Wpedantic \
135-Wconversion \
136-Wsign-conversion \
137-Wnull-dereference \
138-Wdouble-promotion \
139-Wformat=2 \
140-Wno-unused-parameter \
James Feist41d1d182019-10-18 13:57:16 -0700141"
142)
Ed Tanous271584a2019-07-09 16:24:22 -0700143
144# only set -Werror if we're on a compiler that we know passes
145if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
James Feist41d1d182019-10-18 13:57:16 -0700146 if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0)
147 set (
148 CMAKE_CXX_FLAGS
149 "${CMAKE_CXX_FLAGS} \
Ed Tanous271584a2019-07-09 16:24:22 -0700150 -Werror \
151 -Wduplicated-cond \
152 -Wduplicated-branches \
153 -Wlogical-op \
154 -Wnull-dereference \
155 -Wdouble-promotion \
156 -Wformat=2 \
157 -Wno-unused-parameter \
James Feist41d1d182019-10-18 13:57:16 -0700158 "
159 )
160 endif (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0)
Ed Tanous271584a2019-07-09 16:24:22 -0700161endif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
162
Ed Tanous1e439872018-05-18 11:48:52 -0700163set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-rtti")
Ed Tanous3dac7492017-08-02 13:46:20 -0700164
Ed Tanous0fdddb12017-02-28 11:06:34 -0800165# general
Ed Tanous797d0c02018-08-07 10:22:35 -0700166option (BMCWEB_BUILD_UT "Enable Unit test" OFF)
Ed Tanous8041f312017-04-03 09:47:01 -0700167
Ed Tanous1ccd57c2017-03-21 13:15:58 -0700168# security flags
James Feist41d1d182019-10-18 13:57:16 -0700169set (
170 SECURITY_FLAGS
171 "-fstack-protector-strong \
Ed Tanous580f3722018-03-13 16:59:02 -0700172 -fPIE \
173 -fPIC \
174 -D_FORTIFY_SOURCE=2 \
175 -Wformat \
James Feist41d1d182019-10-18 13:57:16 -0700176 -Wformat-security"
Ed Tanousf0d73c22018-07-26 14:24:20 -0700177)
James Feist41d1d182019-10-18 13:57:16 -0700178set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${SECURITY_FLAGS}")
179set (CMAKE_CXX_FLAGS_RELWITHDEBINFO
180 "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${SECURITY_FLAGS}")
Ed Tanous1e439872018-05-18 11:48:52 -0700181set (CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} ${SECURITY_FLAGS}")
Ed Tanous3dac7492017-08-02 13:46:20 -0700182
Ed Tanous580f3722018-03-13 16:59:02 -0700183# Enable link time optimization This is a temporary workaround because
184# INTERPROCEDURAL_OPTIMIZATION isn't available until cmake 3.9. gcc-ar and gcc-
185# ranlib are wrappers around ar and ranlib which add the lto plugin to the
186# command line.
Ed Tanous1e439872018-05-18 11:48:52 -0700187if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
188 if (NOT CMAKE_BUILD_TYPE MATCHES Debug)
189 string (REGEX REPLACE "ar$" "gcc-ar" CMAKE_AR ${CMAKE_AR})
James Feist41d1d182019-10-18 13:57:16 -0700190 string (REGEX
191 REPLACE "ranlib$" "gcc-ranlib" CMAKE_RANLIB ${CMAKE_RANLIB})
Ed Tanous1e439872018-05-18 11:48:52 -0700192 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto -fno-fat-lto-objects")
Borawski.Lukasz109799e2018-01-30 15:04:42 +0100193
Ed Tanous1e439872018-05-18 11:48:52 -0700194 # Reduce the binary size by removing unnecessary dynamic symbol table
195 # entries
James Feist41d1d182019-10-18 13:57:16 -0700196 set (
197 CMAKE_CXX_FLAGS
198 "${CMAKE_CXX_FLAGS} \
Ed Tanous580f3722018-03-13 16:59:02 -0700199 -fvisibility=hidden \
200 -fvisibility-inlines-hidden \
James Feist41d1d182019-10-18 13:57:16 -0700201 -Wl,--exclude-libs,ALL"
202 )
Ed Tanous1e439872018-05-18 11:48:52 -0700203 endif (NOT CMAKE_BUILD_TYPE MATCHES Debug)
204endif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
Borawski.Lukasz109799e2018-01-30 15:04:42 +0100205
Ed Tanous1e439872018-05-18 11:48:52 -0700206if (NOT ${YOCTO_DEPENDENCIES}) # Download and unpack googletest at configure
207 # time
208 configure_file (CMakeLists.txt.in 3rdparty/CMakeLists.txt)
James Feist41d1d182019-10-18 13:57:16 -0700209 execute_process (COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
210 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3rdparty)
211 execute_process (COMMAND ${CMAKE_COMMAND} --build .
212 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3rdparty)
Ed tanous7d95f5f2018-03-23 00:19:20 -0700213
Ed Tanous1e439872018-05-18 11:48:52 -0700214 set (CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}/prefix ${CMAKE_PREFIX_PATH})
215endif ()
Ed tanous7d95f5f2018-03-23 00:19:20 -0700216
Ed Tanous271584a2019-07-09 16:24:22 -0700217find_package (Boost 1.66 REQUIRED)
218include_directories (SYSTEM ${BOOST_SRC_DIR})
219
Ed Tanous580f3722018-03-13 16:59:02 -0700220# add_definitions(-DBOOST_ASIO_ENABLE_HANDLER_TRACKING)
Ed Tanousd3a38062018-07-27 12:06:29 -0700221add_definitions (-DBOOST_ASIO_DISABLE_THREADS)
Ed Tanous39e77502019-03-04 17:35:53 -0800222add_definitions (-DBOOST_BEAST_USE_STD_STRING_VIEW)
Ed Tanous1e439872018-05-18 11:48:52 -0700223add_definitions (-DBOOST_ERROR_CODE_HEADER_ONLY)
224add_definitions (-DBOOST_SYSTEM_NO_DEPRECATED)
James Feist41d1d182019-10-18 13:57:16 -0700225message (BOOST_VERSION = ${Boost_VERSION})
Ed Tanous271584a2019-07-09 16:24:22 -0700226if ("${Boost_VERSION}" STREQUAL "107100")
227 add_definitions (-DBOOST_ASIO_NO_DEPRECATED)
James Feist41d1d182019-10-18 13:57:16 -0700228endif ()
Ed Tanous1e439872018-05-18 11:48:52 -0700229add_definitions (-DBOOST_ALL_NO_LIB)
230add_definitions (-DBOOST_NO_RTTI)
231add_definitions (-DBOOST_NO_TYPEID)
Ed Tanousc85eb8b2018-10-16 14:59:20 -0700232add_definitions (-DBOOST_COROUTINES_NO_DEPRECATION_WARNING)
Ed tanous7d95f5f2018-03-23 00:19:20 -0700233
Ed Tanousaa2e59c2018-04-12 12:17:20 -0700234# sdbusplus
Ed Tanous1e439872018-05-18 11:48:52 -0700235if (NOT ${YOCTO_DEPENDENCIES})
Ed Tanous271584a2019-07-09 16:24:22 -0700236 include_directories (SYSTEM ${CMAKE_BINARY_DIR}/sdbusplus-src)
James Feista975e9f2018-08-08 14:03:49 -0700237 link_directories (${CMAKE_BINARY_DIR}/sdbusplus-src/.libs)
Ed Tanous1e439872018-05-18 11:48:52 -0700238endif ()
Ed Tanous0fdddb12017-02-28 11:06:34 -0800239
Ed Tanous580f3722018-03-13 16:59:02 -0700240# Openssl
Ed Tanous1e439872018-05-18 11:48:52 -0700241find_package (OpenSSL REQUIRED)
Ed Tanous271584a2019-07-09 16:24:22 -0700242include_directories (SYSTEM ${OPENSSL_INCLUDE_DIR})
Ed Tanous1e439872018-05-18 11:48:52 -0700243message ("OPENSSL_INCLUDE_DIR ${OPENSSL_INCLUDE_DIR}")
Ed Tanous0fdddb12017-02-28 11:06:34 -0800244
Ed Tanous55c7b7a2018-05-22 15:27:24 -0700245# bmcweb
Ed Tanous1e439872018-05-18 11:48:52 -0700246message ("CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}")
247if (CMAKE_BUILD_TYPE MATCHES Debug)
248 message ("Logging disabled")
Ed Tanous55c7b7a2018-05-22 15:27:24 -0700249 add_definitions (-DBMCWEB_ENABLE_LOGGING)
250 add_definitions (-DBMCWEB_ENABLE_DEBUG)
Ed Tanous1e439872018-05-18 11:48:52 -0700251endif (CMAKE_BUILD_TYPE MATCHES Debug)
Ed Tanousaa2e59c2018-04-12 12:17:20 -0700252
Andrew Geissler1f2fbf22018-07-17 07:57:30 -0700253if (NOT "${BMCWEB_INSECURE_DISABLE_SSL}")
Ed Tanousa434f2b2018-07-27 13:04:22 -0700254 add_definitions (-DBMCWEB_ENABLE_SSL)
Andrew Geissler1f2fbf22018-07-17 07:57:30 -0700255endif (NOT "${BMCWEB_INSECURE_DISABLE_SSL}")
Ed Tanousc94ad492019-10-10 15:39:33 -0700256include_directories (${CMAKE_CURRENT_SOURCE_DIR}/http)
Ed Tanous0fdddb12017-02-28 11:06:34 -0800257
Ed Tanous580f3722018-03-13 16:59:02 -0700258# Zlib
Ed Tanous1e439872018-05-18 11:48:52 -0700259find_package (ZLIB REQUIRED)
Ed Tanous271584a2019-07-09 16:24:22 -0700260include_directories (SYSTEM ${ZLIB_INCLUDE_DIRS})
Ed Tanousf9273472017-02-28 16:05:13 -0800261
Ed Tanous4758d5b2017-06-06 15:28:13 -0700262# PAM
Ed Tanous1e439872018-05-18 11:48:52 -0700263option (WEBSERVER_ENABLE_PAM "enable pam authentication" ON)
264if ("${WEBSERVER_ENABLE_PAM}")
265 find_package (PAM REQUIRED)
266else ()
267 add_definitions ("-DWEBSERVER_DISABLE_PAM")
268endif ()
Ed Tanous911ac312017-08-15 09:37:42 -0700269
Ed Tanousf0d73c22018-07-26 14:24:20 -0700270add_definitions ("-Wno-attributes")
Jennifer Lee03346702018-05-23 14:05:20 -0700271# Copy pam-webserver to etc/pam.d
James Feist41d1d182019-10-18 13:57:16 -0700272install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/pam-webserver DESTINATION /etc/pam.d/
273 RENAME webserver)
Ed Tanous5f34a9c2017-02-28 12:35:13 -0800274
Ed tanous7d95f5f2018-03-23 00:19:20 -0700275# tinyxml2
Ed Tanous1e439872018-05-18 11:48:52 -0700276find_package (tinyxml2 REQUIRED)
Ed tanous7d95f5f2018-03-23 00:19:20 -0700277
Ed Tanous1e439872018-05-18 11:48:52 -0700278set (WEBSERVER_MAIN src/webserver_main.cpp)
Ed Tanousb4d29f42017-03-24 16:39:25 -0700279
Ed Tanous1e439872018-05-18 11:48:52 -0700280include_directories (${CMAKE_CURRENT_SOURCE_DIR}/include)
281include_directories (${CMAKE_CURRENT_SOURCE_DIR}/redfish-core/include)
Ed Tanousb4d29f42017-03-24 16:39:25 -0700282
Ed Tanous1e439872018-05-18 11:48:52 -0700283file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/include/bmcweb)
Ed Tanous1e439872018-05-18 11:48:52 -0700284include_directories (${CMAKE_BINARY_DIR}/include)
Ed Tanous5f34a9c2017-02-28 12:35:13 -0800285
James Feist41d1d182019-10-18 13:57:16 -0700286set (SRC_FILES redfish-core/src/error_messages.cpp
287 redfish-core/src/utils/json_utils.cpp ${GENERATED_SRC_FILES})
Ed Tanous93f987d2017-04-17 17:52:36 -0700288
Ed Tanous1e439872018-05-18 11:48:52 -0700289file (COPY src/test_resources DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
Ed Tanous911ac312017-08-15 09:37:42 -0700290
Ed Tanous38bdb982017-03-03 14:19:33 -0800291# Unit Tests
Ed Tanous1e439872018-05-18 11:48:52 -0700292if (${BMCWEB_BUILD_UT})
James Feist41d1d182019-10-18 13:57:16 -0700293 set (UT_FILES src/crow_test.cpp src/gtest_main.cpp
294 src/token_authorization_middleware_test.cpp
295 src/security_headers_middleware_test.cpp src/webassets_test.cpp
296 src/crow_getroutes_test.cpp src/ast_jpeg_decoder_test.cpp
297 src/kvm_websocket_test.cpp src/msan_test.cpp
298 src/ast_video_puller_test.cpp src/openbmc_jtag_rest_test.cpp
299 redfish-core/ut/privileges_test.cpp
300 ${CMAKE_BINARY_DIR}/include/bmcweb/blns.hpp) # big list of naughty
301 # strings
302 add_custom_command (OUTPUT ${CMAKE_BINARY_DIR}/include/bmcweb/blns.hpp
303 COMMAND
304 xxd -i
305 ${CMAKE_CURRENT_SOURCE_DIR}/src/test_resources/blns
306 ${CMAKE_BINARY_DIR}/include/bmcweb/blns.hpp)
Ed Tanous1e439872018-05-18 11:48:52 -0700307
James Feist41d1d182019-10-18 13:57:16 -0700308 set_source_files_properties (${CMAKE_BINARY_DIR}/include/bmcweb/blns.hpp
309 PROPERTIES GENERATED TRUE)
Ed Tanous1e439872018-05-18 11:48:52 -0700310 enable_testing ()
311
312 add_executable (webtest ${SRC_FILES} ${UT_FILES})
313
314 find_package (GTest REQUIRED)
315 find_package (GMock REQUIRED)
316 target_link_libraries (webtest ${GTEST_LIBRARIES})
317 target_link_libraries (webtest ${GMOCK_LIBRARIES})
318
319 target_link_libraries (webtest pthread)
320 target_link_libraries (webtest ${OPENSSL_LIBRARIES})
321 target_link_libraries (webtest ${ZLIB_LIBRARIES})
322 target_link_libraries (webtest pam)
323 target_link_libraries (webtest tinyxml2)
Ed Tanousd425c6f2018-05-16 10:20:11 -0700324 target_link_libraries (webtest sdbusplus)
Ed Tanouse0625902018-05-16 13:35:08 -0700325 target_link_libraries (webtest -lsystemd)
Ed Tanous1e439872018-05-18 11:48:52 -0700326 target_link_libraries (webtest -lstdc++fs)
327 add_test (webtest webtest "--gtest_output=xml:webtest.xml")
328
329endif (${BMCWEB_BUILD_UT})
330
331install (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/static/ DESTINATION share/www)
332
333# bmcweb
334add_executable (bmcweb ${WEBSERVER_MAIN} ${HDR_FILES} ${SRC_FILES})
Ed Tanous1e439872018-05-18 11:48:52 -0700335target_link_libraries (bmcweb ${OPENSSL_LIBRARIES})
336target_link_libraries (bmcweb ${ZLIB_LIBRARIES})
337target_link_libraries (bmcweb pam)
Brad Bishop79ba46f2018-11-29 10:57:31 -0500338target_link_libraries (bmcweb -latomic)
Ed Tanous1e439872018-05-18 11:48:52 -0700339target_link_libraries (bmcweb -lsystemd)
340target_link_libraries (bmcweb -lstdc++fs)
Ed Tanousd425c6f2018-05-16 10:20:11 -0700341target_link_libraries (bmcweb sdbusplus)
Ed Tanous1e439872018-05-18 11:48:52 -0700342target_link_libraries (bmcweb tinyxml2)
343install (TARGETS bmcweb DESTINATION bin)
344
Jason M. Billsc50fc5a2018-11-14 14:49:59 -0800345target_compile_definitions (
James Feist41d1d182019-10-18 13:57:16 -0700346 bmcweb PRIVATE $<$<BOOL:${BMCWEB_ENABLE_KVM}>: -DBMCWEB_ENABLE_KVM>
Adriana Kobylak1bfbe0e2019-01-17 12:08:38 -0600347 $<$<BOOL:${BMCWEB_ENABLE_VM_WEBSOCKET}>: -DBMCWEB_ENABLE_VM_WEBSOCKET>
Jason M. Billsc50fc5a2018-11-14 14:49:59 -0800348 $<$<BOOL:${BMCWEB_ENABLE_DBUS_REST}>: -DBMCWEB_ENABLE_DBUS_REST>
349 $<$<BOOL:${BMCWEB_ENABLE_REDFISH}>: -DBMCWEB_ENABLE_REDFISH>
350 $<$<BOOL:${BMCWEB_ENABLE_STATIC_HOSTING}>: -DBMCWEB_ENABLE_STATIC_HOSTING>
James Feist41d1d182019-10-18 13:57:16 -0700351 $<$<BOOL:${BMCWEB_ENABLE_HOST_SERIAL_WEBSOCKET}>:
352 -DBMCWEB_ENABLE_HOST_SERIAL_WEBSOCKET>
353 $<$<BOOL:${BMCWEB_INSECURE_DISABLE_CSRF_PREVENTION}>:
354 -DBMCWEB_INSECURE_DISABLE_CSRF_PREVENTION>
Jason M. Billsc50fc5a2018-11-14 14:49:59 -0800355 $<$<BOOL:${BMCWEB_INSECURE_DISABLE_SSL}>: -DBMCWEB_INSECURE_DISABLE_SSL>
James Feist41d1d182019-10-18 13:57:16 -0700356 $<$<BOOL:${BMCWEB_INSECURE_DISABLE_XSS_PREVENTION}>:
357 -DBMCWEB_INSECURE_DISABLE_XSS_PREVENTION>
358 $<$<BOOL:${BMCWEB_ENABLE_REDFISH_RAW_PECI}>:
359 -DBMCWEB_ENABLE_REDFISH_RAW_PECI>
360 $<$<BOOL:${BMCWEB_ENABLE_REDFISH_CPU_LOG}>:
361 -DBMCWEB_ENABLE_REDFISH_CPU_LOG>
362 $<$<BOOL:${BMCWEB_ENABLE_REDFISH_BMC_JOURNAL}>:
363 -DBMCWEB_ENABLE_REDFISH_BMC_JOURNAL>
364 $<$<BOOL:${BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES}>:
365 -DBMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES>
366 $<$<BOOL:${BMCWEB_INSECURE_ENABLE_REDFISH_FW_TFTP_UPDATE}>:
367 -DBMCWEB_INSECURE_ENABLE_REDFISH_FW_TFTP_UPDATE>
AppaRao Pulia6349912019-10-18 17:16:08 +0530368 $<$<BOOL:${BMCWEB_ENABLE_REDFISH_PROVISIONING_FEATURE}>:
369 -DBMCWEB_ENABLE_REDFISH_PROVISIONING_FEATURE>
Brad Bishopf5e906b2018-11-29 10:55:10 -0500370)
Brad Bishop5a7094b2019-04-10 19:33:15 -0400371
372# configure and install systemd unit files
373configure_file (bmcweb.socket bmcweb.socket COPYONLY)
374configure_file (bmcweb.service.in bmcweb.service)
375pkg_get_variable (SYSTEMD_SYSTEMUNITDIR systemd systemdsystemunitdir)
James Feist41d1d182019-10-18 13:57:16 -0700376install (FILES ${PROJECT_BINARY_DIR}/bmcweb.socket DESTINATION
377 ${SYSTEMD_SYSTEMUNITDIR})
378install (FILES ${PROJECT_BINARY_DIR}/bmcweb.service DESTINATION
379 ${SYSTEMD_SYSTEMUNITDIR})