VS,Xcode: Add CMakeLists.txt sources without mutating targets

Rather than injecting `CMakeLists.txt` files into each target's
`SOURCES`, teach the generators to add them during generation using
dedicated code.  This avoids mutating the original targets, and avoids
polluting `$<TARGET_PROPERTY:foo,SOURCES>` with generator-specific
content.

This also avoids listing the `CMakeLists.txt` sources in the results of
`CMAKE_DEBUG_TARGET_PROPERTIES==SOURCES` so the `RunCMake.TargetSources`
test no longer needs a separate case for IDEs.
This commit is contained in:
Brad King
2017-10-18 13:30:09 -04:00
parent 6dec363028
commit 344d149ae4
12 changed files with 93 additions and 124 deletions
@@ -1174,6 +1174,15 @@ void cmVisualStudio10TargetGenerator::WriteCustomCommands()
si != customCommands.end(); ++si) {
this->WriteCustomCommand(*si);
}
// Add CMakeLists.txt file with rule to re-run CMake for user convenience.
if (this->GeneratorTarget->GetType() != cmStateEnums::GLOBAL_TARGET &&
this->GeneratorTarget->GetName() != CMAKE_CHECK_BUILD_SYSTEM_TARGET) {
if (cmSourceFile const* sf =
this->LocalGenerator->CreateVCProjBuildRule()) {
this->WriteCustomCommand(sf);
}
}
}
void cmVisualStudio10TargetGenerator::WriteCustomCommand(