mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 21:59:54 -06:00
AutoMoc: Take AUTOMOC_BUILD_DIR into account in depfile
For the Ninja generator and targets that have AUTOMOC_BUILD_DIR set, the
AutoMoc target was always out of date.
That was because the depfile in the AutoMoc build directory was
referencing the wrong timestamp file:
target_autogen/timestamp: ...dependencies...
instead of
automoc_build_dir/timestamp: ...dependencies...
Use the relative path of the timestamp file as rule name for the
depfile. That path is calculated with AUTOMOC_BUILD_DIR taken into
account.
Fixes: #23547
This commit is contained in:
@@ -407,6 +407,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
|
||||
}
|
||||
|
||||
// Common directories
|
||||
std::string relativeBuildDir;
|
||||
{
|
||||
// Collapsed current binary directory
|
||||
std::string const cbd = cmSystemTools::CollapseFullPath(
|
||||
@@ -424,6 +425,8 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
|
||||
cmStrCat(cbd, '/', this->GenTarget->GetName(), "_autogen");
|
||||
}
|
||||
cmSystemTools::ConvertToUnixSlashes(this->Dir.Build);
|
||||
this->Dir.RelativeBuild =
|
||||
cmSystemTools::RelativePath(cbd, this->Dir.Build);
|
||||
// Cleanup build directory
|
||||
this->AddCleanFile(this->Dir.Build);
|
||||
|
||||
@@ -1357,7 +1360,7 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
|
||||
cmStrCat(this->Dir.Build, "/", timestampFileName);
|
||||
this->AutogenTarget.DepFile = cmStrCat(this->Dir.Build, "/deps");
|
||||
this->AutogenTarget.DepFileRuleName =
|
||||
cmStrCat(this->GenTarget->GetName(), "_autogen/", timestampFileName);
|
||||
cmStrCat(this->Dir.RelativeBuild, "/", timestampFileName);
|
||||
commandLines.push_back(cmMakeCommandLine(
|
||||
{ cmSystemTools::GetCMakeCommand(), "-E", "touch", outputFile }));
|
||||
|
||||
|
||||
@@ -178,6 +178,7 @@ private:
|
||||
{
|
||||
std::string Info;
|
||||
std::string Build;
|
||||
std::string RelativeBuild;
|
||||
std::string Work;
|
||||
ConfigString Include;
|
||||
std::string IncludeGenExp;
|
||||
|
||||
Reference in New Issue
Block a user