|
|
@@ -5,9 +5,9 @@
|
|
|
#include <algorithm>
|
|
|
#include <cctype>
|
|
|
#include <cstdio>
|
|
|
-#include <iterator>
|
|
|
#include <sstream>
|
|
|
|
|
|
+#include <cm/iterator>
|
|
|
#include <cm/memory>
|
|
|
#include <cmext/algorithm>
|
|
|
#include <cmext/memory>
|
|
|
@@ -518,7 +518,8 @@ void cmGlobalNinjaGenerator::Generate()
|
|
|
|
|
|
if (cmSystemTools::GetErrorOccuredFlag()) {
|
|
|
this->RulesFileStream->setstate(std::ios::failbit);
|
|
|
- for (auto const& config : this->Makefiles[0]->GetGeneratorConfigs()) {
|
|
|
+ for (auto const& config : this->Makefiles[0]->GetGeneratorConfigs(
|
|
|
+ cmMakefile::IncludeEmptyConfig)) {
|
|
|
this->GetImplFileStream(config)->setstate(std::ios::failbit);
|
|
|
this->GetConfigFileStream(config)->setstate(std::ios::failbit);
|
|
|
}
|
|
|
@@ -1207,7 +1208,8 @@ void cmGlobalNinjaGenerator::AddTargetAlias(const std::string& alias,
|
|
|
this->TargetAliases[output].GeneratorTarget = nullptr;
|
|
|
this->DefaultTargetAliases[output].GeneratorTarget = nullptr;
|
|
|
for (const std::string& config2 :
|
|
|
- this->Makefiles.front()->GetGeneratorConfigs()) {
|
|
|
+ this->Makefiles.front()->GetGeneratorConfigs(
|
|
|
+ cmMakefile::IncludeEmptyConfig)) {
|
|
|
this->Configs[config2].TargetAliases[output].GeneratorTarget = nullptr;
|
|
|
}
|
|
|
}
|
|
|
@@ -1280,7 +1282,8 @@ void cmGlobalNinjaGenerator::WriteTargetAliases(std::ostream& os)
|
|
|
}
|
|
|
|
|
|
if (this->IsMultiConfig()) {
|
|
|
- for (auto const& config : this->Makefiles.front()->GetGeneratorConfigs()) {
|
|
|
+ for (auto const& config : this->Makefiles.front()->GetGeneratorConfigs(
|
|
|
+ cmMakefile::IncludeEmptyConfig)) {
|
|
|
for (auto const& ta : this->Configs[config].TargetAliases) {
|
|
|
// Don't write ambiguous aliases.
|
|
|
if (!ta.second.GeneratorTarget) {
|
|
|
@@ -1339,11 +1342,9 @@ void cmGlobalNinjaGenerator::WriteFolderTargets(std::ostream& os)
|
|
|
cmGlobalNinjaGenerator::WriteDivider(os);
|
|
|
std::string const& currentBinaryDir = it.first;
|
|
|
DirectoryTarget const& dt = it.second;
|
|
|
- std::vector<std::string> configs;
|
|
|
- dt.LG->GetMakefile()->GetConfigurations(configs, true);
|
|
|
- if (configs.empty()) {
|
|
|
- configs.emplace_back();
|
|
|
- }
|
|
|
+ std::vector<std::string> configs =
|
|
|
+ dt.LG->GetMakefile()->GetGeneratorConfigs(
|
|
|
+ cmMakefile::IncludeEmptyConfig);
|
|
|
|
|
|
// Setup target
|
|
|
cmNinjaDeps configDeps;
|
|
|
@@ -1538,7 +1539,8 @@ void cmGlobalNinjaGenerator::WriteBuiltinTargets(std::ostream& os)
|
|
|
this->WriteTargetClean(os);
|
|
|
this->WriteTargetHelp(os);
|
|
|
|
|
|
- for (auto const& config : this->Makefiles[0]->GetGeneratorConfigs()) {
|
|
|
+ for (auto const& config : this->Makefiles[0]->GetGeneratorConfigs(
|
|
|
+ cmMakefile::IncludeEmptyConfig)) {
|
|
|
this->WriteTargetDefault(*this->GetConfigFileStream(config));
|
|
|
}
|
|
|
|
|
|
@@ -1712,11 +1714,8 @@ bool cmGlobalNinjaGenerator::WriteTargetCleanAdditional(std::ostream& os)
|
|
|
std::string cleanScriptRel = "CMakeFiles/clean_additional.cmake";
|
|
|
std::string cleanScriptAbs =
|
|
|
cmStrCat(lgr->GetBinaryDirectory(), '/', cleanScriptRel);
|
|
|
- std::vector<std::string> configs;
|
|
|
- this->Makefiles[0]->GetConfigurations(configs, true);
|
|
|
- if (configs.empty()) {
|
|
|
- configs.emplace_back();
|
|
|
- }
|
|
|
+ std::vector<std::string> configs =
|
|
|
+ this->Makefiles[0]->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
|
|
|
|
|
|
// Check if there are additional files to clean
|
|
|
bool empty = true;
|
|
|
@@ -1810,7 +1809,8 @@ void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os)
|
|
|
WriteRule(*this->RulesFileStream, rule);
|
|
|
}
|
|
|
|
|
|
- auto const configs = this->Makefiles.front()->GetGeneratorConfigs();
|
|
|
+ auto const configs = this->Makefiles.front()->GetGeneratorConfigs(
|
|
|
+ cmMakefile::IncludeEmptyConfig);
|
|
|
|
|
|
// Write build
|
|
|
{
|
|
|
@@ -2489,7 +2489,8 @@ bool cmGlobalNinjaMultiGenerator::OpenBuildFileStreams()
|
|
|
<< "# This file contains build statements common to all "
|
|
|
"configurations.\n\n";
|
|
|
|
|
|
- for (auto const& config : this->Makefiles[0]->GetGeneratorConfigs()) {
|
|
|
+ for (auto const& config : this->Makefiles[0]->GetGeneratorConfigs(
|
|
|
+ cmMakefile::IncludeEmptyConfig)) {
|
|
|
// Open impl file.
|
|
|
if (!this->OpenFileStream(this->ImplFileStreams[config],
|
|
|
GetNinjaImplFilename(config))) {
|
|
|
@@ -2529,7 +2530,8 @@ void cmGlobalNinjaMultiGenerator::CloseBuildFileStreams()
|
|
|
this->DefaultFileStream.reset();
|
|
|
} // No error if it wasn't open
|
|
|
|
|
|
- for (auto const& config : this->Makefiles[0]->GetGeneratorConfigs()) {
|
|
|
+ for (auto const& config : this->Makefiles[0]->GetGeneratorConfigs(
|
|
|
+ cmMakefile::IncludeEmptyConfig)) {
|
|
|
if (this->ImplFileStreams[config]) {
|
|
|
this->ImplFileStreams[config].reset();
|
|
|
} else {
|
|
|
@@ -2571,7 +2573,8 @@ std::string cmGlobalNinjaMultiGenerator::GetNinjaConfigFilename(
|
|
|
void cmGlobalNinjaMultiGenerator::AddRebuildManifestOutputs(
|
|
|
cmNinjaDeps& outputs) const
|
|
|
{
|
|
|
- for (auto const& config : this->Makefiles.front()->GetGeneratorConfigs()) {
|
|
|
+ for (auto const& config : this->Makefiles.front()->GetGeneratorConfigs(
|
|
|
+ cmMakefile::IncludeEmptyConfig)) {
|
|
|
outputs.push_back(this->NinjaOutputPath(GetNinjaImplFilename(config)));
|
|
|
outputs.push_back(this->NinjaOutputPath(GetNinjaConfigFilename(config)));
|
|
|
}
|
|
|
@@ -2583,11 +2586,9 @@ void cmGlobalNinjaMultiGenerator::AddRebuildManifestOutputs(
|
|
|
void cmGlobalNinjaMultiGenerator::GetQtAutoGenConfigs(
|
|
|
std::vector<std::string>& configs) const
|
|
|
{
|
|
|
- auto const oldSize = configs.size();
|
|
|
- this->Makefiles.front()->GetConfigurations(configs);
|
|
|
- if (configs.size() == oldSize) {
|
|
|
- configs.emplace_back();
|
|
|
- }
|
|
|
+ auto allConfigs =
|
|
|
+ this->Makefiles[0]->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
|
|
|
+ configs.insert(configs.end(), cm::cbegin(allConfigs), cm::cend(allConfigs));
|
|
|
}
|
|
|
|
|
|
bool cmGlobalNinjaMultiGenerator::InspectConfigTypeVariables()
|