Merge branch 'backport-ninja-issue-17942' into release-3.11

Merge-request: !2010
This commit is contained in:
Brad King
2018-04-26 08:41:18 -04:00
2 changed files with 9 additions and 1 deletions

View File

@@ -105,8 +105,14 @@ void cmGeneratorExpressionEvaluationFile::CreateOutputFile(
lg, config, false, nullptr, nullptr, nullptr, le);
cmSourceFile* sf = lg->GetMakefile()->GetOrCreateSource(
name, false, cmSourceFileLocationKind::Known);
// Tell TraceDependencies that the file is not expected to exist
// on disk yet. We generate it after that runs.
sf->SetProperty("GENERATED", "1");
// Tell the build system generators that there is no build rule
// to generate the file.
sf->SetProperty("__CMAKE_GENERATED_BY_CMAKE", "1");
gg->SetFilenameTargetDepends(
sf, this->OutputFileExpr->GetSourceSensitiveTargets());
}

View File

@@ -896,7 +896,9 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
// (either attached to this source file or another one), assume that one of
// the target dependencies, OBJECT_DEPENDS or header file custom commands
// will rebuild the file.
if (source->GetPropertyAsBool("GENERATED") && !source->GetCustomCommand() &&
if (source->GetPropertyAsBool("GENERATED") &&
!source->GetPropertyAsBool("__CMAKE_GENERATED_BY_CMAKE") &&
!source->GetCustomCommand() &&
!this->GetGlobalGenerator()->HasCustomCommandOutput(sourceFileName)) {
this->GetGlobalGenerator()->AddAssumedSourceDependencies(sourceFileName,
orderOnlyDeps);