summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalVisualStudio7Generator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-05-20 17:55:21 (GMT)
committerBrad King <brad.king@kitware.com>2015-05-21 13:06:49 (GMT)
commit2f4bb4e9b033e1ac3daf63c0dc7c588ccbd70bf4 (patch)
tree6821eeb8c45ada58e8afe5209a4ccc16d629a9cf /Source/cmLocalVisualStudio7Generator.cxx
parent3541fc73a12a52f87a2faa9790a65651658162d8 (diff)
downloadCMake-2f4bb4e9b033e1ac3daf63c0dc7c588ccbd70bf4.zip
CMake-2f4bb4e9b033e1ac3daf63c0dc7c588ccbd70bf4.tar.gz
CMake-2f4bb4e9b033e1ac3daf63c0dc7c588ccbd70bf4.tar.bz2
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/cmLocalVisualStudio7Generator.cxx')
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx54
1 files changed, 24 insertions, 30 deletions
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 05556d8..d2fb970 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -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];