diff options
author | Orkun Tokdemir <ilhanorkuntokdemir@gmail.com> | 2024-01-26 11:17:14 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2024-01-28 14:40:47 (GMT) |
commit | d0bedb217046e4fb79bff2c24b581d97451d0fd4 (patch) | |
tree | f746848de5a6c80f181c9bd59a7c48f9a6a5f82c /Source | |
parent | 4deb9c41b88d53247c7929de660e0cafe8d8d25c (diff) | |
download | CMake-d0bedb217046e4fb79bff2c24b581d97451d0fd4.zip CMake-d0bedb217046e4fb79bff2c24b581d97451d0fd4.tar.gz CMake-d0bedb217046e4fb79bff2c24b581d97451d0fd4.tar.bz2 |
Autogen: Forward dependencies when both Makefile and DEPFILE are used
Since commit ebc9e448b3 (Autogen: Add depfile support for Makefiles,
2023-09-07, v3.28.0-rc1~101^2~1) CMake does not generate the correct
dependency graph when both `Makefile` and `DEPFILE` are used.
The build of `<target_name>_autogen_timestamp_deps` fails due to
missing dependencies. To tackle that problem, forward target
dependencies to both `<target_name>_autogen_timestamp_deps` and
`<target_name>_autogen` instead of just `<target_name>_autogen`.
Fixes: #25600
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmQtAutoGenInitializer.cxx | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index cccc606..66544d0 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -1369,7 +1369,6 @@ bool cmQtAutoGenInitializer::InitAutogenTarget() std::vector<std::string> dependencies( this->AutogenTarget.DependFiles.begin(), this->AutogenTarget.DependFiles.end()); - if (useDepfile) { // Create a custom command that generates a timestamp file and // has a depfile assigned. The depfile is created by JobDepFilesMergeT. @@ -1408,6 +1407,16 @@ bool cmQtAutoGenInitializer::InitAutogenTarget() cc->SetEscapeOldStyle(false); cmTarget* timestampTarget = this->LocalGen->AddUtilityCommand( timestampTargetName, true, std::move(cc)); + auto const isMake = + this->GlobalGen->GetName().find("Make") != std::string::npos; + if (this->AutogenTarget.DependOrigin && isMake) { + for (BT<std::pair<std::string, bool>> const& depName : + this->GenTarget->GetUtilities()) { + timestampTarget->AddUtility(depName.Value.first, false, + this->Makefile); + } + } + this->LocalGen->AddGeneratorTarget( cm::make_unique<cmGeneratorTarget>(timestampTarget, this->LocalGen)); |