build: Adding `-Werror` during compiler flag detection phase

This way all warnings generated during the detection (e.g., `argument
unused` from clang) will not cause problems later.

Change-Id: Id47a29f94316220e979412c862096a620e15a984
Refs: #1539