This is modeled after the clang and llvm lit tests.
Several properties have CMAKE_CFG_INTDIR as part of the path - this works correctly when the cmake generator only supports one configuration which is known at configuration time, but it does not work correctly when the cmake generator supports multiple configurations (for example, VS).
For VS, CMAKE_CFG_INTDIR ends up set as $Configuration and then it is never updated correctly. Instead, the lit configuration can use a property that can be overwritten at run time. AddLLVM does that for several properties (such as LLVM_TOOLS_DIR).
This change is also removing properties from the lit/CMakeLists.txt that are actually set during the call to configure_lit_site_cfg
I don't think this will work the second time you run cmake (i.e., re-run cmake in an already-initialized build directory) as then this would pick up the cached value from the previous cmake run.
I think a least magic solution would be to have a cmake option to specify whether you are overriding the compiler, defaulting to off (and in that case these cache values would be ignored).