VS: Set CMAKE_VS_PLATFORM_NAME for VS7 and VS71 too

Move the code which sets CMAKE_VS_PLATFORM_NAME from
cmGlobalVisualStudio8Generator to cmGlobalVisualStudio7Generator.
This commit is contained in:
Patrick Gansterer 2013-08-05 12:49:32 +02:00
parent 60e568cf79
commit 4b15dc855d
6 changed files with 35 additions and 29 deletions

View File

@ -112,9 +112,6 @@ Id flags: ${testflags}
set(id_arch ${CMAKE_VS_PLATFORM_NAME}) set(id_arch ${CMAKE_VS_PLATFORM_NAME})
set(id_lang "${lang}") set(id_lang "${lang}")
set(id_cl cl.exe) set(id_cl cl.exe)
if(NOT id_arch)
set(id_arch Win32)
endif()
if(NOT "${vs_version}" VERSION_LESS 10) if(NOT "${vs_version}" VERSION_LESS 10)
set(v 10) set(v 10)
set(ext vcxproj) set(ext vcxproj)

View File

@ -281,20 +281,20 @@ void cmGlobalVisualStudio71Generator
const std::set<std::string>& configsPartOfDefaultBuild, const std::set<std::string>& configsPartOfDefaultBuild,
const char* platformMapping) const char* platformMapping)
{ {
const char* platformName =
platformMapping ? platformMapping : this->GetPlatformName();
std::string guid = this->GetGUID(name); std::string guid = this->GetGUID(name);
for(std::vector<std::string>::iterator i = this->Configurations.begin(); for(std::vector<std::string>::iterator i = this->Configurations.begin();
i != this->Configurations.end(); ++i) i != this->Configurations.end(); ++i)
{ {
fout << "\t\t{" << guid << "}." << *i fout << "\t\t{" << guid << "}." << *i
<< ".ActiveCfg = " << *i << "|" << ".ActiveCfg = " << *i << "|" << platformName << std::endl;
<< (platformMapping ? platformMapping : "Win32") << std::endl;
std::set<std::string>::const_iterator std::set<std::string>::const_iterator
ci = configsPartOfDefaultBuild.find(*i); ci = configsPartOfDefaultBuild.find(*i);
if(!(ci == configsPartOfDefaultBuild.end())) if(!(ci == configsPartOfDefaultBuild.end()))
{ {
fout << "\t\t{" << guid << "}." << *i fout << "\t\t{" << guid << "}." << *i
<< ".Build.0 = " << *i << "|" << ".Build.0 = " << *i << "|" << platformName << std::endl;
<< (platformMapping ? platformMapping : "Win32") << std::endl;
} }
} }
} }

View File

@ -144,6 +144,27 @@ cmLocalGenerator *cmGlobalVisualStudio7Generator::CreateLocalGenerator()
return lg; return lg;
} }
//----------------------------------------------------------------------------
void cmGlobalVisualStudio7Generator::AddPlatformDefinitions(cmMakefile* mf)
{
cmGlobalVisualStudioGenerator::AddPlatformDefinitions(mf);
mf->AddDefinition("CMAKE_VS_PLATFORM_NAME", this->GetPlatformName());
}
//----------------------------------------------------------------------------
const char* cmGlobalVisualStudio7Generator::GetPlatformName() const
{
if (!this->PlatformName.empty())
{
return this->PlatformName.c_str();
}
if (this->ArchitectureId == "X86")
{
return "Win32";
}
return this->ArchitectureId.c_str();
}
void cmGlobalVisualStudio7Generator::GenerateConfigurations(cmMakefile* mf) void cmGlobalVisualStudio7Generator::GenerateConfigurations(cmMakefile* mf)
{ {
// process the configurations // process the configurations
@ -601,20 +622,20 @@ void cmGlobalVisualStudio7Generator
const std::set<std::string>& configsPartOfDefaultBuild, const std::set<std::string>& configsPartOfDefaultBuild,
const char* platformMapping) const char* platformMapping)
{ {
const char* platformName =
platformMapping ? platformMapping : this->GetPlatformName();
std::string guid = this->GetGUID(name); std::string guid = this->GetGUID(name);
for(std::vector<std::string>::iterator i = this->Configurations.begin(); for(std::vector<std::string>::iterator i = this->Configurations.begin();
i != this->Configurations.end(); ++i) i != this->Configurations.end(); ++i)
{ {
fout << "\t\t{" << guid << "}." << *i fout << "\t\t{" << guid << "}." << *i
<< ".ActiveCfg = " << *i << "|" << ".ActiveCfg = " << *i << "|" << platformName << "\n";
<< (platformMapping ? platformMapping : "Win32") << "\n";
std::set<std::string>::const_iterator std::set<std::string>::const_iterator
ci = configsPartOfDefaultBuild.find(*i); ci = configsPartOfDefaultBuild.find(*i);
if(!(ci == configsPartOfDefaultBuild.end())) if(!(ci == configsPartOfDefaultBuild.end()))
{ {
fout << "\t\t{" << guid << "}." << *i fout << "\t\t{" << guid << "}." << *i
<< ".Build.0 = " << *i << "|" << ".Build.0 = " << *i << "|" << platformName << "\n";
<< (platformMapping ? platformMapping : "Win32") << "\n";
} }
} }
} }

