Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 1 | cmake_minimum_required (VERSION 3.5 FATAL_ERROR) |
Ed Tanous | 0fdddb1 | 2017-02-28 11:06:34 -0800 | [diff] [blame] | 2 | |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 3 | cmake_policy (SET CMP0054 NEW) |
Ed Tanous | cfbe25d | 2017-05-23 16:34:35 -0700 | [diff] [blame] | 4 | |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 5 | set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) |
Ed Tanous | 0fdddb1 | 2017-02-28 11:06:34 -0800 | [diff] [blame] | 6 | |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 7 | option (BUILD_STATIC_LIBS "Built static libraries" ON) |
Ed Tanous | 911ac31 | 2017-08-15 09:37:42 -0700 | [diff] [blame] | 8 | |
Joseph Reynolds | 7a777f5 | 2018-11-07 22:01:31 -0600 | [diff] [blame] | 9 | option (YOCTO_DEPENDENCIES "Use YOCTO dependencies system" OFF) |
Ed Tanous | 0fdddb1 | 2017-02-28 11:06:34 -0800 | [diff] [blame] | 10 | |
Joseph Reynolds | 7a777f5 | 2018-11-07 22:01:31 -0600 | [diff] [blame] | 11 | option (BMCWEB_ENABLE_KVM "Enable the KVM host video WebSocket. Path is |
Ed Tanous | 3eb2f35 | 2018-12-20 12:30:45 -0800 | [diff] [blame] | 12 | '/kvm/0'. Video is from the BMC's '/dev/video' device." ON) |
Joseph Reynolds | 7a777f5 | 2018-11-07 22:01:31 -0600 | [diff] [blame] | 13 | option (BMCWEB_ENABLE_DBUS_REST "Enable Phosphor REST (D-Bus) APIs. Paths |
| 14 | directly map Phosphor D-Bus object paths, for example, |
| 15 | '/xyz/openbmc_project/logging/entry/enumerate'. See |
| 16 | https://github.com/openbmc/docs/blob/master/rest-api.md." ON) |
| 17 | option (BMCWEB_ENABLE_REDFISH "Enable Redfish APIs. Paths are under |
| 18 | '/redfish/v1/'. See |
| 19 | https://github.com/openbmc/bmcweb/blob/master/DEVELOPING.md#redfish." |
| 20 | ON) |
| 21 | option (BMCWEB_ENABLE_HOST_SERIAL_WEBSOCKET "Enable host serial console |
| 22 | WebSocket. Path is '/console0'. See |
| 23 | https://github.com/openbmc/docs/blob/master/console.md." ON) |
| 24 | option (BMCWEB_ENABLE_STATIC_HOSTING "Enable serving files from the |
| 25 | '/usr/share/www' directory as paths under '/'." ON) |
| 26 | option (BMCWEB_ENABLE_REDFISH_BMC_JOURNAL "Enable BMC journal access through |
| 27 | Redfish. Paths are under |
| 28 | '/redfish/v1/Managers/bmc/LogServices/Journal'." OFF) |
| 29 | option (BMCWEB_ENABLE_REDFISH_RAW_PECI "Enable PECI transactions through |
Jason M. Bills | d53dd41 | 2019-02-12 17:16:22 -0800 | [diff] [blame] | 30 | Redfish. Paths are under '/redfish/v1/Systems/system/LogServices/CpuLog/ |
Joseph Reynolds | 7a777f5 | 2018-11-07 22:01:31 -0600 | [diff] [blame] | 31 | Actions/Oem/CpuLog.SendRawPeci'." OFF) |
| 32 | option (BMCWEB_ENABLE_REDFISH_CPU_LOG "Enable CPU log service transactions |
| 33 | through Redfish. Paths are under |
Jason M. Bills | d53dd41 | 2019-02-12 17:16:22 -0800 | [diff] [blame] | 34 | '/redfish/v1/Systems/system/LogServices/CpuLog'." OFF) |
Gunnar Mills | 603a664 | 2019-01-21 17:03:51 -0600 | [diff] [blame^] | 35 | option (BMCWEB_ENABLE_REDFISH_ONE_CHASSIS "Enable Redfish to assume only one |
| 36 | chassis is present. All sensors will be assumed to be under this |
| 37 | chassis. The chassis path is '/redfish/v1/Chassis/chassis'." OFF) |
Ed Tanous | 1da66f7 | 2018-07-27 16:13:37 -0700 | [diff] [blame] | 38 | |
Ed Tanous | bdd1c83 | 2018-10-12 11:00:30 -0700 | [diff] [blame] | 39 | # Insecure options. Every option that starts with a BMCWEB_INSECURE flag should |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 40 | # not be enabled by default for any platform, unless the author fully |
| 41 | # comprehends the implications of doing so. In general, enabling these options |
| 42 | # will cause security problems of varying degrees |
Ed Tanous | f0d73c2 | 2018-07-26 14:24:20 -0700 | [diff] [blame] | 43 | option (BMCWEB_INSECURE_DISABLE_CSRF_PREVENTION "Disable CSRF prevention checks. |
| 44 | Should be set to OFF for production systems." OFF) |
Ed Tanous | f3d847c | 2017-06-12 16:01:42 -0700 | [diff] [blame] | 45 | |
Ed Tanous | f0d73c2 | 2018-07-26 14:24:20 -0700 | [diff] [blame] | 46 | option (BMCWEB_INSECURE_DISABLE_SSL "Disable SSL ports. Should be set to OFF for |
| 47 | production systems." OFF) |
Ed Tanous | 0fdddb1 | 2017-02-28 11:06:34 -0800 | [diff] [blame] | 48 | |
Ed Tanous | f0d73c2 | 2018-07-26 14:24:20 -0700 | [diff] [blame] | 49 | option (BMCWEB_INSECURE_DISABLE_AUTHENTICATION "Disable authentication on all |
| 50 | ports. Should be set to OFF for production systems" OFF) |
Ed Tanous | 0fdddb1 | 2017-02-28 11:06:34 -0800 | [diff] [blame] | 51 | |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 52 | option (BMCWEB_INSECURE_DISABLE_XSS_PREVENTION "Disable XSS preventions" OFF) |
Ed Tanous | 0d485ef | 2017-05-23 09:23:53 -0700 | [diff] [blame] | 53 | |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 54 | project (bmc-webserver CXX) |
| 55 | |
| 56 | include (CTest) |
| 57 | |
Ed Tanous | 6228874 | 2018-10-16 14:58:20 -0700 | [diff] [blame] | 58 | set (CMAKE_CXX_STANDARD 17) |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 59 | set (CMAKE_CXX_STANDARD_REQUIRED ON) |
| 60 | |
| 61 | set (CMAKE_EXPORT_COMPILE_COMMANDS ON) |
| 62 | |
| 63 | set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -Wall") |
| 64 | |
| 65 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") |
| 66 | set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-rtti") |
Ed Tanous | 3dac749 | 2017-08-02 13:46:20 -0700 | [diff] [blame] | 67 | |
Ed Tanous | 0fdddb1 | 2017-02-28 11:06:34 -0800 | [diff] [blame] | 68 | # general |
Ed Tanous | 797d0c0 | 2018-08-07 10:22:35 -0700 | [diff] [blame] | 69 | option (BMCWEB_BUILD_UT "Enable Unit test" OFF) |
Ed Tanous | 8041f31 | 2017-04-03 09:47:01 -0700 | [diff] [blame] | 70 | |
Ed Tanous | 1ccd57c | 2017-03-21 13:15:58 -0700 | [diff] [blame] | 71 | # security flags |
Ed Tanous | f0d73c2 | 2018-07-26 14:24:20 -0700 | [diff] [blame] | 72 | set (SECURITY_FLAGS "\ |
Ed Tanous | 580f372 | 2018-03-13 16:59:02 -0700 | [diff] [blame] | 73 | -fstack-protector-strong \ |
| 74 | -fPIE \ |
| 75 | -fPIC \ |
| 76 | -D_FORTIFY_SOURCE=2 \ |
| 77 | -Wformat \ |
Ed Tanous | f0d73c2 | 2018-07-26 14:24:20 -0700 | [diff] [blame] | 78 | -Wformat-security") |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 79 | set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${SECURITY_FLAGS}") |
Ed Tanous | f0d73c2 | 2018-07-26 14:24:20 -0700 | [diff] [blame] | 80 | set ( |
| 81 | CMAKE_CXX_FLAGS_RELWITHDEBINFO |
| 82 | "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${SECURITY_FLAGS}" |
| 83 | ) |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 84 | set (CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} ${SECURITY_FLAGS}") |
Ed Tanous | 3dac749 | 2017-08-02 13:46:20 -0700 | [diff] [blame] | 85 | |
Ed Tanous | 580f372 | 2018-03-13 16:59:02 -0700 | [diff] [blame] | 86 | # Enable link time optimization This is a temporary workaround because |
| 87 | # INTERPROCEDURAL_OPTIMIZATION isn't available until cmake 3.9. gcc-ar and gcc- |
| 88 | # ranlib are wrappers around ar and ranlib which add the lto plugin to the |
| 89 | # command line. |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 90 | if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") |
| 91 | if (NOT CMAKE_BUILD_TYPE MATCHES Debug) |
| 92 | string (REGEX REPLACE "ar$" "gcc-ar" CMAKE_AR ${CMAKE_AR}) |
Ed Tanous | f0d73c2 | 2018-07-26 14:24:20 -0700 | [diff] [blame] | 93 | string ( |
| 94 | REGEX |
| 95 | REPLACE "ranlib$" "gcc-ranlib" CMAKE_RANLIB ${CMAKE_RANLIB} |
| 96 | ) |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 97 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto -fno-fat-lto-objects") |
Borawski.Lukasz | 109799e | 2018-01-30 15:04:42 +0100 | [diff] [blame] | 98 | |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 99 | # Reduce the binary size by removing unnecessary dynamic symbol table |
| 100 | # entries |
Ed Tanous | f0d73c2 | 2018-07-26 14:24:20 -0700 | [diff] [blame] | 101 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \ |
Ed Tanous | 580f372 | 2018-03-13 16:59:02 -0700 | [diff] [blame] | 102 | -fvisibility=hidden \ |
| 103 | -fvisibility-inlines-hidden \ |
Ed Tanous | f0d73c2 | 2018-07-26 14:24:20 -0700 | [diff] [blame] | 104 | -Wl,--exclude-libs,ALL") |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 105 | endif (NOT CMAKE_BUILD_TYPE MATCHES Debug) |
| 106 | endif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") |
Borawski.Lukasz | 109799e | 2018-01-30 15:04:42 +0100 | [diff] [blame] | 107 | |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 108 | if (NOT ${YOCTO_DEPENDENCIES}) # Download and unpack googletest at configure |
| 109 | # time |
| 110 | configure_file (CMakeLists.txt.in 3rdparty/CMakeLists.txt) |
Ed Tanous | f0d73c2 | 2018-07-26 14:24:20 -0700 | [diff] [blame] | 111 | execute_process ( |
| 112 | COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . |
| 113 | WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3rdparty |
| 114 | ) |
| 115 | execute_process ( |
| 116 | COMMAND ${CMAKE_COMMAND} --build . |
| 117 | WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3rdparty |
| 118 | ) |
Ed tanous | 7d95f5f | 2018-03-23 00:19:20 -0700 | [diff] [blame] | 119 | |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 120 | set (CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}/prefix ${CMAKE_PREFIX_PATH}) |
| 121 | endif () |
Ed tanous | 7d95f5f | 2018-03-23 00:19:20 -0700 | [diff] [blame] | 122 | |
Ed Tanous | 580f372 | 2018-03-13 16:59:02 -0700 | [diff] [blame] | 123 | # add_definitions(-DBOOST_ASIO_ENABLE_HANDLER_TRACKING) |
Ed Tanous | d3a3806 | 2018-07-27 12:06:29 -0700 | [diff] [blame] | 124 | add_definitions (-DBOOST_ASIO_DISABLE_THREADS) |
Ed Tanous | 39e7750 | 2019-03-04 17:35:53 -0800 | [diff] [blame] | 125 | add_definitions (-DBOOST_BEAST_USE_STD_STRING_VIEW) |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 126 | add_definitions (-DBOOST_ERROR_CODE_HEADER_ONLY) |
| 127 | add_definitions (-DBOOST_SYSTEM_NO_DEPRECATED) |
| 128 | add_definitions (-DBOOST_ALL_NO_LIB) |
| 129 | add_definitions (-DBOOST_NO_RTTI) |
| 130 | add_definitions (-DBOOST_NO_TYPEID) |
Ed Tanous | c85eb8b | 2018-10-16 14:59:20 -0700 | [diff] [blame] | 131 | add_definitions (-DBOOST_COROUTINES_NO_DEPRECATION_WARNING) |
Ed tanous | 7d95f5f | 2018-03-23 00:19:20 -0700 | [diff] [blame] | 132 | |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 133 | find_package (Boost 1.66 REQUIRED) |
| 134 | include_directories (${BOOST_SRC_DIR}) |
Ed Tanous | aa2e59c | 2018-04-12 12:17:20 -0700 | [diff] [blame] | 135 | |
| 136 | # sdbusplus |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 137 | if (NOT ${YOCTO_DEPENDENCIES}) |
James Feist | a975e9f | 2018-08-08 14:03:49 -0700 | [diff] [blame] | 138 | include_directories (${CMAKE_BINARY_DIR}/sdbusplus-src) |
| 139 | link_directories (${CMAKE_BINARY_DIR}/sdbusplus-src/.libs) |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 140 | endif () |
Ed Tanous | 0fdddb1 | 2017-02-28 11:06:34 -0800 | [diff] [blame] | 141 | |
Ed Tanous | 580f372 | 2018-03-13 16:59:02 -0700 | [diff] [blame] | 142 | # Openssl |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 143 | find_package (OpenSSL REQUIRED) |
| 144 | include_directories (${OPENSSL_INCLUDE_DIR}) |
| 145 | message ("OPENSSL_INCLUDE_DIR ${OPENSSL_INCLUDE_DIR}") |
Ed Tanous | 0fdddb1 | 2017-02-28 11:06:34 -0800 | [diff] [blame] | 146 | |
Ed Tanous | 55c7b7a | 2018-05-22 15:27:24 -0700 | [diff] [blame] | 147 | # bmcweb |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 148 | message ("CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}") |
| 149 | if (CMAKE_BUILD_TYPE MATCHES Debug) |
| 150 | message ("Logging disabled") |
Ed Tanous | 55c7b7a | 2018-05-22 15:27:24 -0700 | [diff] [blame] | 151 | add_definitions (-DBMCWEB_ENABLE_LOGGING) |
| 152 | add_definitions (-DBMCWEB_ENABLE_DEBUG) |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 153 | endif (CMAKE_BUILD_TYPE MATCHES Debug) |
Ed Tanous | aa2e59c | 2018-04-12 12:17:20 -0700 | [diff] [blame] | 154 | |
Andrew Geissler | 1f2fbf2 | 2018-07-17 07:57:30 -0700 | [diff] [blame] | 155 | if (NOT "${BMCWEB_INSECURE_DISABLE_SSL}") |
Ed Tanous | a434f2b | 2018-07-27 13:04:22 -0700 | [diff] [blame] | 156 | add_definitions (-DBMCWEB_ENABLE_SSL) |
Andrew Geissler | 1f2fbf2 | 2018-07-17 07:57:30 -0700 | [diff] [blame] | 157 | endif (NOT "${BMCWEB_INSECURE_DISABLE_SSL}") |
Ed Tanous | 55c7b7a | 2018-05-22 15:27:24 -0700 | [diff] [blame] | 158 | include_directories (${CMAKE_CURRENT_SOURCE_DIR}/crow/include) |
Ed Tanous | 0fdddb1 | 2017-02-28 11:06:34 -0800 | [diff] [blame] | 159 | |
Ed Tanous | 580f372 | 2018-03-13 16:59:02 -0700 | [diff] [blame] | 160 | # Zlib |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 161 | find_package (ZLIB REQUIRED) |
| 162 | include_directories (${ZLIB_INCLUDE_DIRS}) |
Ed Tanous | f927347 | 2017-02-28 16:05:13 -0800 | [diff] [blame] | 163 | |
Ed Tanous | 4758d5b | 2017-06-06 15:28:13 -0700 | [diff] [blame] | 164 | # PAM |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 165 | option (WEBSERVER_ENABLE_PAM "enable pam authentication" ON) |
| 166 | if ("${WEBSERVER_ENABLE_PAM}") |
| 167 | find_package (PAM REQUIRED) |
| 168 | else () |
| 169 | add_definitions ("-DWEBSERVER_DISABLE_PAM") |
| 170 | endif () |
Ed Tanous | 911ac31 | 2017-08-15 09:37:42 -0700 | [diff] [blame] | 171 | |
Ed Tanous | f0d73c2 | 2018-07-26 14:24:20 -0700 | [diff] [blame] | 172 | add_definitions ("-Wno-attributes") |
Jennifer Lee | 0334670 | 2018-05-23 14:05:20 -0700 | [diff] [blame] | 173 | # Copy pam-webserver to etc/pam.d |
Ed Tanous | f0d73c2 | 2018-07-26 14:24:20 -0700 | [diff] [blame] | 174 | install ( |
| 175 | FILES ${CMAKE_CURRENT_SOURCE_DIR}/pam-webserver |
| 176 | DESTINATION /etc/pam.d/ |
| 177 | RENAME webserver |
| 178 | ) |
Ed Tanous | 5f34a9c | 2017-02-28 12:35:13 -0800 | [diff] [blame] | 179 | |
Ed tanous | 7d95f5f | 2018-03-23 00:19:20 -0700 | [diff] [blame] | 180 | # tinyxml2 |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 181 | find_package (tinyxml2 REQUIRED) |
Ed tanous | 7d95f5f | 2018-03-23 00:19:20 -0700 | [diff] [blame] | 182 | |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 183 | set (WEBSERVER_MAIN src/webserver_main.cpp) |
Ed Tanous | b4d29f4 | 2017-03-24 16:39:25 -0700 | [diff] [blame] | 184 | |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 185 | include_directories (${CMAKE_CURRENT_SOURCE_DIR}/include) |
| 186 | include_directories (${CMAKE_CURRENT_SOURCE_DIR}/redfish-core/include) |
Ed Tanous | b4d29f4 | 2017-03-24 16:39:25 -0700 | [diff] [blame] | 187 | |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 188 | file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/include/bmcweb) |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 189 | include_directories (${CMAKE_BINARY_DIR}/include) |
Ed Tanous | 5f34a9c | 2017-02-28 12:35:13 -0800 | [diff] [blame] | 190 | |
Ed Tanous | f0d73c2 | 2018-07-26 14:24:20 -0700 | [diff] [blame] | 191 | set ( |
| 192 | SRC_FILES redfish-core/src/error_messages.cpp |
| 193 | redfish-core/src/utils/json_utils.cpp ${GENERATED_SRC_FILES} |
| 194 | ) |
Ed Tanous | 93f987d | 2017-04-17 17:52:36 -0700 | [diff] [blame] | 195 | |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 196 | file (COPY src/test_resources DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) |
Ed Tanous | 911ac31 | 2017-08-15 09:37:42 -0700 | [diff] [blame] | 197 | |
Ed Tanous | 38bdb98 | 2017-03-03 14:19:33 -0800 | [diff] [blame] | 198 | # Unit Tests |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 199 | if (${BMCWEB_BUILD_UT}) |
Ed Tanous | f0d73c2 | 2018-07-26 14:24:20 -0700 | [diff] [blame] | 200 | set ( |
| 201 | UT_FILES src/crow_test.cpp src/gtest_main.cpp |
| 202 | src/token_authorization_middleware_test.cpp |
| 203 | src/security_headers_middleware_test.cpp src/webassets_test.cpp |
| 204 | src/crow_getroutes_test.cpp src/ast_jpeg_decoder_test.cpp |
| 205 | src/kvm_websocket_test.cpp src/msan_test.cpp |
| 206 | src/ast_video_puller_test.cpp src/openbmc_jtag_rest_test.cpp |
| 207 | redfish-core/ut/privileges_test.cpp |
| 208 | ${CMAKE_BINARY_DIR}/include/bmcweb/blns.hpp |
| 209 | ) # big list of naughty strings |
| 210 | add_custom_command ( |
| 211 | OUTPUT ${CMAKE_BINARY_DIR}/include/bmcweb/blns.hpp |
| 212 | COMMAND |
| 213 | xxd -i ${CMAKE_CURRENT_SOURCE_DIR}/src/test_resources/blns |
| 214 | ${CMAKE_BINARY_DIR}/include/bmcweb/blns.hpp |
| 215 | ) |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 216 | |
Ed Tanous | f0d73c2 | 2018-07-26 14:24:20 -0700 | [diff] [blame] | 217 | set_source_files_properties ( |
| 218 | ${CMAKE_BINARY_DIR}/include/bmcweb/blns.hpp PROPERTIES GENERATED TRUE |
| 219 | ) |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 220 | enable_testing () |
| 221 | |
| 222 | add_executable (webtest ${SRC_FILES} ${UT_FILES}) |
| 223 | |
| 224 | find_package (GTest REQUIRED) |
| 225 | find_package (GMock REQUIRED) |
| 226 | target_link_libraries (webtest ${GTEST_LIBRARIES}) |
| 227 | target_link_libraries (webtest ${GMOCK_LIBRARIES}) |
| 228 | |
| 229 | target_link_libraries (webtest pthread) |
| 230 | target_link_libraries (webtest ${OPENSSL_LIBRARIES}) |
| 231 | target_link_libraries (webtest ${ZLIB_LIBRARIES}) |
| 232 | target_link_libraries (webtest pam) |
| 233 | target_link_libraries (webtest tinyxml2) |
Ed Tanous | d425c6f | 2018-05-16 10:20:11 -0700 | [diff] [blame] | 234 | target_link_libraries (webtest sdbusplus) |
Ed Tanous | e062590 | 2018-05-16 13:35:08 -0700 | [diff] [blame] | 235 | target_link_libraries (webtest -lsystemd) |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 236 | target_link_libraries (webtest -lstdc++fs) |
| 237 | add_test (webtest webtest "--gtest_output=xml:webtest.xml") |
| 238 | |
| 239 | endif (${BMCWEB_BUILD_UT}) |
| 240 | |
| 241 | install (DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/static/ DESTINATION share/www) |
| 242 | |
| 243 | # bmcweb |
| 244 | add_executable (bmcweb ${WEBSERVER_MAIN} ${HDR_FILES} ${SRC_FILES}) |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 245 | target_link_libraries (bmcweb ${OPENSSL_LIBRARIES}) |
| 246 | target_link_libraries (bmcweb ${ZLIB_LIBRARIES}) |
| 247 | target_link_libraries (bmcweb pam) |
Brad Bishop | 79ba46f | 2018-11-29 10:57:31 -0500 | [diff] [blame] | 248 | target_link_libraries (bmcweb -latomic) |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 249 | target_link_libraries (bmcweb -lsystemd) |
| 250 | target_link_libraries (bmcweb -lstdc++fs) |
Ed Tanous | d425c6f | 2018-05-16 10:20:11 -0700 | [diff] [blame] | 251 | target_link_libraries (bmcweb sdbusplus) |
Ed Tanous | 1e43987 | 2018-05-18 11:48:52 -0700 | [diff] [blame] | 252 | target_link_libraries (bmcweb tinyxml2) |
| 253 | install (TARGETS bmcweb DESTINATION bin) |
| 254 | |
Jason M. Bills | c50fc5a | 2018-11-14 14:49:59 -0800 | [diff] [blame] | 255 | target_compile_definitions ( |
| 256 | bmcweb PRIVATE |
| 257 | $<$<BOOL:${BMCWEB_ENABLE_KVM}>: -DBMCWEB_ENABLE_KVM> |
| 258 | $<$<BOOL:${BMCWEB_ENABLE_DBUS_REST}>: -DBMCWEB_ENABLE_DBUS_REST> |
| 259 | $<$<BOOL:${BMCWEB_ENABLE_REDFISH}>: -DBMCWEB_ENABLE_REDFISH> |
| 260 | $<$<BOOL:${BMCWEB_ENABLE_STATIC_HOSTING}>: -DBMCWEB_ENABLE_STATIC_HOSTING> |
| 261 | $<$<BOOL:${BMCWEB_ENABLE_HOST_SERIAL_WEBSOCKET}>: -DBMCWEB_ENABLE_HOST_SERIAL_WEBSOCKET> |
| 262 | $<$<BOOL:${BMCWEB_INSECURE_DISABLE_CSRF_PREVENTION}>: -DBMCWEB_INSECURE_DISABLE_CSRF_PREVENTION> |
| 263 | $<$<BOOL:${BMCWEB_INSECURE_DISABLE_SSL}>: -DBMCWEB_INSECURE_DISABLE_SSL> |
| 264 | $<$<BOOL:${BMCWEB_INSECURE_DISABLE_XSS_PREVENTION}>: -DBMCWEB_INSECURE_DISABLE_XSS_PREVENTION> |
| 265 | $<$<BOOL:${BMCWEB_ENABLE_REDFISH_RAW_PECI}>: -DBMCWEB_ENABLE_REDFISH_RAW_PECI> |
| 266 | $<$<BOOL:${BMCWEB_ENABLE_REDFISH_CPU_LOG}>: -DBMCWEB_ENABLE_REDFISH_CPU_LOG> |
Jason M. Bills | c4bf637 | 2018-11-05 13:48:27 -0800 | [diff] [blame] | 267 | $<$<BOOL:${BMCWEB_ENABLE_REDFISH_BMC_JOURNAL}>: -DBMCWEB_ENABLE_REDFISH_BMC_JOURNAL> |
Gunnar Mills | 603a664 | 2019-01-21 17:03:51 -0600 | [diff] [blame^] | 268 | $<$<BOOL:${BMCWEB_ENABLE_REDFISH_ONE_CHASSIS}>: -DBMCWEB_ENABLE_REDFISH_ONE_CHASSIS> |
Brad Bishop | f5e906b | 2018-11-29 10:55:10 -0500 | [diff] [blame] | 269 | ) |