[CMake] Properly test if compiler supports compiler flags