Fix AUTOMOC deps file to contain correct rule name

The rule name should include the current binary path relative to
the top level binary path.

Fixes: #20298
This commit is contained in:
Alexandru Croitor
2020-02-01 00:34:58 +01:00
parent 371e9e48a4
commit 7c664bb5b9

View File

@@ -1189,8 +1189,15 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
const std::string outputFile =
cmStrCat(this->Dir.Build, "/", timestampFileName);
this->AutogenTarget.DepFile = cmStrCat(this->Dir.Build, "/deps");
auto relativeBinaryDir = cmSystemTools::RelativePath(
this->LocalGen->GetBinaryDirectory(),
this->LocalGen->GetCurrentBinaryDirectory());
if (!relativeBinaryDir.empty()) {
relativeBinaryDir = cmStrCat(relativeBinaryDir, "/");
}
this->AutogenTarget.DepFileRuleName =
cmStrCat(this->GenTarget->GetName(), "_autogen/", timestampFileName);
cmStrCat(relativeBinaryDir, this->GenTarget->GetName(), "_autogen/",
timestampFileName);
commandLines.push_back(cmMakeCommandLine(
{ cmSystemTools::GetCMakeCommand(), "-E", "touch", outputFile }));