summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOrkun Tokdemir <orkun.tokdemir@qt.io>2023-03-21 18:18:46 +0100
committerBrad King <brad.king@kitware.com>2023-03-24 12:23:47 -0400
commit21f812e57c48166ec5529460182d6f266d0ee55e (patch)
tree6e0bcd2537c7045543615b717d4f62656508f9a7
parentb69441c796827f28742e2b0a4a611c55c7d0ce45 (diff)
downloadcmake-21f812e57c48166ec5529460182d6f266d0ee55e.tar.gz
Autogen: Split creation and setup of custom targets into separate steps
Defer the setup step until after compile features have been finalized on normal targets. Later this will help pass the information to Qt tools. Issue: #24624
-rw-r--r--Source/cmGlobalGenerator.cxx22
-rw-r--r--Source/cmGlobalGenerator.h4
-rw-r--r--Source/cmQtAutoGenGlobalInitializer.cxx5
-rw-r--r--Source/cmQtAutoGenGlobalInitializer.h6
4 files changed, 12 insertions, 25 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 7ed68d637a..d2e129f420 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1543,10 +1543,12 @@ bool cmGlobalGenerator::Compute()
return false;
}
- // Iterate through all targets and set up AUTOMOC, AUTOUIC and AUTORCC
- if (!this->QtAutoGen()) {
+#ifndef CMAKE_BOOTSTRAP
+ cmQtAutoGenGlobalInitializer qtAutoGen(this->LocalGenerators);
+ if (!qtAutoGen.InitializeCustomTargets()) {
return false;
}
+#endif
// Add generator specific helper commands
for (const auto& localGen : this->LocalGenerators) {
@@ -1563,6 +1565,12 @@ bool cmGlobalGenerator::Compute()
}
}
+#ifndef CMAKE_BOOTSTRAP
+ if (!qtAutoGen.SetupCustomTargets()) {
+ return false;
+ }
+#endif
+
for (const auto& localGen : this->LocalGenerators) {
cmMakefile* mf = localGen->GetMakefile();
for (const auto& g : mf->GetInstallGenerators()) {
@@ -1764,16 +1772,6 @@ void cmGlobalGenerator::ComputeTargetOrder(cmGeneratorTarget const* gt,
entry->second = index++;
}
-bool cmGlobalGenerator::QtAutoGen()
-{
-#ifndef CMAKE_BOOTSTRAP
- cmQtAutoGenGlobalInitializer initializer(this->LocalGenerators);
- return initializer.generate();
-#else
- return true;
-#endif
-}
-
bool cmGlobalGenerator::AddHeaderSetVerification()
{
for (auto const& gen : this->LocalGenerators) {
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 7de8215f38..73a4915340 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -625,10 +625,6 @@ protected:
void CxxModuleSupportCheck() const;
- /// @brief Qt AUTOMOC/UIC/RCC target generation
- /// @return true on success
- bool QtAutoGen();
-
bool AddHeaderSetVerification();
bool AddAutomaticSources();
diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx
index 9e3fe7f6c4..1da8847fb6 100644
--- a/Source/cmQtAutoGenGlobalInitializer.cxx
+++ b/Source/cmQtAutoGenGlobalInitializer.cxx
@@ -264,11 +264,6 @@ cmQtAutoGenGlobalInitializer::GetCompilerFeatures(
return res;
}
-bool cmQtAutoGenGlobalInitializer::generate()
-{
- return (this->InitializeCustomTargets() && this->SetupCustomTargets());
-}
-
bool cmQtAutoGenGlobalInitializer::InitializeCustomTargets()
{
// Initialize global autogen targets
diff --git a/Source/cmQtAutoGenGlobalInitializer.h b/Source/cmQtAutoGenGlobalInitializer.h
index 3de5c1a850..e8569a538f 100644
--- a/Source/cmQtAutoGenGlobalInitializer.h
+++ b/Source/cmQtAutoGenGlobalInitializer.h
@@ -51,14 +51,12 @@ public:
Keywords const& kw() const { return this->Keywords_; }
- bool generate();
+ bool InitializeCustomTargets();
+ bool SetupCustomTargets();
private:
friend class cmQtAutoGenInitializer;
- bool InitializeCustomTargets();
- bool SetupCustomTargets();
-
void GetOrCreateGlobalTarget(cmLocalGenerator* localGen,
std::string const& name,
std::string const& comment);