cmake: Add feature tests for warnings
Use vector.clear() rather than static_cast

Suggested by Roger that `static_cast<>(0)` for vectors
is confusing and possibly wrong.
Temporary modifications of fatal-warnings flag

In order to have fatal-warnings propagated to examples
and tests, it needs to come before the add_subdirectory
calls. Also, since we still have deprecated code, it's
necessary to ignore those globally in order to have the
build succeed.