View File

@ -36,9 +36,14 @@ public:
return cmGlobalVisualStudio7Generator::GetActualName();} return cmGlobalVisualStudio7Generator::GetActualName();}
static const char* GetActualName() {return "Visual Studio 7";} static const char* GetActualName() {return "Visual Studio 7";}
///! Get the name for the platform.
const char* GetPlatformName() const;
///! Create a local generator appropriate to this Global Generator ///! Create a local generator appropriate to this Global Generator
virtual cmLocalGenerator *CreateLocalGenerator(); virtual cmLocalGenerator *CreateLocalGenerator();
virtual void AddPlatformDefinitions(cmMakefile* mf);
/** Get the documentation entry for this generator. */ /** Get the documentation entry for this generator. */
static void GetDocumentation(cmDocumentationEntry& entry); static void GetDocumentation(cmDocumentationEntry& entry);
@ -153,6 +158,7 @@ protected:
// Set during OutputSLNFile with the name of the current project. // Set during OutputSLNFile with the name of the current project.
// There is one SLN file per project. // There is one SLN file per project.
std::string CurrentProject; std::string CurrentProject;
std::string PlatformName;
}; };
#define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK" #define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK"

View File

@ -112,20 +112,6 @@ cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator(
} }
} }
//----------------------------------------------------------------------------
const char* cmGlobalVisualStudio8Generator::GetPlatformName() const
{
if (!this->PlatformName.empty())
{
return this->PlatformName.c_str();
}
if (this->ArchitectureId == "X86")
{
return "Win32";
}
return this->ArchitectureId.c_str();
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
///! Create a local generator appropriate to this Global Generator ///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *cmGlobalVisualStudio8Generator::CreateLocalGenerator() cmLocalGenerator *cmGlobalVisualStudio8Generator::CreateLocalGenerator()
@ -142,7 +128,6 @@ cmLocalGenerator *cmGlobalVisualStudio8Generator::CreateLocalGenerator()
void cmGlobalVisualStudio8Generator::AddPlatformDefinitions(cmMakefile* mf) void cmGlobalVisualStudio8Generator::AddPlatformDefinitions(cmMakefile* mf)
{ {
cmGlobalVisualStudio71Generator::AddPlatformDefinitions(mf); cmGlobalVisualStudio71Generator::AddPlatformDefinitions(mf);
mf->AddDefinition("CMAKE_VS_PLATFORM_NAME", this->GetPlatformName());
if(this->TargetsWindowsCE()) if(this->TargetsWindowsCE())
{ {

View File

@ -30,8 +30,6 @@ public:
///! Get the name for the generator. ///! Get the name for the generator.
virtual const char* GetName() const {return this->Name.c_str();} virtual const char* GetName() const {return this->Name.c_str();}
const char* GetPlatformName() const;
/** Get the documentation entry for this generator. */ /** Get the documentation entry for this generator. */
static void GetDocumentation(cmDocumentationEntry& entry); static void GetDocumentation(cmDocumentationEntry& entry);
@ -87,7 +85,6 @@ protected:
const char* path, cmTarget &t); const char* path, cmTarget &t);
std::string Name; std::string Name;
std::string PlatformName;
std::string WindowsCEVersion; std::string WindowsCEVersion;
private: private: