CMake: fixed a failure to reset CMAKE_REQUIRED_FLAGS (thanks, Martin!). This would break Emscripten builds with the CMake project files (etc). Fixes Bugzilla #3197.