summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-06-21 13:28:51 (GMT)
committerBrad King <brad.king@kitware.com>2024-06-21 14:59:30 (GMT)
commit9f8afacb3e512debd1d53f14f685802eda4a54f8 (patch)
treed3701cddce65bac2f20a38a797212e958479f369 /Source
parent48b911e3e58089932c5d65bffc02ee66fac7f9b1 (diff)
downloadCMake-9f8afacb3e512debd1d53f14f685802eda4a54f8.zip
CMake-9f8afacb3e512debd1d53f14f685802eda4a54f8.tar.gz
CMake-9f8afacb3e512debd1d53f14f685802eda4a54f8.tar.bz2
cmGlobalNinjaGenerator: Reuse local generator caching of config list
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalCommonGenerator.cxx6
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx10
-rw-r--r--Source/cmGlobalNinjaGenerator.h2
-rw-r--r--Source/cmLocalNinjaGenerator.cxx7
-rw-r--r--Source/cmNinjaTargetGenerator.cxx3
5 files changed, 12 insertions, 16 deletions
diff --git a/Source/cmGlobalCommonGenerator.cxx b/Source/cmGlobalCommonGenerator.cxx
index 513e3bf..b1b96d0 100644
--- a/Source/cmGlobalCommonGenerator.cxx
+++ b/Source/cmGlobalCommonGenerator.cxx
@@ -12,8 +12,8 @@
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
+#include "cmLocalCommonGenerator.h"
#include "cmLocalGenerator.h"
-#include "cmMakefile.h"
#include "cmStateDirectory.h"
#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
@@ -38,8 +38,8 @@ cmGlobalCommonGenerator::ComputeDirectoryTargets() const
lg->GetStateSnapshot().GetDirectory().GetCurrentBinary();
DirectoryTarget& dirTarget = dirTargets[currentBinaryDir];
dirTarget.LG = lg.get();
- const std::vector<std::string>& configs =
- lg->GetMakefile()->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
+ std::vector<std::string> const& configs =
+ static_cast<cmLocalCommonGenerator const*>(lg.get())->GetConfigNames();
// The directory-level rule should depend on the target-level rules
// for all targets in the directory.
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index c50ef00..96c8f25 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -603,10 +603,11 @@ cmDocumentationEntry cmGlobalNinjaGenerator::GetDocumentation()
"Generates build.ninja files." };
}
-std::vector<std::string> cmGlobalNinjaGenerator::GetConfigNames() const
+std::vector<std::string> const& cmGlobalNinjaGenerator::GetConfigNames() const
{
- return this->Makefiles.front()->GetGeneratorConfigs(
- cmMakefile::IncludeEmptyConfig);
+ return static_cast<cmLocalNinjaGenerator const*>(
+ this->LocalGenerators.front().get())
+ ->GetConfigNames();
}
// Implemented in all cmGlobaleGenerator sub-classes.
@@ -1632,8 +1633,7 @@ void cmGlobalNinjaGenerator::WriteFolderTargets(std::ostream& os)
std::string const& currentBinaryDir = it.first;
DirectoryTarget const& dt = it.second;
std::vector<std::string> configs =
- dt.LG->GetMakefile()->GetGeneratorConfigs(
- cmMakefile::IncludeEmptyConfig);
+ static_cast<cmLocalNinjaGenerator const*>(dt.LG)->GetConfigNames();
// Setup target
cmNinjaDeps configDeps;
diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h
index 7c7b356..6ad38fb 100644
--- a/Source/cmGlobalNinjaGenerator.h
+++ b/Source/cmGlobalNinjaGenerator.h
@@ -485,7 +485,7 @@ public:
bool CheckCxxModuleSupport(CxxModuleSupportQuery query) override;
protected:
- std::vector<std::string> GetConfigNames() const;
+ std::vector<std::string> const& GetConfigNames() const;
void Generate() override;
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index bc3da6e..46a95af 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -743,8 +743,6 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement(
bool cmLocalNinjaGenerator::HasUniqueByproducts(
std::vector<std::string> const& byproducts, cmListFileBacktrace const& bt)
{
- std::vector<std::string> configs =
- this->GetMakefile()->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
cmGeneratorExpression ge(*this->GetCMakeInstance(), bt);
for (std::string const& p : byproducts) {
if (cmGeneratorExpression::Find(p) == std::string::npos) {
@@ -752,7 +750,7 @@ bool cmLocalNinjaGenerator::HasUniqueByproducts(
}
std::set<std::string> seen;
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(p);
- for (std::string const& config : configs) {
+ for (std::string const& config : this->GetConfigNames()) {
for (std::string const& b :
this->ExpandCustomCommandOutputPaths(*cge, config)) {
if (!seen.insert(b).second) {
@@ -800,8 +798,7 @@ std::string cmLocalNinjaGenerator::CreateUtilityOutput(
std::string const base = cmStrCat(this->GetCurrentBinaryDirectory(),
"/CMakeFiles/", targetName, '-');
// The output is not actually created so mark it symbolic.
- for (std::string const& config :
- this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig)) {
+ for (std::string const& config : this->GetConfigNames()) {
std::string const force = cmStrCat(base, config);
if (cmSourceFile* sf = this->Makefile->GetOrCreateGeneratedSource(force)) {
sf->SetProperty("SYMBOLIC", "1");
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 160689c..a10635a 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -87,8 +87,7 @@ cmNinjaTargetGenerator::cmNinjaTargetGenerator(cmGeneratorTarget* target)
, LocalGenerator(
static_cast<cmLocalNinjaGenerator*>(target->GetLocalGenerator()))
{
- for (auto const& fileConfig :
- target->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig)) {
+ for (auto const& fileConfig : this->LocalGenerator->GetConfigNames()) {
this->Configs[fileConfig].MacOSXContentGenerator =
cm::make_unique<MacOSXContentGeneratorType>(this, fileConfig);
}