From 4b15dc855d8f5347169391b6a1a86320f2efaae4 Mon Sep 17 00:00:00 2001 From: Patrick Gansterer Date: Mon, 5 Aug 2013 12:49:32 +0200 Subject: [PATCH] VS: Set CMAKE_VS_PLATFORM_NAME for VS7 and VS71 too Move the code which sets CMAKE_VS_PLATFORM_NAME from cmGlobalVisualStudio8Generator to cmGlobalVisualStudio7Generator. --- Modules/CMakeDetermineCompilerId.cmake | 3 --- Source/cmGlobalVisualStudio71Generator.cxx | 8 +++--- Source/cmGlobalVisualStudio7Generator.cxx | 29 +++++++++++++++++++--- Source/cmGlobalVisualStudio7Generator.h | 6 +++++ Source/cmGlobalVisualStudio8Generator.cxx | 15 ----------- Source/cmGlobalVisualStudio8Generator.h | 3 --- 6 files changed, 35 insertions(+), 29 deletions(-) diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 1ecd052b6..dc70dc613 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -112,9 +112,6 @@ Id flags: ${testflags} set(id_arch ${CMAKE_VS_PLATFORM_NAME}) set(id_lang "${lang}") set(id_cl cl.exe) - if(NOT id_arch) - set(id_arch Win32) - endif() if(NOT "${vs_version}" VERSION_LESS 10) set(v 10) set(ext vcxproj) diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index 2494f559c..24ca0b117 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -281,20 +281,20 @@ void cmGlobalVisualStudio71Generator const std::set& configsPartOfDefaultBuild, const char* platformMapping) { + const char* platformName = + platformMapping ? platformMapping : this->GetPlatformName(); std::string guid = this->GetGUID(name); for(std::vector::iterator i = this->Configurations.begin(); i != this->Configurations.end(); ++i) { fout << "\t\t{" << guid << "}." << *i - << ".ActiveCfg = " << *i << "|" - << (platformMapping ? platformMapping : "Win32") << std::endl; + << ".ActiveCfg = " << *i << "|" << platformName << std::endl; std::set::const_iterator ci = configsPartOfDefaultBuild.find(*i); if(!(ci == configsPartOfDefaultBuild.end())) { fout << "\t\t{" << guid << "}." << *i - << ".Build.0 = " << *i << "|" - << (platformMapping ? platformMapping : "Win32") << std::endl; + << ".Build.0 = " << *i << "|" << platformName << std::endl; } } } diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 9a34ecff0..812659ef6 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -144,6 +144,27 @@ cmLocalGenerator *cmGlobalVisualStudio7Generator::CreateLocalGenerator() 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) { // process the configurations @@ -601,20 +622,20 @@ void cmGlobalVisualStudio7Generator const std::set& configsPartOfDefaultBuild, const char* platformMapping) { + const char* platformName = + platformMapping ? platformMapping : this->GetPlatformName(); std::string guid = this->GetGUID(name); for(std::vector::iterator i = this->Configurations.begin(); i != this->Configurations.end(); ++i) { fout << "\t\t{" << guid << "}." << *i - << ".ActiveCfg = " << *i << "|" - << (platformMapping ? platformMapping : "Win32") << "\n"; + << ".ActiveCfg = " << *i << "|" << platformName << "\n"; std::set::const_iterator ci = configsPartOfDefaultBuild.find(*i); if(!(ci == configsPartOfDefaultBuild.end())) { fout << "\t\t{" << guid << "}." << *i - << ".Build.0 = " << *i << "|" - << (platformMapping ? platformMapping : "Win32") << "\n"; + << ".Build.0 = " << *i << "|" << platformName << "\n"; } } } diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 3ebb408a3..dfa8547f0 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -36,9 +36,14 @@ public: return cmGlobalVisualStudio7Generator::GetActualName();} 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 virtual cmLocalGenerator *CreateLocalGenerator(); + virtual void AddPlatformDefinitions(cmMakefile* mf); + /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); @@ -153,6 +158,7 @@ protected: // Set during OutputSLNFile with the name of the current project. // There is one SLN file per project. std::string CurrentProject; + std::string PlatformName; }; #define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK" diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 864e8db02..558b6b69d 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -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 cmLocalGenerator *cmGlobalVisualStudio8Generator::CreateLocalGenerator() @@ -142,7 +128,6 @@ cmLocalGenerator *cmGlobalVisualStudio8Generator::CreateLocalGenerator() void cmGlobalVisualStudio8Generator::AddPlatformDefinitions(cmMakefile* mf) { cmGlobalVisualStudio71Generator::AddPlatformDefinitions(mf); - mf->AddDefinition("CMAKE_VS_PLATFORM_NAME", this->GetPlatformName()); if(this->TargetsWindowsCE()) { diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index bcbd7a0bd..262acadf5 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -30,8 +30,6 @@ public: ///! Get the name for the generator. virtual const char* GetName() const {return this->Name.c_str();} - const char* GetPlatformName() const; - /** Get the documentation entry for this generator. */ static void GetDocumentation(cmDocumentationEntry& entry); @@ -87,7 +85,6 @@ protected: const char* path, cmTarget &t); std::string Name; - std::string PlatformName; std::string WindowsCEVersion; private: