Please put CMakeCache.txt into invalid state when compiler not found

Using the CMake generator with Makefiles on macOS and Linux:

If the compiler is not available and the generator fails, a CMakeCache.txt is written with empty compiler flags.

When I run cmake a second time, with the compilers set, the CMakeCache.txt is not updated with the
appropriate compiler flags, but everything else initializes correctly.

A debug build then proceeds without debugging information, and a release build then proceeds without optimization flags.

Could the CMakeCache.txt file be put in an invalid state for the compiler flags for an unavailable compiler? Alternatively, can the compiler flags for the different build types be populated when a subsequent cmake invocation is able to access the compiler information.

I think this makes sense. Could you please file an issue for this?

Cc: @brad.king