Browse Source

VS: Set CMAKE_VS_PLATFORM_NAME for VS7 and VS71 too

Move the code which sets CMAKE_VS_PLATFORM_NAME from
cmGlobalVisualStudio8Generator to cmGlobalVisualStudio7Generator.
Patrick Gansterer 12 years ago
parent
commit
4b15dc855d

+ 0 - 3
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)

+ 4 - 4
Source/cmGlobalVisualStudio71Generator.cxx

@@ -281,20 +281,20 @@ void cmGlobalVisualStudio71Generator
   const std::set<std::string>& configsPartOfDefaultBuild,
   const char* platformMapping)
 {
+  const char* platformName =
+    platformMapping ? platformMapping : this->GetPlatformName();
   std::string guid = this->GetGUID(name);
   for(std::vector<std::string>::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<std::string>::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;
       }
     }
 }

+ 25 - 4
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<std::string>& configsPartOfDefaultBuild,
   const char* platformMapping)
 {
+  const char* platformName =
+    platformMapping ? platformMapping : this->GetPlatformName();
   std::string guid = this->GetGUID(name);
   for(std::vector<std::string>::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<std::string>::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";
       }
     }
 }

+ 6 - 0
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"

+ 0 - 15
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())
   {

+ 0 - 3
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: