cmake: compiler flag handling improvements.

- Update compiler flags to match existing build system.
- Cache flag test results (passes and failures) to speed up
  regeneration of build files and avoid building infinite length
  command lines.
- Update the flag check functions to append new flags to
  allow for turning things off when needed.

Change-Id: I8bbfde87753a9bc8e166d3114bb56c73810a2fb6
1 file changed