Make treating warnings as errors configurable

Introduce the CMAKE_COMPILE_WARNING_AS_ERROR build option to control
whether the project treats compiler warnings as errors. This option is
enabled by default (On) and can be overridden via the CMake command line
using the -D flag or with an environment variable with the same name.
If both are specified, the command-line option takes precedence over the
environment variable.

Enforcing warnings as errors helps maintain code quality, which is
especially important for security-focused projects. However, this can be
problematic for system integrators using newer compiler versions than
those used in upstream CI, as new compilers may introduce additional
warnings that cause builds to fail.
This option provides a temporary workaround by allowing such builds to
proceed until the warnings are addressed properly.

Change-Id: I20c816887b0f02257f8cf2b198fb98e949b3a7fd
Signed-off-by: Gyorgy Szing <gyorgy.szing@arm.com>
4 files changed