Use file(GENERATE) to write the initial cache file so that we can evaluate generator expressions. Use a per-config initial cache file name in case the content varies by configuration.
Use RunCMake "-check.cmake" scripts to check the generated initial cache file content so that the full generation process is completed.