cmMakefile: Refactor API to better handle empty config values
This commit is contained in:
parent
19f7588d3d
commit
7a969fe21d
@ -196,7 +196,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
|
||||
std::set<cmLinkItem> emitted;
|
||||
|
||||
std::vector<std::string> const& configs =
|
||||
depender->Makefile->GetGeneratorConfigs();
|
||||
depender->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
|
||||
for (std::string const& it : configs) {
|
||||
cmLinkImplementation const* impl = depender->GetLinkImplementation(it);
|
||||
|
||||
|
@ -223,11 +223,9 @@ bool cmExportCommand(std::vector<std::string> const& args,
|
||||
ebfg->SetExportOld(arguments.ExportOld);
|
||||
|
||||
// Compute the set of configurations exported.
|
||||
std::vector<std::string> configurationTypes;
|
||||
mf.GetConfigurations(configurationTypes);
|
||||
if (configurationTypes.empty()) {
|
||||
configurationTypes.emplace_back();
|
||||
}
|
||||
std::vector<std::string> configurationTypes =
|
||||
mf.GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
|
||||
|
||||
for (std::string const& ct : configurationTypes) {
|
||||
ebfg->AddConfiguration(ct);
|
||||
}
|
||||
|
@ -567,8 +567,9 @@ void cmExportFileGenerator::PopulateCompatibleInterfaceProperties(
|
||||
if (gtarget->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
|
||||
getCompatibleInterfaceProperties(gtarget, ifaceProperties, "");
|
||||
|
||||
std::vector<std::string> configNames;
|
||||
gtarget->Target->GetMakefile()->GetConfigurations(configNames);
|
||||
std::vector<std::string> configNames =
|
||||
gtarget->Target->GetMakefile()->GetGeneratorConfigs(
|
||||
cmMakefile::ExcludeEmptyConfig);
|
||||
|
||||
for (std::string const& cn : configNames) {
|
||||
getCompatibleInterfaceProperties(gtarget, ifaceProperties, cn);
|
||||
|
@ -445,7 +445,7 @@ Json::Value Codemodel::DumpConfigurations()
|
||||
const auto& makefiles = gg->GetMakefiles();
|
||||
if (!makefiles.empty()) {
|
||||
std::vector<std::string> const& configs =
|
||||
makefiles[0]->GetGeneratorConfigs();
|
||||
makefiles[0]->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
|
||||
for (std::string const& config : configs) {
|
||||
configurations.append(this->DumpConfiguration(config));
|
||||
}
|
||||
|
@ -157,12 +157,8 @@ void cmGeneratorExpressionEvaluationFile::Generate(cmLocalGenerator* lg)
|
||||
|
||||
std::map<std::string, std::string> outputFiles;
|
||||
|
||||
std::vector<std::string> allConfigs;
|
||||
lg->GetMakefile()->GetConfigurations(allConfigs);
|
||||
|
||||
if (allConfigs.empty()) {
|
||||
allConfigs.emplace_back();
|
||||
}
|
||||
std::vector<std::string> allConfigs =
|
||||
lg->GetMakefile()->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
|
||||
|
||||
std::vector<std::string> enabledLanguages;
|
||||
cmGlobalGenerator* gg = lg->GetGlobalGenerator();
|
||||
|
@ -801,7 +801,8 @@ void cmGeneratorTarget::GetObjectSources(
|
||||
|
||||
void cmGeneratorTarget::ComputeObjectMapping()
|
||||
{
|
||||
auto const& configs = this->Makefile->GetGeneratorConfigs();
|
||||
auto const& configs =
|
||||
this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
|
||||
std::set<std::string> configSet(configs.begin(), configs.end());
|
||||
if (configSet == this->VisitedConfigsForObjects) {
|
||||
return;
|
||||
@ -1778,8 +1779,8 @@ cmGeneratorTarget::GetAllConfigSources() const
|
||||
|
||||
void cmGeneratorTarget::ComputeAllConfigSources() const
|
||||
{
|
||||
std::vector<std::string> configs;
|
||||
this->Makefile->GetConfigurations(configs);
|
||||
std::vector<std::string> configs =
|
||||
this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
|
||||
|
||||
std::map<cmSourceFile const*, size_t> index;
|
||||
|
||||
@ -2812,7 +2813,7 @@ cmTargetTraceDependencies::cmTargetTraceDependencies(cmGeneratorTarget* target)
|
||||
if (target->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
|
||||
std::set<cmSourceFile*> emitted;
|
||||
std::vector<std::string> const& configs =
|
||||
this->Makefile->GetGeneratorConfigs();
|
||||
this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
|
||||
for (std::string const& c : configs) {
|
||||
std::vector<cmSourceFile*> sources;
|
||||
this->GeneratorTarget->GetSourceFiles(sources, c);
|
||||
@ -3023,7 +3024,7 @@ void cmTargetTraceDependencies::CheckCustomCommand(cmCustomCommand const& cc)
|
||||
// Queue the custom command dependencies.
|
||||
std::set<std::string> emitted;
|
||||
std::vector<std::string> const& configs =
|
||||
this->Makefile->GetGeneratorConfigs();
|
||||
this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
|
||||
for (std::string const& conf : configs) {
|
||||
this->FollowCommandDepends(cc, conf, emitted);
|
||||
}
|
||||
@ -6843,7 +6844,7 @@ bool cmGeneratorTarget::GetConfigCommonSourceFiles(
|
||||
std::vector<cmSourceFile*>& files) const
|
||||
{
|
||||
std::vector<std::string> const& configs =
|
||||
this->Makefile->GetGeneratorConfigs();
|
||||
this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
|
||||
|
||||
auto it = configs.begin();
|
||||
const std::string& firstConfig = *it;
|
||||
|
@ -313,19 +313,16 @@ bool cmGlobalGenerator::CheckTargetsForMissingSources() const
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> configs;
|
||||
target->Makefile->GetConfigurations(configs);
|
||||
std::vector<std::string> configs =
|
||||
target->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
|
||||
std::vector<cmSourceFile*> srcs;
|
||||
if (configs.empty()) {
|
||||
target->GetSourceFiles(srcs, "");
|
||||
} else {
|
||||
for (std::string const& config : configs) {
|
||||
target->GetSourceFiles(srcs, config);
|
||||
if (!srcs.empty()) {
|
||||
break;
|
||||
}
|
||||
for (std::string const& config : configs) {
|
||||
target->GetSourceFiles(srcs, config);
|
||||
if (!srcs.empty()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (srcs.empty()) {
|
||||
std::ostringstream e;
|
||||
e << "No SOURCES given to target: " << target->GetName();
|
||||
@ -349,7 +346,8 @@ bool cmGlobalGenerator::CheckTargetsForType() const
|
||||
if (target->GetType() == cmStateEnums::EXECUTABLE &&
|
||||
target->GetPropertyAsBool("WIN32_EXECUTABLE")) {
|
||||
std::vector<std::string> const& configs =
|
||||
target->Makefile->GetGeneratorConfigs();
|
||||
target->Makefile->GetGeneratorConfigs(
|
||||
cmMakefile::IncludeEmptyConfig);
|
||||
for (std::string const& config : configs) {
|
||||
if (target->GetLinkerLanguage(config) == "Swift") {
|
||||
this->GetCMakeInstance()->IssueMessage(
|
||||
@ -1701,8 +1699,8 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
|
||||
cmPolicies::PolicyStatus polSt =
|
||||
mf->GetPolicyStatus(cmPolicies::CMP0043);
|
||||
if (polSt == cmPolicies::WARN || polSt == cmPolicies::OLD) {
|
||||
std::vector<std::string> configs;
|
||||
mf->GetConfigurations(configs);
|
||||
std::vector<std::string> configs =
|
||||
mf->GetGeneratorConfigs(cmMakefile::ExcludeEmptyConfig);
|
||||
|
||||
for (std::string const& c : configs) {
|
||||
std::string defPropName =
|
||||
@ -3127,7 +3125,8 @@ void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target)
|
||||
fout << "# Source files and their labels\n";
|
||||
std::vector<cmSourceFile*> sources;
|
||||
std::vector<std::string> const& configs =
|
||||
target->Target->GetMakefile()->GetGeneratorConfigs();
|
||||
target->Target->GetMakefile()->GetGeneratorConfigs(
|
||||
cmMakefile::IncludeEmptyConfig);
|
||||
for (std::string const& c : configs) {
|
||||
target->GetSourceFiles(sources, c);
|
||||
}
|
||||
@ -3226,8 +3225,9 @@ bool cmGlobalGenerator::GenerateCPackPropertiesFile()
|
||||
const auto& lg = this->LocalGenerators[0];
|
||||
cmMakefile* mf = lg->GetMakefile();
|
||||
|
||||
std::vector<std::string> configs;
|
||||
std::string config = mf->GetConfigurations(configs, false);
|
||||
std::vector<std::string> configs =
|
||||
mf->GetGeneratorConfigs(cmMakefile::OnlyMultiConfig);
|
||||
std::string config = mf->GetDefaultConfiguration();
|
||||
|
||||
std::string path = cmStrCat(this->CMakeInstance->GetHomeOutputDirectory(),
|
||||
"/CPackProperties.cmake");
|
||||
|
@ -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()
|
||||
|
@ -19,8 +19,8 @@ void cmGlobalVisualStudio71Generator::WriteSLNFile(
|
||||
std::ostream& fout, cmLocalGenerator* root,
|
||||
std::vector<cmLocalGenerator*>& generators)
|
||||
{
|
||||
std::vector<std::string> configs;
|
||||
root->GetMakefile()->GetConfigurations(configs);
|
||||
std::vector<std::string> configs =
|
||||
root->GetMakefile()->GetGeneratorConfigs(cmMakefile::ExcludeEmptyConfig);
|
||||
|
||||
// Write out the header for a SLN file
|
||||
this->WriteSLNHeader(fout);
|
||||
|
@ -568,8 +568,9 @@ void cmGlobalVisualStudio7Generator::WriteSLNFooter(std::ostream& fout)
|
||||
std::string cmGlobalVisualStudio7Generator::WriteUtilityDepend(
|
||||
cmGeneratorTarget const* target)
|
||||
{
|
||||
std::vector<std::string> configs;
|
||||
target->Target->GetMakefile()->GetConfigurations(configs);
|
||||
std::vector<std::string> configs =
|
||||
target->Target->GetMakefile()->GetGeneratorConfigs(
|
||||
cmMakefile::ExcludeEmptyConfig);
|
||||
std::string pname = cmStrCat(target->GetName(), "_UTILITY");
|
||||
std::string fname =
|
||||
cmStrCat(target->GetLocalGenerator()->GetCurrentBinaryDirectory(), '/',
|
||||
|
@ -1077,11 +1077,8 @@ void cmGlobalXCodeGenerator::SetCurrentLocalGenerator(cmLocalGenerator* gen)
|
||||
this->CurrentMakefile = gen->GetMakefile();
|
||||
|
||||
// Select the current set of configuration types.
|
||||
this->CurrentConfigurationTypes.clear();
|
||||
this->CurrentMakefile->GetConfigurations(this->CurrentConfigurationTypes);
|
||||
if (this->CurrentConfigurationTypes.empty()) {
|
||||
this->CurrentConfigurationTypes.emplace_back();
|
||||
}
|
||||
this->CurrentConfigurationTypes =
|
||||
this->CurrentMakefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
|
||||
}
|
||||
|
||||
struct cmSourceFilePathCompare
|
||||
|
@ -51,11 +51,7 @@ std::vector<std::string> getConfigurations(const cmake* cm)
|
||||
return configurations;
|
||||
}
|
||||
|
||||
makefiles[0]->GetConfigurations(configurations);
|
||||
if (configurations.empty()) {
|
||||
configurations.emplace_back();
|
||||
}
|
||||
return configurations;
|
||||
return makefiles[0]->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
|
||||
}
|
||||
|
||||
bool hasString(const Json::Value& v, const std::string& s)
|
||||
|
@ -28,7 +28,8 @@ void cmLinkItemGraphVisitor::VisitLinks(cmLinkItem const& item,
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto const& config : item.Target->Makefile->GetGeneratorConfigs()) {
|
||||
for (auto const& config : item.Target->Makefile->GetGeneratorConfigs(
|
||||
cmMakefile::IncludeEmptyConfig)) {
|
||||
this->VisitLinks(item, rootItem, config);
|
||||
}
|
||||
}
|
||||
|
@ -17,10 +17,8 @@ cmLocalCommonGenerator::cmLocalCommonGenerator(cmGlobalGenerator* gg,
|
||||
: cmLocalGenerator(gg, mf)
|
||||
, WorkingDirectory(std::move(wd))
|
||||
{
|
||||
this->Makefile->GetConfigurations(this->ConfigNames);
|
||||
if (this->ConfigNames.empty()) {
|
||||
this->ConfigNames.emplace_back();
|
||||
}
|
||||
this->ConfigNames =
|
||||
this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
|
||||
}
|
||||
|
||||
cmLocalCommonGenerator::~cmLocalCommonGenerator() = default;
|
||||
|
@ -297,9 +297,9 @@ void cmLocalGenerator::GenerateTestFiles()
|
||||
}
|
||||
|
||||
// Compute the set of configurations.
|
||||
std::vector<std::string> configurationTypes;
|
||||
const std::string& config =
|
||||
this->Makefile->GetConfigurations(configurationTypes, false);
|
||||
std::vector<std::string> configurationTypes =
|
||||
this->Makefile->GetGeneratorConfigs(cmMakefile::OnlyMultiConfig);
|
||||
std::string config = this->Makefile->GetDefaultConfiguration();
|
||||
|
||||
std::string file =
|
||||
cmStrCat(this->StateSnapshot.GetDirectory().GetCurrentBinary(),
|
||||
@ -379,7 +379,7 @@ void cmLocalGenerator::GenerateTestFiles()
|
||||
void cmLocalGenerator::CreateEvaluationFileOutputs()
|
||||
{
|
||||
std::vector<std::string> const& configs =
|
||||
this->Makefile->GetGeneratorConfigs();
|
||||
this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
|
||||
for (std::string const& c : configs) {
|
||||
this->CreateEvaluationFileOutputs(c);
|
||||
}
|
||||
@ -462,9 +462,9 @@ void cmLocalGenerator::GenerateInstallRules()
|
||||
}
|
||||
|
||||
// Compute the set of configurations.
|
||||
std::vector<std::string> configurationTypes;
|
||||
const std::string& config =
|
||||
this->Makefile->GetConfigurations(configurationTypes, false);
|
||||
std::vector<std::string> configurationTypes =
|
||||
this->Makefile->GetGeneratorConfigs(cmMakefile::OnlyMultiConfig);
|
||||
std::string config = this->Makefile->GetDefaultConfiguration();
|
||||
|
||||
// Choose a default install configuration.
|
||||
std::string default_config = config;
|
||||
@ -753,11 +753,8 @@ cmGeneratorTarget* cmLocalGenerator::FindLocalNonAliasGeneratorTarget(
|
||||
void cmLocalGenerator::ComputeTargetManifest()
|
||||
{
|
||||
// Collect the set of configuration types.
|
||||
std::vector<std::string> configNames;
|
||||
this->Makefile->GetConfigurations(configNames);
|
||||
if (configNames.empty()) {
|
||||
configNames.emplace_back();
|
||||
}
|
||||
std::vector<std::string> configNames =
|
||||
this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
|
||||
|
||||
// Add our targets to the manifest for each configuration.
|
||||
const auto& targets = this->GetGeneratorTargets();
|
||||
@ -774,11 +771,8 @@ void cmLocalGenerator::ComputeTargetManifest()
|
||||
bool cmLocalGenerator::ComputeTargetCompileFeatures()
|
||||
{
|
||||
// Collect the set of configuration types.
|
||||
std::vector<std::string> configNames;
|
||||
this->Makefile->GetConfigurations(configNames);
|
||||
if (configNames.empty()) {
|
||||
configNames.emplace_back();
|
||||
}
|
||||
std::vector<std::string> configNames =
|
||||
this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
|
||||
|
||||
using LanguagePair = std::pair<std::string, std::string>;
|
||||
std::vector<LanguagePair> pairedLanguages{ { "OBJC", "C" },
|
||||
@ -2551,11 +2545,8 @@ void cmLocalGenerator::AppendFlagEscape(std::string& flags,
|
||||
|
||||
void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
|
||||
{
|
||||
std::vector<std::string> configsList;
|
||||
std::string configDefault = this->Makefile->GetConfigurations(configsList);
|
||||
if (configsList.empty()) {
|
||||
configsList.push_back(configDefault);
|
||||
}
|
||||
std::vector<std::string> configsList =
|
||||
this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
|
||||
|
||||
for (std::string const& config : configsList) {
|
||||
// FIXME: Refactor collection of sources to not evaluate object
|
||||
|
@ -1331,8 +1331,8 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout,
|
||||
const std::string& libName,
|
||||
cmGeneratorTarget* target)
|
||||
{
|
||||
std::vector<std::string> configs;
|
||||
this->Makefile->GetConfigurations(configs);
|
||||
std::vector<std::string> configs =
|
||||
this->Makefile->GetGeneratorConfigs(cmMakefile::ExcludeEmptyConfig);
|
||||
|
||||
// We may be modifying the source groups temporarily, so make a copy.
|
||||
std::vector<cmSourceGroup> sourceGroups = this->Makefile->GetSourceGroups();
|
||||
@ -1580,8 +1580,9 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo(
|
||||
std::string cmLocalVisualStudio7Generator::ComputeLongestObjectDirectory(
|
||||
cmGeneratorTarget const* target) const
|
||||
{
|
||||
std::vector<std::string> configs;
|
||||
target->Target->GetMakefile()->GetConfigurations(configs);
|
||||
std::vector<std::string> configs =
|
||||
target->Target->GetMakefile()->GetGeneratorConfigs(
|
||||
cmMakefile::ExcludeEmptyConfig);
|
||||
|
||||
// Compute the maximum length configuration name.
|
||||
std::string config_max;
|
||||
|
@ -1436,8 +1436,8 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent)
|
||||
if (polSt == cmPolicies::WARN || polSt == cmPolicies::OLD) {
|
||||
cmProp p = parent->GetProperty("COMPILE_DEFINITIONS");
|
||||
this->SetProperty("COMPILE_DEFINITIONS", p ? p->c_str() : nullptr);
|
||||
std::vector<std::string> configs;
|
||||
this->GetConfigurations(configs);
|
||||
std::vector<std::string> configs =
|
||||
this->GetGeneratorConfigs(cmMakefile::ExcludeEmptyConfig);
|
||||
for (std::string const& config : configs) {
|
||||
std::string defPropName =
|
||||
cmStrCat("COMPILE_DEFINITIONS_", cmSystemTools::UpperCase(config));
|
||||
@ -3251,25 +3251,28 @@ void cmMakefile::RemoveVariablesInString(std::string& source,
|
||||
}
|
||||
}
|
||||
|
||||
std::string cmMakefile::GetConfigurations(std::vector<std::string>& configs,
|
||||
bool singleConfig) const
|
||||
std::string cmMakefile::GetDefaultConfiguration() const
|
||||
{
|
||||
if (this->GetGlobalGenerator()->IsMultiConfig()) {
|
||||
this->GetDefExpandList("CMAKE_CONFIGURATION_TYPES", configs);
|
||||
return "";
|
||||
return std::string{};
|
||||
}
|
||||
const std::string& buildType = this->GetSafeDefinition("CMAKE_BUILD_TYPE");
|
||||
if (singleConfig && !buildType.empty()) {
|
||||
configs.push_back(buildType);
|
||||
}
|
||||
return buildType;
|
||||
return this->GetSafeDefinition("CMAKE_BUILD_TYPE");
|
||||
}
|
||||
|
||||
std::vector<std::string> cmMakefile::GetGeneratorConfigs() const
|
||||
std::vector<std::string> cmMakefile::GetGeneratorConfigs(
|
||||
GeneratorConfigQuery mode) const
|
||||
{
|
||||
std::vector<std::string> configs;
|
||||
GetConfigurations(configs);
|
||||
if (configs.empty()) {
|
||||
if (this->GetGlobalGenerator()->IsMultiConfig() ||
|
||||
mode == cmMakefile::OnlyMultiConfig) {
|
||||
this->GetDefExpandList("CMAKE_CONFIGURATION_TYPES", configs);
|
||||
} else {
|
||||
const std::string& buildType = this->GetSafeDefinition("CMAKE_BUILD_TYPE");
|
||||
if (!buildType.empty()) {
|
||||
configs.emplace_back(buildType);
|
||||
}
|
||||
}
|
||||
if (mode == cmMakefile::IncludeEmptyConfig && configs.empty()) {
|
||||
configs.emplace_back();
|
||||
}
|
||||
return configs;
|
||||
|
@ -343,12 +343,19 @@ public:
|
||||
*/
|
||||
void SetProjectName(std::string const& name);
|
||||
|
||||
/** Get the configurations to be generated. */
|
||||
std::string GetConfigurations(std::vector<std::string>& configs,
|
||||
bool single = true) const;
|
||||
/* Get the default configuration */
|
||||
std::string GetDefaultConfiguration() const;
|
||||
|
||||
enum GeneratorConfigQuery
|
||||
{
|
||||
IncludeEmptyConfig, // Include "" aka noconfig
|
||||
ExcludeEmptyConfig, // Exclude "" aka noconfig
|
||||
OnlyMultiConfig,
|
||||
};
|
||||
|
||||
/** Get the configurations for dependency checking. */
|
||||
std::vector<std::string> GetGeneratorConfigs() const;
|
||||
std::vector<std::string> GetGeneratorConfigs(
|
||||
GeneratorConfigQuery mode) const;
|
||||
|
||||
/**
|
||||
* Set the name of the library.
|
||||
|
@ -65,7 +65,8 @@ cmNinjaTargetGenerator::cmNinjaTargetGenerator(cmGeneratorTarget* target)
|
||||
, LocalGenerator(
|
||||
static_cast<cmLocalNinjaGenerator*>(target->GetLocalGenerator()))
|
||||
{
|
||||
for (auto const& fileConfig : target->Makefile->GetGeneratorConfigs()) {
|
||||
for (auto const& fileConfig :
|
||||
target->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig)) {
|
||||
this->Configs[fileConfig].MacOSXContentGenerator =
|
||||
cm::make_unique<MacOSXContentGeneratorType>(this, fileConfig);
|
||||
}
|
||||
|
@ -315,10 +315,9 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
|
||||
{
|
||||
// Configurations
|
||||
this->MultiConfig = this->GlobalGen->IsMultiConfig();
|
||||
this->ConfigDefault = this->Makefile->GetConfigurations(this->ConfigsList);
|
||||
if (this->ConfigsList.empty()) {
|
||||
this->ConfigsList.push_back(this->ConfigDefault);
|
||||
}
|
||||
this->ConfigDefault = this->Makefile->GetDefaultConfiguration();
|
||||
this->ConfigsList =
|
||||
this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
|
||||
|
||||
// Verbosity
|
||||
{
|
||||
|
@ -419,8 +419,8 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
|
||||
"INTERPROCEDURAL_OPTIMIZATION_"
|
||||
};
|
||||
// Collect the set of configuration types.
|
||||
std::vector<std::string> configNames;
|
||||
mf->GetConfigurations(configNames);
|
||||
std::vector<std::string> configNames =
|
||||
mf->GetGeneratorConfigs(cmMakefile::ExcludeEmptyConfig);
|
||||
for (std::string const& configName : configNames) {
|
||||
std::string configUpper = cmSystemTools::UpperCase(configName);
|
||||
for (auto const& prop : configProps) {
|
||||
|
@ -232,7 +232,8 @@ cmVisualStudio10TargetGenerator::cmVisualStudio10TargetGenerator(
|
||||
, LocalGenerator(
|
||||
(cmLocalVisualStudio10Generator*)target->GetLocalGenerator())
|
||||
{
|
||||
this->Makefile->GetConfigurations(this->Configurations);
|
||||
this->Configurations =
|
||||
this->Makefile->GetGeneratorConfigs(cmMakefile::ExcludeEmptyConfig);
|
||||
this->NsightTegra = gg->IsNsightTegra();
|
||||
this->Android = gg->TargetsAndroid();
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
|
Loading…
Reference in New Issue
Block a user