Adjust default compiler and linker flags when using cmake. With emscripten, -O2 is ignored when compiling .bc files, so pass it to linker instead.
Merge pull request #782 from juj/suppress_Ox_warning

Adjust default compiler and linker flags when using cmake.