blob: f874d9d5cbf5a4580acd5178e17ee42d6c67f304 [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 (
Iwona Klimaszewskac0a1c8a2019-07-12 18:26:38 +020026 BMCWEB_ENABLE_VM_NBDPROXY
27 "Enable the Virtual Media WebSocket."
28 OFF
29)
30option (
James Feist41d1d182019-10-18 13:57:16 -070031 BMCWEB_ENABLE_DBUS_REST
32 "Enable Phosphor REST (D-Bus) APIs. Paths directly map Phosphor D-Bus
33 object paths, for example, '/xyz/openbmc_project/logging/entry/enumerate'.
34 See https://github.com/openbmc/docs/blob/master/rest-api.md."
35 ON
36)
37option (
38 BMCWEB_ENABLE_REDFISH
39 "Enable Redfish APIs. Paths are under '/redfish/v1/'. See
40 https://github.com/openbmc/bmcweb/blob/master/DEVELOPING.md#redfish."
41 ON
42)
43option (
44 BMCWEB_ENABLE_HOST_SERIAL_WEBSOCKET
45 "Enable host serial console WebSocket. Path is '/console0'. See
46 https://github.com/openbmc/docs/blob/master/console.md."
47 ON
48)
49option (
50 BMCWEB_ENABLE_STATIC_HOSTING
51 "Enable serving files from the '/usr/share/www' directory as paths under
52 '/'."
53 ON
54)
55option (
56 BMCWEB_ENABLE_REDFISH_BMC_JOURNAL
57 "Enable BMC journal access through Redfish. Paths are under
58 '/redfish/v1/Managers/bmc/LogServices/Journal'."
59 OFF
60)
61option (
62 BMCWEB_ENABLE_REDFISH_RAW_PECI
63 "Enable PECI transactions through Redfish. Paths are under
64 '/redfish/v1/Systems/system/LogServices/CpuLog/Actions/Oem/CpuLog.SendRawPeci'."
65 OFF
66)
67option (
68 BMCWEB_ENABLE_REDFISH_CPU_LOG
69 "Enable CPU log service transactions through Redfish. Paths are under
70 '/redfish/v1/Systems/system/LogServices/Crashdump'."
71 OFF
72)
73option (
74 BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES
75 "Enable DBUS log service transactions through Redfish. Paths are under
76 '/redfish/v1/Systems/system/LogServices/EventLog/Entries'."
77 OFF
78)
AppaRao Pulia6349912019-10-18 17:16:08 +053079option (
80 BMCWEB_ENABLE_REDFISH_PROVISIONING_FEATURE
81 "Enable provisioning feature support in redfish. Paths are under
82 '/redfish/v1/Systems/system/'."
83 OFF
84)
Kowalski, Kamil55e43f62019-07-10 13:12:57 +020085option (
86 BMCWEB_ENABLE_MUTUAL_TLS_AUTHENTICATION
87 "Enables authenticating users through TLS client certificates.
88 The BMCWEB_INSECURE_DISABLE_SSL must be OFF for this option to take effect."
Zbigniew Kurzynskicac94c52019-11-07 12:55:04 +010089 ON
Kowalski, Kamil55e43f62019-07-10 13:12:57 +020090)
Ed Tanous1da66f72018-07-27 16:13:37 -070091
Ed Tanousbdd1c832018-10-12 11:00:30 -070092# Insecure options. Every option that starts with a BMCWEB_INSECURE flag should
Ed Tanous1e439872018-05-18 11:48:52 -070093# not be enabled by default for any platform, unless the author fully
94# comprehends the implications of doing so. In general, enabling these options
95# will cause security problems of varying degrees
James Feist41d1d182019-10-18 13:57:16 -070096option (
97 BMCWEB_INSECURE_DISABLE_CSRF_PREVENTION
98 "Disable CSRF prevention checks. Should be set to OFF for production
99 systems."
100 OFF
101)
Ed Tanousf3d847c2017-06-12 16:01:42 -0700102
James Feist41d1d182019-10-18 13:57:16 -0700103option (BMCWEB_INSECURE_DISABLE_SSL
104 "Disable SSL ports. Should be set to OFF for production systems." OFF)
Ed Tanous0fdddb12017-02-28 11:06:34 -0800105
James Feist41d1d182019-10-18 13:57:16 -0700106option (
107 BMCWEB_INSECURE_DISABLE_AUTHENTICATION
108 "Disable authentication on all ports. Should be set to OFF for production
109 systems"
110 OFF
111)
Ed Tanous0fdddb12017-02-28 11:06:34 -0800112
Ed Tanous1e439872018-05-18 11:48:52 -0700113option (BMCWEB_INSECURE_DISABLE_XSS_PREVENTION "Disable XSS preventions" OFF)
Ed Tanous0d485ef2017-05-23 09:23:53 -0700114
James Feist41d1d182019-10-18 13:57:16 -0700115option (
116 BMCWEB_INSECURE_ENABLE_REDFISH_FW_TFTP_UPDATE
117 "Enable TFTP based firmware update transactions through Redfish
118 UpdateService.SimpleUpdate."
119 OFF
120)
Andrew Geissler0554c982019-04-23 14:40:12 -0500121
Adriana Kobylak0e1cf262019-12-05 13:57:57 -0600122set (BMCWEB_HTTP_REQ_BODY_LIMIT_MB "30" CACHE STRING
123 "The max HTTP request body size in MB")
Kowalski, Kamil55e43f62019-07-10 13:12:57 +0200124
Adriana Kobylak0e1cf262019-12-05 13:57:57 -0600125configure_file(config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/include/config.h)
Kowalski, Kamil55e43f62019-07-10 13:12:57 +0200126
127if (BMCWEB_ENABLE_MUTUAL_TLS_AUTHENTICATION AND BMCWEB_INSECURE_DISABLE_SSL)
128 message("SSL Must be enabled to allow SSL authentication")
129 set(BMCWEB_ENABLE_MUTUAL_TLS_AUTHENTICATION OFF)
130endif()
131
132
Ed Tanous1e439872018-05-18 11:48:52 -0700133include (CTest)
134
Ed Tanous62288742018-10-16 14:58:20 -0700135set (CMAKE_CXX_STANDARD 17)
Ed Tanous1e439872018-05-18 11:48:52 -0700136set (CMAKE_CXX_STANDARD_REQUIRED ON)
137
138set (CMAKE_EXPORT_COMPILE_COMMANDS ON)
139
Ed Tanousb01bf292019-03-25 19:25:26 +0000140set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -Wall")
Ed Tanous1e439872018-05-18 11:48:52 -0700141
Ed Tanous271584a2019-07-09 16:24:22 -0700142set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
143 -fno-rtti \
144")
145
James Feist41d1d182019-10-18 13:57:16 -0700146set (
147 CMAKE_CXX_FLAGS
148 "${CMAKE_CXX_FLAGS} \
Ed Tanousa9cbc9c2019-10-24 09:58:39 -0700149 -Wall \
150 -Wextra \
151 -Wnon-virtual-dtor \
152 -Wold-style-cast \
153 -Wcast-align \
154 -Wunused \
155 -Woverloaded-virtual \
156 -Wpedantic \
157 -Wconversion \
158 -Wsign-conversion \
159 -Wnull-dereference \
160 -Wdouble-promotion \
161 -Wformat=2 \
162 -Wno-unused-parameter \
James Feist41d1d182019-10-18 13:57:16 -0700163"
164)
Ed Tanous271584a2019-07-09 16:24:22 -0700165
166# only set -Werror if we're on a compiler that we know passes
167if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
James Feist41d1d182019-10-18 13:57:16 -0700168 if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0)
169 set (
170 CMAKE_CXX_FLAGS
171 "${CMAKE_CXX_FLAGS} \
Ed Tanousa9cbc9c2019-10-24 09:58:39 -0700172 -Werror \
173 -Wduplicated-cond \
174 -Wduplicated-branches \
175 -Wlogical-op \
176 -Wnull-dereference \
177 -Wdouble-promotion \
178 -Wformat=2 \
179 -Wno-unused-parameter \
James Feist41d1d182019-10-18 13:57:16 -0700180 "
181 )
182 endif (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0)
Ed Tanous271584a2019-07-09 16:24:22 -0700183endif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
184
Ed Tanous1e439872018-05-18 11:48:52 -0700185set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-rtti")
Ed Tanous3dac7492017-08-02 13:46:20 -0700186
Ed Tanous0fdddb12017-02-28 11:06:34 -0800187# general
Ed Tanous797d0c02018-08-07 10:22:35 -0700188option (BMCWEB_BUILD_UT "Enable Unit test" OFF)
Ed Tanous8041f312017-04-03 09:47:01 -0700189
Ed Tanous1ccd57c2017-03-21 13:15:58 -0700190# security flags
James Feist41d1d182019-10-18 13:57:16 -0700191set (
192 SECURITY_FLAGS
193 "-fstack-protector-strong \
Ed Tanous580f3722018-03-13 16:59:02 -0700194 -fPIE \
195 -fPIC \
196 -D_FORTIFY_SOURCE=2 \
197 -Wformat \
James Feist41d1d182019-10-18 13:57:16 -0700198 -Wformat-security"
Ed Tanousf0d73c22018-07-26 14:24:20 -0700199)
James Feist41d1d182019-10-18 13:57:16 -0700200set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${SECURITY_FLAGS}")
201set (CMAKE_CXX_FLAGS_RELWITHDEBINFO
202 "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${SECURITY_FLAGS}")
Ed Tanous1e439872018-05-18 11:48:52 -0700203set (CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} ${SECURITY_FLAGS}")
Ed Tanous3dac7492017-08-02 13:46:20 -0700204
Ed Tanous580f3722018-03-13 16:59:02 -0700205# Enable link time optimization This is a temporary workaround because
206# INTERPROCEDURAL_OPTIMIZATION isn't available until cmake 3.9. gcc-ar and gcc-
207# ranlib are wrappers around ar and ranlib which add the lto plugin to the
208# command line.
Ed Tanous1e439872018-05-18 11:48:52 -0700209if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
210 if (NOT CMAKE_BUILD_TYPE MATCHES Debug)
211 string (REGEX REPLACE "ar$" "gcc-ar" CMAKE_AR ${CMAKE_AR})
James Feist41d1d182019-10-18 13:57:16 -0700212 string (REGEX
213 REPLACE "ranlib$" "gcc-ranlib" CMAKE_RANLIB ${CMAKE_RANLIB})
Ed Tanous1e439872018-05-18 11:48:52 -0700214 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto -fno-fat-lto-objects")
Borawski.Lukasz109799e2018-01-30 15:04:42 +0100215
Ed Tanous1e439872018-05-18 11:48:52 -0700216 # Reduce the binary size by removing unnecessary dynamic symbol table
217 # entries
James Feist41d1d182019-10-18 13:57:16 -0700218 set (
219 CMAKE_CXX_FLAGS
220 "${CMAKE_CXX_FLAGS} \
Ed Tanous580f3722018-03-13 16:59:02 -0700221 -fvisibility=hidden \
222 -fvisibility-inlines-hidden \
James Feist41d1d182019-10-18 13:57:16 -0700223 -Wl,--exclude-libs,ALL"
224 )
Ed Tanous1e439872018-05-18 11:48:52 -0700225 endif (NOT CMAKE_BUILD_TYPE MATCHES Debug)
226endif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
Borawski.Lukasz109799e2018-01-30 15:04:42 +0100227
Ed Tanous1e439872018-05-18 11:48:52 -0700228if (NOT ${YOCTO_DEPENDENCIES}) # Download and unpack googletest at configure
229 # time
230 configure_file (CMakeLists.txt.in 3rdparty/CMakeLists.txt)
James Feist41d1d182019-10-18 13:57:16 -0700231 execute_process (COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
232 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3rdparty)
233 execute_process (COMMAND ${CMAKE_COMMAND} --build .
234 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3rdparty)
Ed tanous7d95f5f2018-03-23 00:19:20 -0700235
Ed Tanous1e439872018-05-18 11:48:52 -0700236 set (CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}/prefix ${CMAKE_PREFIX_PATH})
237endif ()
Ed tanous7d95f5f2018-03-23 00:19:20 -0700238
Ed Tanousbd81d6a2019-10-24 10:00:42 -0700239find_package (Boost 1.71 REQUIRED)
Ed Tanous271584a2019-07-09 16:24:22 -0700240include_directories (SYSTEM ${BOOST_SRC_DIR})
241
Ed Tanous580f3722018-03-13 16:59:02 -0700242# add_definitions(-DBOOST_ASIO_ENABLE_HANDLER_TRACKING)
Ed Tanousd3a38062018-07-27 12:06:29 -0700243add_definitions (-DBOOST_ASIO_DISABLE_THREADS)
Ed Tanous39e77502019-03-04 17:35:53 -0800244add_definitions (-DBOOST_BEAST_USE_STD_STRING_VIEW)
Ed Tanous1e439872018-05-18 11:48:52 -0700245add_definitions (-DBOOST_ERROR_CODE_HEADER_ONLY)
246add_definitions (-DBOOST_SYSTEM_NO_DEPRECATED)
James Feist41d1d182019-10-18 13:57:16 -0700247message (BOOST_VERSION = ${Boost_VERSION})
Ed Tanous271584a2019-07-09 16:24:22 -0700248if ("${Boost_VERSION}" STREQUAL "107100")
249 add_definitions (-DBOOST_ASIO_NO_DEPRECATED)
James Feist41d1d182019-10-18 13:57:16 -0700250endif ()
Ed Tanous1e439872018-05-18 11:48:52 -0700251add_definitions (-DBOOST_ALL_NO_LIB)
252add_definitions (-DBOOST_NO_RTTI)
253add_definitions (-DBOOST_NO_TYPEID)
Ed Tanousc85eb8b2018-10-16 14:59:20 -0700254add_definitions (-DBOOST_COROUTINES_NO_DEPRECATION_WARNING)
Ed tanous7d95f5f2018-03-23 00:19:20 -0700255
Ed Tanousaa2e59c2018-04-12 12:17:20 -0700256# sdbusplus
Ed Tanous1e439872018-05-18 11:48:52 -0700257if (NOT ${YOCTO_DEPENDENCIES})
Ed Tanous271584a2019-07-09 16:24:22 -0700258 include_directories (SYSTEM ${CMAKE_BINARY_DIR}/sdbusplus-src)
James Feista975e9f2018-08-08 14:03:49 -0700259 link_directories (${CMAKE_BINARY_DIR}/sdbusplus-src/.libs)
Ed Tanous1e439872018-05-18 11:48:52 -0700260endif ()
Ed Tanous0fdddb12017-02-28 11:06:34 -0800261
Ed Tanous580f3722018-03-13 16:59:02 -0700262# Openssl
Ed Tanous1e439872018-05-18 11:48:52 -0700263find_package (OpenSSL REQUIRED)
Ed Tanous271584a2019-07-09 16:24:22 -0700264include_directories (SYSTEM ${OPENSSL_INCLUDE_DIR})
Ed Tanous1e439872018-05-18 11:48:52 -0700265message ("OPENSSL_INCLUDE_DIR ${OPENSSL_INCLUDE_DIR}")
Ed Tanous0fdddb12017-02-28 11:06:34 -0800266
Ed Tanous55c7b7a2018-05-22 15:27:24 -0700267# bmcweb
Ed Tanous1e439872018-05-18 11:48:52 -0700268message ("CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}")
269if (CMAKE_BUILD_TYPE MATCHES Debug)
270 message ("Logging disabled")
Ed Tanous55c7b7a2018-05-22 15:27:24 -0700271 add_definitions (-DBMCWEB_ENABLE_LOGGING)
272 add_definitions (-DBMCWEB_ENABLE_DEBUG)
Ed Tanous1e439872018-05-18 11:48:52 -0700273endif (CMAKE_BUILD_TYPE MATCHES Debug)
Ed Tanousaa2e59c2018-04-12 12:17:20 -0700274
Andrew Geissler1f2fbf22018-07-17 07:57:30 -0700275if (NOT "${BMCWEB_INSECURE_DISABLE_SSL}")
Ed Tanousa434f2b2018-07-27 13:04:22 -0700276 add_definitions (-DBMCWEB_ENABLE_SSL)
Andrew Geissler1f2fbf22018-07-17 07:57:30 -0700277endif (NOT "${BMCWEB_INSECURE_DISABLE_SSL}")
Ed Tanousc94ad492019-10-10 15:39:33 -0700278include_directories (${CMAKE_CURRENT_SOURCE_DIR}/http)
Ed Tanous0fdddb12017-02-28 11:06:34 -0800279
Ed Tanous580f3722018-03-13 16:59:02 -0700280# Zlib
Ed Tanous1e439872018-05-18 11:48:52 -0700281find_package (ZLIB REQUIRED)
Ed Tanous271584a2019-07-09 16:24:22 -0700282include_directories (SYSTEM ${ZLIB_INCLUDE_DIRS})
Ed Tanousf9273472017-02-28 16:05:13 -0800283
Ed Tanous4758d5b2017-06-06 15:28:13 -0700284# PAM
Ed Tanous1e439872018-05-18 11:48:52 -0700285option (WEBSERVER_ENABLE_PAM "enable pam authentication" ON)
286if ("${WEBSERVER_ENABLE_PAM}")
287 find_package (PAM REQUIRED)
288else ()
289 add_definitions ("-DWEBSERVER_DISABLE_PAM")
290endif ()
Ed Tanous911ac312017-08-15 09:37:42 -0700291
Ed Tanousf0d73c22018-07-26 14:24:20 -0700292add_definitions ("-Wno-attributes")
Jennifer Lee03346702018-05-23 14:05:20 -0700293# Copy pam-webserver to etc/pam.d
James Feist41d1d182019-10-18 13:57:16 -0700294install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/pam-webserver DESTINATION /etc/pam.d/
295 RENAME webserver)
Ed Tanous5f34a9c2017-02-28 12:35:13 -0800296
Ed tanous7d95f5f2018-03-23 00:19:20 -0700297# tinyxml2
Ed Tanous1e439872018-05-18 11:48:52 -0700298find_package (tinyxml2 REQUIRED)
Ed tanous7d95f5f2018-03-23 00:19:20 -0700299
Ed Tanous1e439872018-05-18 11:48:52 -0700300set (WEBSERVER_MAIN src/webserver_main.cpp)
Ed Tanousb4d29f42017-03-24 16:39:25 -0700301
Ed Tanous1e439872018-05-18 11:48:52 -0700302include_directories (${CMAKE_CURRENT_SOURCE_DIR}/include)
303include_directories (${CMAKE_CURRENT_SOURCE_DIR}/redfish-core/include)
Przemyslaw Czarnowskie13c2762019-09-02 17:32:43 +0200304include_directories (${CMAKE_CURRENT_SOURCE_DIR}/redfish-core/lib)
Ed Tanousb4d29f42017-03-24 16:39:25 -0700305
Ed Tanous1e439872018-05-18 11:48:52 -0700306file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/include/bmcweb)
Ed Tanous1e439872018-05-18 11:48:52 -0700307include_directories (${CMAKE_BINARY_DIR}/include)
Ed Tanous5f34a9c2017-02-28 12:35:13 -0800308
James Feist41d1d182019-10-18 13:57:16 -0700309set (SRC_FILES redfish-core/src/error_messages.cpp
310 redfish-core/src/utils/json_utils.cpp ${GENERATED_SRC_FILES})
Ed Tanous93f987d2017-04-17 17:52:36 -0700311
Ed Tanous1e439872018-05-18 11:48:52 -0700312file (COPY src/test_resources DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
Ed Tanous911ac312017-08-15 09:37:42 -0700313
Ed Tanous38bdb982017-03-03 14:19:33 -0800314# Unit Tests
Ed Tanous1e439872018-05-18 11:48:52 -0700315if (${BMCWEB_BUILD_UT})
James Feist41d1d182019-10-18 13:57:16 -0700316 set (UT_FILES src/crow_test.cpp src/gtest_main.cpp
317 src/token_authorization_middleware_test.cpp
318 src/security_headers_middleware_test.cpp src/webassets_test.cpp
319 src/crow_getroutes_test.cpp src/ast_jpeg_decoder_test.cpp
320 src/kvm_websocket_test.cpp src/msan_test.cpp
321 src/ast_video_puller_test.cpp src/openbmc_jtag_rest_test.cpp
322 redfish-core/ut/privileges_test.cpp
323 ${CMAKE_BINARY_DIR}/include/bmcweb/blns.hpp) # big list of naughty
324 # strings
325 add_custom_command (OUTPUT ${CMAKE_BINARY_DIR}/include/bmcweb/blns.hpp
326 COMMAND
327 xxd -i
328 ${CMAKE_CURRENT_SOURCE_DIR}/src/test_resources/blns
329 ${CMAKE_BINARY_DIR}/include/bmcweb/blns.hpp)
Ed Tanous1e439872018-05-18 11:48:52 -0700330
James Feist41d1d182019-10-18 13:57:16 -0700331 set_source_files_properties (${CMAKE_BINARY_DIR}/include/bmcweb/blns.hpp
332 PROPERTIES GENERATED TRUE)
Ed Tanous1e439872018-05-18 11:48:52 -0700333 enable_testing ()
334
335 add_executable (webtest ${SRC_FILES} ${UT_FILES})
336
337 find_package (GTest REQUIRED)
338 find_package (GMock REQUIRED)
339 target_link_libraries (webtest ${GTEST_LIBRARIES})
340 target_link_libraries (webtest ${GMOCK_LIBRARIES})
341
342 target_link_libraries (webtest pthread)
343 target_link_libraries (webtest ${OPENSSL_LIBRARIES})
344 target_link_libraries (webtest ${ZLIB_LIBRARIES})
345 target_link_libraries (webtest pam)
346 target_link_libraries (webtest tinyxml2)
Ed Tanousd425c6f2018-05-16 10:20:11 -0700347 target_link_libraries (webtest sdbusplus)
Ed Tanouse0625902018-05-16 13:35:08 -0700348 target_link_libraries (webtest -lsystemd)
Ed Tanous1e439872018-05-18 11:48:52 -0700349 target_link_libraries (webtest -lstdc++fs)
350 add_test (webtest webtest "--gtest_output=xml:webtest.xml")
351
352endif (${BMCWEB_BUILD_UT})
353
354install (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/static/ DESTINATION share/www)
355
356# bmcweb
357add_executable (bmcweb ${WEBSERVER_MAIN} ${HDR_FILES} ${SRC_FILES})
Ed Tanous1e439872018-05-18 11:48:52 -0700358target_link_libraries (bmcweb ${OPENSSL_LIBRARIES})
359target_link_libraries (bmcweb ${ZLIB_LIBRARIES})
360target_link_libraries (bmcweb pam)
Brad Bishop79ba46f2018-11-29 10:57:31 -0500361target_link_libraries (bmcweb -latomic)
Ed Tanous1e439872018-05-18 11:48:52 -0700362target_link_libraries (bmcweb -lsystemd)
363target_link_libraries (bmcweb -lstdc++fs)
Ed Tanousd425c6f2018-05-16 10:20:11 -0700364target_link_libraries (bmcweb sdbusplus)
Ed Tanous1e439872018-05-18 11:48:52 -0700365target_link_libraries (bmcweb tinyxml2)
366install (TARGETS bmcweb DESTINATION bin)
367
Jason M. Billsc50fc5a2018-11-14 14:49:59 -0800368target_compile_definitions (
James Feist41d1d182019-10-18 13:57:16 -0700369 bmcweb PRIVATE $<$<BOOL:${BMCWEB_ENABLE_KVM}>: -DBMCWEB_ENABLE_KVM>
Kowalski, Kamil55e43f62019-07-10 13:12:57 +0200370 $<$<BOOL:${BMCWEB_ENABLE_MUTUAL_TLS_AUTHENTICATION}>: -DBMCWEB_ENABLE_MUTUAL_TLS_AUTHENTICATION>
Adriana Kobylak1bfbe0e2019-01-17 12:08:38 -0600371 $<$<BOOL:${BMCWEB_ENABLE_VM_WEBSOCKET}>: -DBMCWEB_ENABLE_VM_WEBSOCKET>
Iwona Klimaszewskac0a1c8a2019-07-12 18:26:38 +0200372 $<$<BOOL:${BMCWEB_ENABLE_VM_NBDPROXY}>: -DBMCWEB_ENABLE_VM_NBDPROXY>
Jason M. Billsc50fc5a2018-11-14 14:49:59 -0800373 $<$<BOOL:${BMCWEB_ENABLE_DBUS_REST}>: -DBMCWEB_ENABLE_DBUS_REST>
374 $<$<BOOL:${BMCWEB_ENABLE_REDFISH}>: -DBMCWEB_ENABLE_REDFISH>
375 $<$<BOOL:${BMCWEB_ENABLE_STATIC_HOSTING}>: -DBMCWEB_ENABLE_STATIC_HOSTING>
James Feist41d1d182019-10-18 13:57:16 -0700376 $<$<BOOL:${BMCWEB_ENABLE_HOST_SERIAL_WEBSOCKET}>:
377 -DBMCWEB_ENABLE_HOST_SERIAL_WEBSOCKET>
378 $<$<BOOL:${BMCWEB_INSECURE_DISABLE_CSRF_PREVENTION}>:
379 -DBMCWEB_INSECURE_DISABLE_CSRF_PREVENTION>
Jason M. Billsc50fc5a2018-11-14 14:49:59 -0800380 $<$<BOOL:${BMCWEB_INSECURE_DISABLE_SSL}>: -DBMCWEB_INSECURE_DISABLE_SSL>
James Feist41d1d182019-10-18 13:57:16 -0700381 $<$<BOOL:${BMCWEB_INSECURE_DISABLE_XSS_PREVENTION}>:
382 -DBMCWEB_INSECURE_DISABLE_XSS_PREVENTION>
383 $<$<BOOL:${BMCWEB_ENABLE_REDFISH_RAW_PECI}>:
384 -DBMCWEB_ENABLE_REDFISH_RAW_PECI>
385 $<$<BOOL:${BMCWEB_ENABLE_REDFISH_CPU_LOG}>:
386 -DBMCWEB_ENABLE_REDFISH_CPU_LOG>
387 $<$<BOOL:${BMCWEB_ENABLE_REDFISH_BMC_JOURNAL}>:
388 -DBMCWEB_ENABLE_REDFISH_BMC_JOURNAL>
389 $<$<BOOL:${BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES}>:
390 -DBMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES>
391 $<$<BOOL:${BMCWEB_INSECURE_ENABLE_REDFISH_FW_TFTP_UPDATE}>:
392 -DBMCWEB_INSECURE_ENABLE_REDFISH_FW_TFTP_UPDATE>
AppaRao Pulia6349912019-10-18 17:16:08 +0530393 $<$<BOOL:${BMCWEB_ENABLE_REDFISH_PROVISIONING_FEATURE}>:
394 -DBMCWEB_ENABLE_REDFISH_PROVISIONING_FEATURE>
Brad Bishopf5e906b2018-11-29 10:55:10 -0500395)
Brad Bishop5a7094b2019-04-10 19:33:15 -0400396
397# configure and install systemd unit files
398configure_file (bmcweb.socket bmcweb.socket COPYONLY)
399configure_file (bmcweb.service.in bmcweb.service)
400pkg_get_variable (SYSTEMD_SYSTEMUNITDIR systemd systemdsystemunitdir)
James Feist41d1d182019-10-18 13:57:16 -0700401install (FILES ${PROJECT_BINARY_DIR}/bmcweb.socket DESTINATION
402 ${SYSTEMD_SYSTEMUNITDIR})
403install (FILES ${PROJECT_BINARY_DIR}/bmcweb.service DESTINATION
404 ${SYSTEMD_SYSTEMUNITDIR})