bmcweb: cmake: add advanced logs build option

Add cmake option to enable output of extended debug logs, separate from
DEBUG build.

Time to time when testing `bmcweb` it is required to output logs with
extended debug information.
Cmake currently allows this option to be enabled with build of the debug
symbols.
Sometimes this behavior will be overhad and this is unwanted to be extra
size of `bmcweb` binary (and disabling the code optimization).

With add of the `BMCWEB_ENABLE_LOGGING` option, the bmcweb allows to
separate the extended logging from the debug build type.

End-user-impact: None

Change-Id: I0d42c8373aa6f343117b68390172dce2f0db64a0
Signed-off-by: Igor Kononenko <i.kononenko@yadro.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f0536ca..caecd04 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -90,6 +90,11 @@
     OFF
 )
 option (
+    BMCWEB_ENABLE_LOGGING
+    "Enable output the extended debug logs"
+    OFF
+)
+option (
     BMCWEB_ENABLE_MUTUAL_TLS_AUTHENTICATION
     "Enables authenticating users through TLS client certificates.
     The BMCWEB_INSECURE_DISABLE_SSL must be OFF for this option to take effect."
@@ -332,9 +337,7 @@
 # bmcweb
 message ("CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}")
 if (CMAKE_BUILD_TYPE MATCHES Debug)
-    message ("Logging enabled")
-    add_definitions (-DBMCWEB_ENABLE_LOGGING)
-    add_definitions (-DBMCWEB_ENABLE_DEBUG)
+    set(BMCWEB_ENABLE_LOGGING ON)
 endif (CMAKE_BUILD_TYPE MATCHES Debug)
 
 if (NOT "${BMCWEB_INSECURE_DISABLE_SSL}")
@@ -342,6 +345,13 @@
 endif (NOT "${BMCWEB_INSECURE_DISABLE_SSL}")
 include_directories (${CMAKE_CURRENT_SOURCE_DIR}/http)
 
+# Build with the extended debug logs output
+if (${BMCWEB_ENABLE_LOGGING})
+    message ("Logging enabled")
+    add_definitions (-DBMCWEB_ENABLE_DEBUG)
+    add_definitions (-DBMCWEB_ENABLE_LOGGING)
+endif(${BMCWEB_ENABLE_LOGGING})
+
 # Zlib
 find_package (ZLIB REQUIRED)
 include_directories (SYSTEM ${ZLIB_INCLUDE_DIRS})