summaryrefslogtreecommitdiff
path: root/Source/cmGlobalVisualStudio71Generator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-05-20 13:55:21 -0400
committerBrad King <brad.king@kitware.com>2015-05-21 09:06:49 -0400
commit2f4bb4e9b033e1ac3daf63c0dc7c588ccbd70bf4 (patch)
tree6821eeb8c45ada58e8afe5209a4ccc16d629a9cf /Source/cmGlobalVisualStudio71Generator.cxx
parent3541fc73a12a52f87a2faa9790a65651658162d8 (diff)
downloadcmake-2f4bb4e9b033e1ac3daf63c0dc7c588ccbd70bf4.tar.gz
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.
Diffstat (limited to 'Source/cmGlobalVisualStudio71Generator.cxx')
-rw-r--r--Source/cmGlobalVisualStudio71Generator.cxx19
1 files changed, 12 insertions, 7 deletions
diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx
index e3636bbe79..80858b4e2f 100644
--- a/Source/cmGlobalVisualStudio71Generator.cxx
+++ b/Source/cmGlobalVisualStudio71Generator.cxx
@@ -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;