Build: Fix configurations of build log quietly

Change-Id: Ieb765d457250da66f5c5144b0bf1cbbad4dc32b7
Signed-off-by: Kevin Peng <kevin.peng@arm.com>
diff --git a/config/config_default.cmake b/config/config_default.cmake
index 4c0e80e..ed32775 100755
--- a/config/config_default.cmake
+++ b/config/config_default.cmake
@@ -6,8 +6,6 @@
 #-------------------------------------------------------------------------------
 
 set(TFM_TOOLCHAIN_FILE                  ${CMAKE_SOURCE_DIR}/toolchain_GNUARM.cmake CACHE FILEPATH    "Path to TFM compiler toolchain file")
-set(TFM_MEMORY_USAGE_QUIET              OFF         CACHE BOOL      "Disable the memory usage report")
-set(TFM_BUILD_LOG_VERBOSE               ON          CACHE BOOL      "Enable much of the printing during the build")
 set(TFM_PLATFORM                        ""          CACHE STRING    "Platform to build TF-M for. Must be either a relative path from [TF-M]/platform/ext/target, or an absolute path.")
 set(CROSS_COMPILE                       arm-none-eabi CACHE STRING  "Cross-compilation triplet")
 
@@ -94,7 +92,6 @@
 set(BL2_TRAILER_SIZE                    0x000       CACHE STRING    "BL2 Trailer size")
 
 ############################ Partitions ########################################
-set(CONFIG_TFM_PARTITION_QUIET          OFF         CACHE BOOL      "Disable printing of partition configuration during build")
 set(TFM_PARTITION_PROTECTED_STORAGE     ON          CACHE BOOL      "Enable Protected Storage partition")
 set(PS_CREATE_FLASH_LAYOUT              ON          CACHE BOOL      "Create flash FS if it doesn't exist for Protected Storage partition")
 set(PS_ENCRYPTION                       ON          CACHE BOOL      "Enable encryption for Protected Storage partition")
diff --git a/config/set_config.cmake b/config/set_config.cmake
index da37fe4..19f291b 100644
--- a/config/set_config.cmake
+++ b/config/set_config.cmake
@@ -1,5 +1,5 @@
 #-------------------------------------------------------------------------------
-# Copyright (c) 2020-2021, Arm Limited. All rights reserved.
+# Copyright (c) 2020-2022, Arm Limited. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -14,15 +14,6 @@
     include(${TFM_EXTRA_CONFIG_PATH})
 endif()
 
-# We usually don't need these messages, and they make it difficult to scan the
-# build log for error and warning messages, so we disable theme here.
-if(NOT TFM_BUILD_LOG_VERBOSE)
-    set(CMAKE_INSTALL_MESSAGE NEVER)
-    set(PARSE_MANIFEST_QUIET ON)
-    set(PARTITION_CONFIG_QUIET ON)
-    set(MEMORY_USAGE_QUIET ON)
-endif()
-
 # Load PSA config, setting options not already set
 if (TEST_PSA_API)
     include(config/tests/config_test_psa_api.cmake)
@@ -51,6 +42,8 @@
     include(config/profile/${TFM_PROFILE}.cmake)
 endif()
 
+include(${CMAKE_SOURCE_DIR}/config/tfm_build_log_config.cmake)
+
 # Load TF-M model specific default config
 if (TFM_LIB_MODEL)
     include(config/tfm_library_config_default.cmake)
