summaryrefslogtreecommitdiffstats
path: root/Source/cmQtAutoGenInitializer.cxx
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-01-31 23:34:58 (GMT)
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-01-31 23:35:53 (GMT)
commit7c664bb5b933e66c390b6edddd2c1de541aad40f (patch)
tree2dd6a41cf740b1cf956dc3f29af145df055657bb /Source/cmQtAutoGenInitializer.cxx
parent371e9e48a4186f41354938b0b805a351857c78a0 (diff)
downloadCMake-7c664bb5b933e66c390b6edddd2c1de541aad40f.zip
CMake-7c664bb5b933e66c390b6edddd2c1de541aad40f.tar.gz
CMake-7c664bb5b933e66c390b6edddd2c1de541aad40f.tar.bz2
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
Diffstat (limited to 'Source/cmQtAutoGenInitializer.cxx')
-rw-r--r--Source/cmQtAutoGenInitializer.cxx9
1 files changed, 8 insertions, 1 deletions
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 0493c0f..43e159c 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -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 }));