summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-03-14 15:46:43 (GMT)
committerKitware Robot <kwrobot@kitware.com>2024-03-14 15:46:53 (GMT)
commit742af6cff700ec59681969c718341847768b1d5f (patch)
treec938425947c39f3d81a21a0ee51bcf10f3d4d001 /Source
parent8f0801caccd768860768ffd358288cdb75a0654f (diff)
parentd2d1763f884c6cefa3bb9be62ff91f84de38d604 (diff)
downloadCMake-742af6cff700ec59681969c718341847768b1d5f.zip
CMake-742af6cff700ec59681969c718341847768b1d5f.tar.gz
CMake-742af6cff700ec59681969c718341847768b1d5f.tar.bz2
Merge topic 'autogen-makefile-depfile' into release-3.29
d2d1763f88 cmQtAutoGenInitializer: De-duplicate autogen/timestamp target depend logic 6193d15556 Autogen: Restore target-ordering dependencies in Makefiles with DEPFILE Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !9340
Diffstat (limited to 'Source')
-rw-r--r--Source/cmQtAutoGenInitializer.cxx42
1 files changed, 10 insertions, 32 deletions
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 8542206..3d2373d 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -1480,6 +1480,7 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
}
}
+ cmTarget* timestampTarget = nullptr;
std::vector<std::string> dependencies(
this->AutogenTarget.DependFiles.begin(),
this->AutogenTarget.DependFiles.end());
@@ -1500,36 +1501,12 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
const auto timestampTargetName =
cmStrCat(this->GenTarget->GetName(), "_autogen_timestamp_deps");
- // Add additional autogen target dependencies to
- // '_autogen_timestamp_deps'.
- for (const cmTarget* t : this->AutogenTarget.DependTargets) {
- std::string depname = t->GetName();
- if (t->IsImported()) {
- auto const ttype = t->GetType();
- if (ttype == cmStateEnums::TargetType::STATIC_LIBRARY ||
- ttype == cmStateEnums::TargetType::SHARED_LIBRARY ||
- ttype == cmStateEnums::TargetType::UNKNOWN_LIBRARY) {
- depname = cmStrCat("$<TARGET_LINKER_FILE:", t->GetName(), ">");
- }
- }
- dependencies.emplace_back(std::move(depname));
- }
-
auto cc = cm::make_unique<cmCustomCommand>();
cc->SetWorkingDirectory(this->Dir.Work.c_str());
cc->SetDepends(dependencies);
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);
- }
- }
+ timestampTarget = this->LocalGen->AddUtilityCommand(timestampTargetName,
+ true, std::move(cc));
this->LocalGen->AddGeneratorTarget(
cm::make_unique<cmGeneratorTarget>(timestampTarget, this->LocalGen));
@@ -1619,18 +1596,19 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
this->LocalGen->AddGeneratorTarget(
cm::make_unique<cmGeneratorTarget>(autogenTarget, this->LocalGen));
+ // Order the autogen target(s) just before the original target.
+ cmTarget* orderTarget = timestampTarget ? timestampTarget : autogenTarget;
// Forward origin utilities to autogen target
if (this->AutogenTarget.DependOrigin) {
for (BT<std::pair<std::string, bool>> const& depName :
this->GenTarget->GetUtilities()) {
- autogenTarget->AddUtility(depName.Value.first, false, this->Makefile);
+ orderTarget->AddUtility(depName.Value.first, false, this->Makefile);
}
}
- if (!useDepfile) {
- // Add additional autogen target dependencies to autogen target
- for (cmTarget const* depTarget : this->AutogenTarget.DependTargets) {
- autogenTarget->AddUtility(depTarget->GetName(), false, this->Makefile);
- }
+
+ // Add additional autogen target dependencies to autogen target
+ for (cmTarget const* depTarget : this->AutogenTarget.DependTargets) {
+ orderTarget->AddUtility(depTarget->GetName(), false, this->Makefile);
}
// Set FOLDER property in autogen target