diff --git a/config/tfm_build_log_config.cmake b/config/tfm_build_log_config.cmake
new file mode 100644
index 0000000..a8e344e
--- /dev/null
+++ b/config/tfm_build_log_config.cmake
@@ -0,0 +1,19 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2022, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+set(CONFIG_TFM_BUILD_LOG_QUIET              OFF     CACHE BOOL      "Disable build logs")
+
+if(CONFIG_TFM_BUILD_LOG_QUIET)
+    set(CMAKE_INSTALL_MESSAGE               NEVER   CACHE BOOL      "Output installation message generated by the install() command[ALWAYS,LAZY,NEVER]")
+    set(CONFIG_TFM_PARTITION_QUIET          ON      CACHE BOOL      "Disable printing of partition configuration during build")
+    set(CONFIG_TFM_MEMORY_USAGE_QUIET       ON      CACHE BOOL      "Disable the memory usage report")
+    set(CONFIG_TFM_PARSE_MANIFEST_QUIET     ON      CACHE BOOL      "Parse manifest quietly")
+else()
+    set(CONFIG_TFM_PARTITION_QUIET          OFF     CACHE BOOL      "Disable printing of partition configuration during build")
+    set(CONFIG_TFM_MEMORY_USAGE_QUIET       OFF     CACHE BOOL      "Disable the memory usage report")
+    set(CONFIG_TFM_PARSE_MANIFEST_QUIET     OFF     CACHE BOOL      "Parse manifest quietly")
+endif()
diff --git a/secure_fw/partitions/crypto/CMakeLists.txt b/secure_fw/partitions/crypto/CMakeLists.txt
index 495f8b5..46a5208 100644
--- a/secure_fw/partitions/crypto/CMakeLists.txt
+++ b/secure_fw/partitions/crypto/CMakeLists.txt
@@ -1,5 +1,5 @@
 #-------------------------------------------------------------------------------
-# Copyright (c) 2020-2021, Arm Limited. All rights reserved.
+# Copyright (c) 2020-2022, Arm Limited. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -79,8 +79,7 @@
 )
 
 ################ Display the configuration being applied #######################
-
-if (NOT TFM_CONFIG_PARTITION_QUIET)
+if (NOT CONFIG_TFM_PARTITION_QUIET)
     message(STATUS "---------- Display crypto configuration - start --------------")
 
     message(STATUS "CRYPTO_RNG_MODULE_DISABLED is set to ${CRYPTO_RNG_MODULE_DISABLED}")
diff --git a/secure_fw/partitions/internal_trusted_storage/CMakeLists.txt b/secure_fw/partitions/internal_trusted_storage/CMakeLists.txt
index 0fe010b..2dac309 100644
--- a/secure_fw/partitions/internal_trusted_storage/CMakeLists.txt
+++ b/secure_fw/partitions/internal_trusted_storage/CMakeLists.txt
@@ -1,5 +1,5 @@
 #-------------------------------------------------------------------------------
-# Copyright (c) 2020-2021, Arm Limited. All rights reserved.
+# Copyright (c) 2020-2022, Arm Limited. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -82,7 +82,7 @@
 
 ################ Display the configuration being applied #######################
 
-if (NOT TFM_CONFIG_PARTITION_QUIET)
+if (NOT CONFIG_TFM_PARTITION_QUIET)
     message(STATUS "----------- Display storage configuration - start ------------")
 
     message(STATUS "PS_CREATE_FLASH_LAYOUT is set to ${PS_CREATE_FLASH_LAYOUT}")
diff --git a/toolchain_ARMCLANG.cmake b/toolchain_ARMCLANG.cmake
index 1c6d62d..8843484 100644
--- a/toolchain_ARMCLANG.cmake
+++ b/toolchain_ARMCLANG.cmake
@@ -52,7 +52,7 @@
     )
 endmacro()
 
-if(TFM_MEMORY_USAGE_QUIET)
+if(CONFIG_TFM_MEMORY_USAGE_QUIET)
     set(MEMORY_USAGE_FLAG "")
 else()
     set(MEMORY_USAGE_FLAG --info=summarysizes,sizes,totals,unused,veneers)
diff --git a/toolchain_GNUARM.cmake b/toolchain_GNUARM.cmake
index f1104e3..8b66c5b 100644
--- a/toolchain_GNUARM.cmake
+++ b/toolchain_GNUARM.cmake
@@ -52,7 +52,7 @@
     )
 endmacro()
 
-if(TFM_MEMORY_USAGE_QUIET)
+if(CONFIG_TFM_MEMORY_USAGE_QUIET)
     set(MEMORY_USAGE_FLAG "")
 else()
     set(MEMORY_USAGE_FLAG LINKER:--print-memory-usage)
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index 970dc90..d1c4a27 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -123,7 +123,7 @@
     SOURCES ${OUTPUT_FILES}
 )
 
-if (PARSE_MANIFEST_QUIET)
+if (CONFIG_TFM_PARSE_MANIFEST_QUIET)
     set(PARSE_MANIFEST_QUIET_FLAG "-q")
 else()
     set(PARSE_MANIFEST_QUIET_FLAG "")