VS: Do not accumulate configurations globally (#15577)

Drop the VS >= 7 generator's global Configurations member and instead
lookup configurations using cmMakefile::GetConfigurations where needed.
This avoids accumulating all CMAKE_CONFIGURATION_TYPES values ever
encountered by a project() or enable_language() command and allows
the final value to be used in each directory.  We don't officially
support per-directory CMAKE_CONFIGURATION_TYPES values but we certainly
should not generate configurations not in the final value in the top
level directory.
This commit is contained in:
Brad King 2015-05-20 13:55:21 -04:00
parent 3541fc73a1
commit 2f4bb4e9b0
10 changed files with 119 additions and 176 deletions

View File

@ -83,6 +83,9 @@ void cmGlobalVisualStudio71Generator
cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators)
{
std::vector<std::string> configs;
root->GetMakefile()->GetConfigurations(configs);
// Write out the header for a SLN file
this->WriteSLNHeader(fout);
@ -104,11 +107,11 @@ void cmGlobalVisualStudio71Generator
// Write out the configurations information for the solution
fout << "Global\n";
// Write out the configurations for the solution
this->WriteSolutionConfigurations(fout);
this->WriteSolutionConfigurations(fout, configs);
fout << "\tGlobalSection(" << this->ProjectConfigurationSectionName
<< ") = postSolution\n";
// Write out the configurations for all the targets in the project
this->WriteTargetConfigurations(fout, orderedProjectTargets);
this->WriteTargetConfigurations(fout, configs, orderedProjectTargets);
fout << "\tEndGlobalSection\n";
if (useFolderProperty)
@ -129,11 +132,12 @@ void cmGlobalVisualStudio71Generator
//----------------------------------------------------------------------------
void
cmGlobalVisualStudio71Generator
::WriteSolutionConfigurations(std::ostream& fout)
::WriteSolutionConfigurations(std::ostream& fout,
std::vector<std::string> const& configs)
{
fout << "\tGlobalSection(SolutionConfiguration) = preSolution\n";
for(std::vector<std::string>::iterator i = this->Configurations.begin();
i != this->Configurations.end(); ++i)
for(std::vector<std::string>::const_iterator i = configs.begin();
i != configs.end(); ++i)
{
fout << "\t\t" << *i << " = " << *i << "\n";
}
@ -269,14 +273,15 @@ void cmGlobalVisualStudio71Generator
void cmGlobalVisualStudio71Generator
::WriteProjectConfigurations(
std::ostream& fout, const std::string& name, cmTarget::TargetType,
std::vector<std::string> const& configs,
const std::set<std::string>& configsPartOfDefaultBuild,
std::string const& platformMapping)
{
const std::string& platformName =
!platformMapping.empty() ? platformMapping : this->GetPlatformName();
std::string guid = this->GetGUID(name);
for(std::vector<std::string>::iterator i = this->Configurations.begin();
i != this->Configurations.end(); ++i)
for(std::vector<std::string>::const_iterator i = configs.begin();
i != configs.end(); ++i)
{
fout << "\t\t{" << guid << "}." << *i
<< ".ActiveCfg = " << *i << "|" << platformName << std::endl;

View File

@ -54,7 +54,8 @@ protected:
virtual void WriteSLNFile(std::ostream& fout,
cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators);
virtual void WriteSolutionConfigurations(std::ostream& fout);
virtual void WriteSolutionConfigurations(
std::ostream& fout, std::vector<std::string> const& configs);
virtual void WriteProject(std::ostream& fout,
const std::string& name, const char* path,
cmTarget const& t);
@ -63,6 +64,7 @@ protected:
cmTarget const& t);
virtual void WriteProjectConfigurations(
std::ostream& fout, const std::string& name, cmTarget::TargetType type,
std::vector<std::string> const& configs,
const std::set<std::string>& configsPartOfDefaultBuild,
const std::string& platformMapping = "");
virtual void WriteExternalProject(std::ostream& fout,

View File

@ -122,7 +122,6 @@ void cmGlobalVisualStudio7Generator
// Create list of configurations requested by user's cache, if any.
this->cmGlobalGenerator::EnableLanguage(lang, mf, optional);
this->GenerateConfigurations(mf);
// if this environment variable is set, then copy it to
// a static cache entry. It will be used by
@ -321,50 +320,6 @@ bool cmGlobalVisualStudio7Generator::SetGeneratorPlatform(std::string const& p,
return this->cmGlobalVisualStudioGenerator::SetGeneratorPlatform(p, mf);
}
void cmGlobalVisualStudio7Generator::GenerateConfigurations(cmMakefile* mf)
{
// process the configurations
const char* ct
= this->CMakeInstance->GetCacheDefinition("CMAKE_CONFIGURATION_TYPES");
if ( ct )
{
std::vector<std::string> argsOut;
cmSystemTools::ExpandListArgument(ct, argsOut);
for(std::vector<std::string>::iterator i = argsOut.begin();
i != argsOut.end(); ++i)
{
if(std::find(this->Configurations.begin(),
this->Configurations.end(),
*i) == this->Configurations.end())
{
this->Configurations.push_back(*i);
}
}
}
// default to at least Debug and Release
if(this->Configurations.size() == 0)
{
this->Configurations.push_back("Debug");
this->Configurations.push_back("Release");
}
// Reset the entry to have a semi-colon separated list.
std::string configs = this->Configurations[0];
for(unsigned int i=1; i < this->Configurations.size(); ++i)
{
configs += ";";
configs += this->Configurations[i];
}
mf->AddCacheDefinition(
"CMAKE_CONFIGURATION_TYPES",
configs.c_str(),
"Semicolon separated list of supported configuration types, "
"only supports Debug, Release, MinSizeRel, and RelWithDebInfo, "
"anything else will be ignored.",
cmState::STRING);
}
void cmGlobalVisualStudio7Generator::Generate()
{
// first do the superclass method
@ -436,6 +391,7 @@ void cmGlobalVisualStudio7Generator::OutputSLNFile()
void cmGlobalVisualStudio7Generator::WriteTargetConfigurations(
std::ostream& fout,
std::vector<std::string> const& configs,
OrderedTargetDependSet const& projectTargets)
{
// loop over again and write out configurations for each target
@ -451,23 +407,22 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations(
const char* expath = target->GetProperty("EXTERNAL_MSPROJECT");
if(expath)
{
std::set<std::string> allConfigurations(this->Configurations.begin(),
this->Configurations.end());
std::set<std::string> allConfigurations(configs.begin(), configs.end());
const char* mapping = target->GetProperty("VS_PLATFORM_MAPPING");
this->WriteProjectConfigurations(
fout, target->GetName().c_str(), target->GetType(),
allConfigurations, mapping ? mapping : "");
configs, allConfigurations, mapping ? mapping : "");
}
else
{
const std::set<std::string>& configsPartOfDefaultBuild =
this->IsPartOfDefaultBuild(projectTargets, target);
this->IsPartOfDefaultBuild(configs, projectTargets, target);
const char *vcprojName =
target->GetProperty("GENERATOR_FILE_NAME");
if (vcprojName)
{
this->WriteProjectConfigurations(fout, vcprojName, target->GetType(),
configsPartOfDefaultBuild);
configs, configsPartOfDefaultBuild);
}
}
}
@ -602,6 +557,9 @@ void cmGlobalVisualStudio7Generator
cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators)
{
std::vector<std::string> configs;
root->GetMakefile()->GetConfigurations(configs);
// Write out the header for a SLN file
this->WriteSLNHeader(fout);
@ -625,8 +583,8 @@ void cmGlobalVisualStudio7Generator
<< "\tGlobalSection(SolutionConfiguration) = preSolution\n";
int c = 0;
for(std::vector<std::string>::iterator i = this->Configurations.begin();
i != this->Configurations.end(); ++i)
for(std::vector<std::string>::iterator i = configs.begin();
i != configs.end(); ++i)
{
fout << "\t\tConfigName." << c << " = " << *i << "\n";
c++;
@ -647,7 +605,7 @@ void cmGlobalVisualStudio7Generator
// Write out the configurations for all the targets in the project
fout << "\tGlobalSection(ProjectConfiguration) = postSolution\n";
this->WriteTargetConfigurations(fout, orderedProjectTargets);
this->WriteTargetConfigurations(fout, configs, orderedProjectTargets);
fout << "\tEndGlobalSection\n";
// Write out global sections
@ -803,14 +761,15 @@ cmGlobalVisualStudio7Generator
void cmGlobalVisualStudio7Generator
::WriteProjectConfigurations(
std::ostream& fout, const std::string& name, cmTarget::TargetType,
std::vector<std::string> const& configs,
const std::set<std::string>& configsPartOfDefaultBuild,
const std::string& platformMapping)
{
const std::string& platformName =
!platformMapping.empty() ? platformMapping : this->GetPlatformName();
std::string guid = this->GetGUID(name);
for(std::vector<std::string>::iterator i = this->Configurations.begin();
i != this->Configurations.end(); ++i)
for(std::vector<std::string>::const_iterator i = configs.begin();
i != configs.end(); ++i)
{
fout << "\t\t{" << guid << "}." << *i
<< ".ActiveCfg = " << *i << "|" << platformName << "\n";
@ -928,6 +887,8 @@ void cmGlobalVisualStudio7Generator::WriteSLNHeader(std::ostream& fout)
std::string
cmGlobalVisualStudio7Generator::WriteUtilityDepend(cmTarget const* target)
{
std::vector<std::string> configs;
target->GetMakefile()->GetConfigurations(configs);
std::string pname = target->GetName();
pname += "_UTILITY";
std::string fname = target->GetMakefile()->GetCurrentBinaryDirectory();
@ -951,8 +912,8 @@ cmGlobalVisualStudio7Generator::WriteUtilityDepend(cmTarget const* target)
"\t<Platforms><Platform Name=\"Win32\"/></Platforms>\n"
"\t<Configurations>\n"
;
for(std::vector<std::string>::iterator i = this->Configurations.begin();
i != this->Configurations.end(); ++i)
for(std::vector<std::string>::iterator i = configs.begin();
i != configs.end(); ++i)
{
fout <<
"\t\t<Configuration\n"
@ -1017,11 +978,6 @@ void cmGlobalVisualStudio7Generator::CreateGUID(const std::string& name)
cmState::INTERNAL);
}
std::vector<std::string> *cmGlobalVisualStudio7Generator::GetConfigurations()
{
return &this->Configurations;
};
//----------------------------------------------------------------------------
void cmGlobalVisualStudio7Generator
::GetDocumentation(cmDocumentationEntry& entry)
@ -1048,6 +1004,7 @@ cmGlobalVisualStudio7Generator
std::set<std::string>
cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
std::vector<std::string> const& configs,
OrderedTargetDependSet const& projectTargets, cmTarget const* target)
{
std::set<std::string> activeConfigs;
@ -1060,8 +1017,8 @@ cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
if(target->GetName() == "INSTALL")
{
// inspect CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD properties
for(std::vector<std::string>::iterator i = this->Configurations.begin();
i != this->Configurations.end(); ++i)
for(std::vector<std::string>::const_iterator i = configs.begin();
i != configs.end(); ++i)
{
const char* propertyValue = target->GetMakefile()
->GetDefinition("CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD");
@ -1081,8 +1038,8 @@ cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
return activeConfigs;
}
// inspect EXCLUDE_FROM_DEFAULT_BUILD[_<CONFIG>] properties
for(std::vector<std::string>::iterator i = this->Configurations.begin();
i != this->Configurations.end(); ++i)
for(std::vector<std::string>::const_iterator i = configs.begin();
i != configs.end(); ++i)
{
const char* propertyValue =
target->GetFeature("EXCLUDE_FROM_DEFAULT_BUILD", i->c_str());

View File

@ -78,11 +78,6 @@ public:
*/
virtual void OutputSLNFile();
/**
* Get the list of configurations
*/
std::vector<std::string> *GetConfigurations();
///! Create a GUID or get an existing one.
void CreateGUID(const std::string& name);
std::string GetGUID(const std::string& name);
@ -134,6 +129,7 @@ protected:
cmTarget const&t);
virtual void WriteProjectConfigurations(
std::ostream& fout, const std::string& name, cmTarget::TargetType type,
std::vector<std::string> const& configs,
const std::set<std::string>& configsPartOfDefaultBuild,
const std::string& platformMapping = "");
virtual void WriteSLNGlobalSections(std::ostream& fout,
@ -151,10 +147,9 @@ protected:
OrderedTargetDependSet const& projectTargets);
virtual void WriteTargetConfigurations(
std::ostream& fout,
std::vector<std::string> const& configs,
OrderedTargetDependSet const& projectTargets);
void GenerateConfigurations(cmMakefile* mf);
virtual void WriteExternalProject(std::ostream& fout,
const std::string& name,
const char* path,
@ -165,11 +160,11 @@ protected:
std::string ConvertToSolutionPath(const char* path);
std::set<std::string>
IsPartOfDefaultBuild(OrderedTargetDependSet const& projectTargets,
IsPartOfDefaultBuild(std::vector<std::string> const& configs,
OrderedTargetDependSet const& projectTargets,
cmTarget const* target);
bool IsDependedOn(OrderedTargetDependSet const& projectTargets,
cmTarget const* target);
std::vector<std::string> Configurations;
std::map<std::string, std::string> GUIDMap;
virtual void WriteFolders(std::ostream& fout);

View File

@ -375,11 +375,12 @@ void cmGlobalVisualStudio8Generator::Generate()
//----------------------------------------------------------------------------
void
cmGlobalVisualStudio8Generator
::WriteSolutionConfigurations(std::ostream& fout)
::WriteSolutionConfigurations(std::ostream& fout,
std::vector<std::string> const& configs)
{
fout << "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n";
for(std::vector<std::string>::iterator i = this->Configurations.begin();
i != this->Configurations.end(); ++i)
for(std::vector<std::string>::const_iterator i = configs.begin();
i != configs.end(); ++i)
{
fout << "\t\t" << *i << "|" << this->GetPlatformName()
<< " = " << *i << "|" << this->GetPlatformName() << "\n";
@ -392,12 +393,13 @@ void
cmGlobalVisualStudio8Generator
::WriteProjectConfigurations(
std::ostream& fout, const std::string& name, cmTarget::TargetType type,
std::vector<std::string> const& configs,
const std::set<std::string>& configsPartOfDefaultBuild,
std::string const& platformMapping)
{
std::string guid = this->GetGUID(name);
for(std::vector<std::string>::iterator i = this->Configurations.begin();
i != this->Configurations.end(); ++i)
for(std::vector<std::string>::const_iterator i = configs.begin();
i != configs.end(); ++i)
{
fout << "\t\t{" << guid << "}." << *i
<< "|" << this->GetPlatformName() << ".ActiveCfg = " << *i << "|"

View File

@ -81,9 +81,11 @@ protected:
static cmIDEFlagTable const* GetExtraFlagTableVS8();
virtual void WriteSLNHeader(std::ostream& fout);
virtual void WriteSolutionConfigurations(std::ostream& fout);
virtual void WriteSolutionConfigurations(
std::ostream& fout, std::vector<std::string> const& configs);
virtual void WriteProjectConfigurations(
std::ostream& fout, const std::string& name, cmTarget::TargetType type,
std::vector<std::string> const& configs,
const std::set<std::string>& configsPartOfDefaultBuild,
const std::string& platformMapping = "");
virtual bool ComputeTargetDepends();

View File

@ -339,17 +339,14 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
}
}
void cmLocalVisualStudio7Generator::WriteConfigurations(std::ostream& fout,
const std::string& libName,
cmTarget &target)
void cmLocalVisualStudio7Generator::WriteConfigurations(
std::ostream& fout, std::vector<std::string> const& configs,
const std::string& libName, cmTarget &target
)
{
std::vector<std::string> *configs =
static_cast<cmGlobalVisualStudio7Generator *>
(this->GlobalGenerator)->GetConfigurations();
fout << "\t<Configurations>\n";
for( std::vector<std::string>::iterator i = configs->begin();
i != configs->end(); ++i)
for (std::vector<std::string>::const_iterator i = configs.begin();
i != configs.end(); ++i)
{
this->WriteConfiguration(fout, i->c_str(), libName, target);
}
@ -1468,10 +1465,8 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout,
const std::string& libName,
cmTarget &target)
{
// get the configurations
std::vector<std::string> *configs =
static_cast<cmGlobalVisualStudio7Generator *>
(this->GlobalGenerator)->GetConfigurations();
std::vector<std::string> configs;
this->Makefile->GetConfigurations(configs);
// We may be modifying the source groups temporarily, so make a copy.
std::vector<cmSourceGroup> sourceGroups = this->Makefile->GetSourceGroups();
@ -1504,7 +1499,7 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout,
// open the project
this->WriteProjectStart(fout, libName, target, sourceGroups);
// write the configuration information
this->WriteConfigurations(fout, libName, target);
this->WriteConfigurations(fout, configs, libName, target);
fout << "\t<Files>\n";
@ -1561,7 +1556,7 @@ public:
cmLocalVisualStudio7GeneratorFCInfo(cmLocalVisualStudio7Generator* lg,
cmTarget& target,
cmSourceFile const& sf,
std::vector<std::string>* configs);
std::vector<std::string> const& configs);
std::map<std::string, cmLVS7GFileConfig> FileConfigMap;
};
@ -1569,7 +1564,7 @@ cmLocalVisualStudio7GeneratorFCInfo
::cmLocalVisualStudio7GeneratorFCInfo(cmLocalVisualStudio7Generator* lg,
cmTarget& target,
cmSourceFile const& sf,
std::vector<std::string>* configs)
std::vector<std::string> const& configs)
{
cmGeneratorTarget* gt =
lg->GetGlobalGenerator()->GetGeneratorTarget(&target);
@ -1580,8 +1575,8 @@ cmLocalVisualStudio7GeneratorFCInfo
}
// Compute per-source, per-config information.
for(std::vector<std::string>::iterator i = configs->begin();
i != configs->end(); ++i)
for(std::vector<std::string>::const_iterator i = configs.begin();
i != configs.end(); ++i)
{
std::string configUpper = cmSystemTools::UpperCase(*i);
cmLVS7GFileConfig fc;
@ -1691,13 +1686,13 @@ std::string
cmLocalVisualStudio7Generator
::ComputeLongestObjectDirectory(cmTarget& target) const
{
std::vector<std::string> *configs =
static_cast<cmGlobalVisualStudio7Generator *>
(this->GlobalGenerator)->GetConfigurations();
std::vector<std::string> configs;
target.GetMakefile()->GetConfigurations(configs);
// Compute the maximum length configuration name.
std::string config_max;
for(std::vector<std::string>::iterator i = configs->begin();
i != configs->end(); ++i)
for(std::vector<std::string>::iterator i = configs.begin();
i != configs.end(); ++i)
{
if(i->size() > config_max.size())
{
@ -1721,7 +1716,7 @@ cmLocalVisualStudio7Generator
bool cmLocalVisualStudio7Generator
::WriteGroup(const cmSourceGroup *sg, cmTarget& target,
std::ostream &fout, const std::string& libName,
std::vector<std::string> *configs)
std::vector<std::string> const& configs)
{
cmGlobalVisualStudio7Generator* gg =
static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator);
@ -1771,7 +1766,8 @@ bool cmLocalVisualStudio7Generator
fout << "\t\t\t\tRelativePath=\"" << d << "\">\n";
if(cmCustomCommand const* command = (*sf)->GetCustomCommand())
{
this->WriteCustomRule(fout, source.c_str(), *command, fcinfo);
this->WriteCustomRule(fout, configs, source.c_str(),
*command, fcinfo);
}
else if(!fcinfo.FileConfigMap.empty())
{
@ -1887,6 +1883,7 @@ bool cmLocalVisualStudio7Generator
void cmLocalVisualStudio7Generator::
WriteCustomRule(std::ostream& fout,
std::vector<std::string> const& configs,
const char* source,
const cmCustomCommand& command,
FCInfo& fcinfo)
@ -1895,10 +1892,6 @@ WriteCustomRule(std::ostream& fout,
static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator);
// Write the rule for each configuration.
std::vector<std::string>::iterator i;
std::vector<std::string> *configs =
static_cast<cmGlobalVisualStudio7Generator *>
(this->GlobalGenerator)->GetConfigurations();
const char* compileTool = "VCCLCompilerTool";
if(this->FortranProject)
{
@ -1909,7 +1902,8 @@ WriteCustomRule(std::ostream& fout,
{
customTool = "VFCustomBuildTool";
}
for(i = configs->begin(); i != configs->end(); ++i)
for (std::vector<std::string>::const_iterator i = configs.begin();
i != configs.end(); ++i)
{
cmCustomCommandGenerator ccg(command, *i, this->Makefile);
cmLVS7GFileConfig const& fc = fcinfo.FileConfigMap[*i];

View File

@ -77,6 +77,7 @@ private:
void WriteVCProjFile(std::ostream& fout, const std::string& libName,
cmTarget &tgt);
void WriteConfigurations(std::ostream& fout,
std::vector<std::string> const& configs,
const std::string& libName, cmTarget &tgt);
void WriteConfiguration(std::ostream& fout,
const std::string& configName,
@ -101,6 +102,7 @@ private:
void WriteVCProjEndGroup(std::ostream& fout);
void WriteCustomRule(std::ostream& fout,
std::vector<std::string> const& configs,
const char* source,
const cmCustomCommand& command,
FCInfo& fcinfo);
@ -109,7 +111,7 @@ private:
bool WriteGroup(const cmSourceGroup *sg,
cmTarget& target, std::ostream &fout,
const std::string& libName,
std::vector<std::string> *configs);
std::vector<std::string> const& configs);
friend class cmLocalVisualStudio7GeneratorFCInfo;
friend class cmLocalVisualStudio7GeneratorInternals;

View File

@ -173,6 +173,7 @@ cmVisualStudio10TargetGenerator(cmTarget* target,
this->Target = target;
this->GeneratorTarget = gg->GetGeneratorTarget(target);
this->Makefile = target->GetMakefile();
this->Makefile->GetConfigurations(this->Configurations);
this->LocalGenerator =
(cmLocalVisualStudio7Generator*)
this->Makefile->GetLocalGenerator();
@ -525,10 +526,9 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup()
std::string hFileName = obj.substr(0, obj.find_last_of(".")) + ".h";
(*this->BuildFileStream) << hFileName << "</DependentUpon>\n";
std::vector<std::string> const * configs =
this->GlobalGenerator->GetConfigurations();
for(std::vector<std::string>::const_iterator i = configs->begin();
i != configs->end(); ++i)
for(std::vector<std::string>::const_iterator
i = this->Configurations.begin();
i != this->Configurations.end(); ++i)
{
this->WritePlatformConfigTag("LogicalName", i->c_str(), 3);
if(this->Target->GetProperty("VS_GLOBAL_ROOTNAMESPACE"))
@ -629,11 +629,9 @@ void cmVisualStudio10TargetGenerator::WriteWinRTReferences()
void cmVisualStudio10TargetGenerator::WriteProjectConfigurations()
{
this->WriteString("<ItemGroup Label=\"ProjectConfigurations\">\n", 1);
std::vector<std::string> *configs =
static_cast<cmGlobalVisualStudio7Generator *>
(this->GlobalGenerator)->GetConfigurations();
for(std::vector<std::string>::iterator i = configs->begin();
i != configs->end(); ++i)
for(std::vector<std::string>::const_iterator
i = this->Configurations.begin();
i != this->Configurations.end(); ++i)
{
this->WriteString("<ProjectConfiguration Include=\"", 2);
(*this->BuildFileStream ) << *i << "|" << this->Platform << "\">\n";
@ -649,11 +647,9 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurations()
void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
{
std::vector<std::string> *configs =
static_cast<cmGlobalVisualStudio7Generator *>
(this->GlobalGenerator)->GetConfigurations();
for(std::vector<std::string>::iterator i = configs->begin();
i != configs->end(); ++i)
for(std::vector<std::string>::const_iterator
i = this->Configurations.begin();
i != this->Configurations.end(); ++i)
{
this->WritePlatformConfigTag("PropertyGroup",
i->c_str(),
@ -864,14 +860,12 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile const* source,
}
}
cmLocalVisualStudio7Generator* lg = this->LocalGenerator;
std::vector<std::string> *configs =
static_cast<cmGlobalVisualStudio7Generator *>
(this->GlobalGenerator)->GetConfigurations();
this->WriteSource("CustomBuild", source, ">\n");
for(std::vector<std::string>::iterator i = configs->begin();
i != configs->end(); ++i)
for(std::vector<std::string>::const_iterator
i = this->Configurations.begin();
i != this->Configurations.end(); ++i)
{
cmCustomCommandGenerator ccg(command, *i, this->Makefile);
std::string comment = lg->ConstructComment(ccg);
@ -1340,8 +1334,6 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
if(!deployContent.empty())
{
std::vector<std::string> const* configs =
this->GlobalGenerator->GetConfigurations();
cmGeneratorExpression ge;
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
ge.Parse(deployContent);
@ -1353,13 +1345,14 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
<< "\\%(FileName)%(Extension)";
this->WriteString("</Link>\n", 0);
}
for(size_t i = 0; i != configs->size(); ++i)
for(size_t i = 0; i != this->Configurations.size(); ++i)
{
if(0 == strcmp(cge->Evaluate(this->Makefile, (*configs)[i]), "1"))
if(0 == strcmp(cge->Evaluate(this->Makefile,
this->Configurations[i]), "1"))
{
this->WriteString("<DeploymentContent Condition=\""
"'$(Configuration)|$(Platform)'=='", 3);
(*this->BuildFileStream) << (*configs)[i] << "|"
(*this->BuildFileStream) << this->Configurations[i] << "|"
<< this->Platform << "'\">true";
this->WriteString("</DeploymentContent>\n", 0);
}
@ -1367,7 +1360,7 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
{
this->WriteString("<ExcludedFromBuild Condition=\""
"'$(Configuration)|$(Platform)'=='", 3);
(*this->BuildFileStream) << (*configs)[i] << "|"
(*this->BuildFileStream) << this->Configurations[i] << "|"
<< this->Platform << "'\">true";
this->WriteString("</ExcludedFromBuild>\n", 0);
}
@ -1655,11 +1648,9 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
(*this->BuildFileStream )
<< "$(IntDir)/" << objectName << "</ObjectFileName>\n";
}
std::vector<std::string> *configs =
static_cast<cmGlobalVisualStudio7Generator *>
(this->GlobalGenerator)->GetConfigurations();
for( std::vector<std::string>::iterator config = configs->begin();
config != configs->end(); ++config)
for(std::vector<std::string>::const_iterator
config = this->Configurations.begin();
config != this->Configurations.end(); ++config)
{
std::string configUpper = cmSystemTools::UpperCase(*config);
std::string configDefines = defines;
@ -1737,11 +1728,9 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions()
this->WriteString("<PropertyGroup>\n", 2);
this->WriteString("<_ProjectFileVersion>10.0.20506.1"
"</_ProjectFileVersion>\n", 3);
std::vector<std::string> *configs =
static_cast<cmGlobalVisualStudio7Generator *>
(this->GlobalGenerator)->GetConfigurations();
for(std::vector<std::string>::iterator config = configs->begin();
config != configs->end(); ++config)
for(std::vector<std::string>::const_iterator
config = this->Configurations.begin();
config != this->Configurations.end(); ++config)
{
if(ttype >= cmTarget::UTILITY)
{
@ -1855,10 +1844,9 @@ OutputLinkIncremental(std::string const& configName)
//----------------------------------------------------------------------------
bool cmVisualStudio10TargetGenerator::ComputeClOptions()
{
std::vector<std::string> const* configs =
this->GlobalGenerator->GetConfigurations();
for(std::vector<std::string>::const_iterator i = configs->begin();
i != configs->end(); ++i)
for(std::vector<std::string>::const_iterator
i = this->Configurations.begin();
i != this->Configurations.end(); ++i)
{
if(!this->ComputeClOptions(*i))
{
@ -2026,10 +2014,9 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
//----------------------------------------------------------------------------
bool cmVisualStudio10TargetGenerator::ComputeRcOptions()
{
std::vector<std::string> const* configs =
this->GlobalGenerator->GetConfigurations();
for(std::vector<std::string>::const_iterator i = configs->begin();
i != configs->end(); ++i)
for(std::vector<std::string>::const_iterator
i = this->Configurations.begin();
i != this->Configurations.end(); ++i)
{
if(!this->ComputeRcOptions(*i))
{
@ -2092,10 +2079,9 @@ bool cmVisualStudio10TargetGenerator::ComputeMasmOptions()
{
return true;
}
std::vector<std::string> const* configs =
this->GlobalGenerator->GetConfigurations();
for(std::vector<std::string>::const_iterator i = configs->begin();
i != configs->end(); ++i)
for(std::vector<std::string>::const_iterator
i = this->Configurations.begin();
i != this->Configurations.end(); ++i)
{
if(!this->ComputeMasmOptions(*i))
{
@ -2239,10 +2225,9 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions()
this->Target->GetType() == cmTarget::SHARED_LIBRARY ||
this->Target->GetType() == cmTarget::MODULE_LIBRARY)
{
std::vector<std::string> const* configs =
this->GlobalGenerator->GetConfigurations();
for(std::vector<std::string>::const_iterator i = configs->begin();
i != configs->end(); ++i)
for(std::vector<std::string>::const_iterator
i = this->Configurations.begin();
i != this->Configurations.end(); ++i)
{
if(!this->ComputeLinkOptions(*i))
{
@ -2591,11 +2576,9 @@ WriteMidlOptions(std::string const& /*config*/,
void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups()
{
std::vector<std::string> *configs =
static_cast<cmGlobalVisualStudio7Generator *>
(this->GlobalGenerator)->GetConfigurations();
for(std::vector<std::string>::iterator i = configs->begin();
i != configs->end(); ++i)
for(std::vector<std::string>::const_iterator
i = this->Configurations.begin();
i != this->Configurations.end(); ++i)
{
std::vector<std::string> includes;
this->LocalGenerator->GetIncludeDirectories(includes,

View File

@ -137,6 +137,7 @@ private:
OptionsMap MasmOptions;
OptionsMap LinkOptions;
std::string PathToVcxproj;
std::vector<std::string> Configurations;
cmTarget* Target;
cmGeneratorTarget* GeneratorTarget;
cmMakefile* Makefile;