[cmake-commits] king committed cmGlobalVisualStudio71Generator.cxx 1.36 1.37 cmGlobalVisualStudio7Generator.cxx 1.80 1.81 cmGlobalVisualStudio7Generator.h 1.40 1.41 cmGlobalVisualStudio8Generator.cxx 1.16 1.17 cmGlobalVisualStudio8Generator.h 1.8 1.9 cmGlobalVisualStudio8Win64Generator.cxx 1.2 1.3 cmLocalVisualStudio7Generator.cxx 1.178 1.179 cmLocalVisualStudio7Generator.h 1.35 1.36

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Mar 12 11:35:13 EST 2007


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv18843/Source

Modified Files:
	cmGlobalVisualStudio71Generator.cxx 
	cmGlobalVisualStudio7Generator.cxx 
	cmGlobalVisualStudio7Generator.h 
	cmGlobalVisualStudio8Generator.cxx 
	cmGlobalVisualStudio8Generator.h 
	cmGlobalVisualStudio8Win64Generator.cxx 
	cmLocalVisualStudio7Generator.cxx 
	cmLocalVisualStudio7Generator.h 
Log Message:
BUG: Split precompiled header flags into a separate per-global-generator flag map.  This is needed because the flag mappings differ across VS IDE versions.  This fixes bug#3512 for VS8 where as the previous fix only worked for VS7.


Index: cmLocalVisualStudio7Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio7Generator.cxx,v
retrieving revision 1.178
retrieving revision 1.179
diff -u -d -r1.178 -r1.179
--- cmLocalVisualStudio7Generator.cxx	9 Mar 2007 14:30:16 -0000	1.178
+++ cmLocalVisualStudio7Generator.cxx	12 Mar 2007 16:35:11 -0000	1.179
@@ -28,11 +28,14 @@
 
 #include <ctype.h> // for isspace
 
+extern cmVS7FlagTable cmLocalVisualStudio7GeneratorFlagTable[];
+
 //----------------------------------------------------------------------------
 cmLocalVisualStudio7Generator::cmLocalVisualStudio7Generator()
 {
   this->Version = 7;
   this->PlatformName = "Win32";
+  this->ExtraFlagTable = 0;
 }
 
 cmLocalVisualStudio7Generator::~cmLocalVisualStudio7Generator()
@@ -255,26 +258,6 @@
   fout << "\t</Configurations>\n";
 }
 
-// This is a table mapping XML tag IDE names to command line options
-struct cmVS7FlagTable
-{
-  const char* IDEName;  // name used in the IDE xml file
-  const char* commandFlag; // command line flag
-  const char* comment;     // comment
-  const char* value; // string value
-  unsigned int special; // flags for special handling requests
-  enum
-  {
-    UserValue    = (1<<0), // flag contains a user-specified value
-    UserIgnored  = (1<<1), // ignore any user value
-    UserRequired = (1<<2), // match only when user value is non-empty
-    Continue     = (1<<3), // continue looking for matching entries
-
-    UserValueIgnored  = UserValue | UserIgnored,
-    UserValueRequired = UserValue | UserRequired
-  };
-};
-
 // fill the table here currently the comment field is not used for
 // anything other than documentation NOTE: Make sure the longer
 // commandFlag comes FIRST!
@@ -334,16 +317,10 @@
    cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
   {"PrecompiledHeaderThrough", "Yc", "Precompiled Header Name", "",
    cmVS7FlagTable::UserValueRequired},
-  {"UsePrecompiledHeader", "YX", "Automatically Generate", "2",
-   cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
-  {"PrecompiledHeaderThrough", "YX", "Precompiled Header Name", "",
-   cmVS7FlagTable::UserValueRequired},
-  {"UsePrecompiledHeader", "Yu", "Use Precompiled Header", "3",
-   cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
-  {"PrecompiledHeaderThrough", "Yu", "Precompiled Header Name", "",
-   cmVS7FlagTable::UserValueRequired},
   {"PrecompiledHeaderFile", "Fp", "Generated Precompiled Header", "",
    cmVS7FlagTable::UserValue},
+  // The YX and Yu options are in a per-global-generator table because
+  // their values differ based on the VS IDE version.
   {"ForcedIncludeFiles", "FI", "Forced include files", "",
    cmVS7FlagTable::UserValueRequired},
 
@@ -395,7 +372,8 @@
     Compiler,
     Linker
   };
-  cmLocalVisualStudio7GeneratorOptions(Tool tool);
+  cmLocalVisualStudio7GeneratorOptions(Tool tool,
+                                       cmVS7FlagTable const* extraTable = 0);
 
   // Store options from command line flags.
   void Parse(const char* flags);
@@ -441,7 +419,10 @@
 
   bool DoingDefine;
   cmVS7FlagTable const* FlagTable;
+  cmVS7FlagTable const* ExtraFlagTable;
   void HandleFlag(const char* flag);
+  bool CheckFlagTable(cmVS7FlagTable const* table, const char* flag,
+                      bool& flag_handled);
 };
 
 void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
@@ -527,7 +508,7 @@
   std::string defineFlags = this->Makefile->GetDefineFlags();
 
   // Construct a set of build options for this target.
-  Options targetOptions(Options::Compiler);
+  Options targetOptions(Options::Compiler, this->ExtraFlagTable);
   targetOptions.FixExceptionHandlingDefault();
   targetOptions.Parse(flags.c_str());
   targetOptions.Parse(defineFlags.c_str());
@@ -1204,7 +1185,7 @@
                << "\t\t\t\t\tName=\"" << aCompilerTool << "\"\n";
           if(!compileFlags.empty())
             {
-            Options fileOptions(Options::Compiler);
+            Options fileOptions(Options::Compiler, this->ExtraFlagTable);
             fileOptions.Parse(compileFlags.c_str());
             fileOptions.OutputAdditionalOptions(fout, "\t\t\t\t\t", "\n");
             fileOptions.OutputFlagMap(fout, "\t\t\t\t\t");
@@ -1648,8 +1629,9 @@
 
 //----------------------------------------------------------------------------
 cmLocalVisualStudio7GeneratorOptions
-::cmLocalVisualStudio7GeneratorOptions(Tool tool):
-  DoingDefine(false), FlagTable(0)
+::cmLocalVisualStudio7GeneratorOptions(Tool tool,
+                                       cmVS7FlagTable const* extraTable):
+  DoingDefine(false), FlagTable(0), ExtraFlagTable(extraTable)
 {
   // Choose the flag table for the requested tool.
   switch(tool)
@@ -1761,6 +1743,7 @@
   // Look for known arguments.
   if(flag[0] == '-' || flag[0] == '/')
     {
+    // Look for preprocessor definitions.
     if(flag[1] == 'D')
       {
       if(flag[2] == '\0')
@@ -1775,68 +1758,86 @@
         }
       return;
       }
-    else if(this->FlagTable)
+
+    // Look through the available flag tables.
+    bool flag_handled = false;
+    if(this->FlagTable &&
+       this->CheckFlagTable(this->FlagTable, flag, flag_handled))
       {
-      // Look for an entry in the flag table matching this flag.
-      bool flag_handled = false;
-      for(cmVS7FlagTable const* entry = this->FlagTable;
-          entry->IDEName; ++entry)
+      return;
+      }
+    if(this->ExtraFlagTable &&
+       this->CheckFlagTable(this->ExtraFlagTable, flag, flag_handled))
+      {
+      return;
+      }
+
+    // If any map entry handled the flag we are done.
+    if(flag_handled)
+      {
+      return;
+      }
+    }
+
+  // This option is not known.  Store it in the output flags.
+  this->FlagString += " ";
+  this->FlagString +=
+    cmSystemTools::EscapeWindowsShellArgument(flag,
+                                              cmsysSystem_Shell_Flag_VSIDE);
+}
+
+//----------------------------------------------------------------------------
+bool
+cmLocalVisualStudio7GeneratorOptions
+::CheckFlagTable(cmVS7FlagTable const* table, const char* flag,
+                 bool& flag_handled)
+{
+  // Look for an entry in the flag table matching this flag.
+  for(cmVS7FlagTable const* entry = table; entry->IDEName; ++entry)
+    {
+    bool entry_found = false;
+    if(entry->special & cmVS7FlagTable::UserValue)
+      {
+      // This flag table entry accepts a user-specified value.  If
+      // the entry specifies UserRequired we must match only if a
+      // non-empty value is given.
+      int n = static_cast<int>(strlen(entry->commandFlag));
+      if(strncmp(flag+1, entry->commandFlag, n) == 0 &&
+         (!(entry->special & cmVS7FlagTable::UserRequired) ||
+          static_cast<int>(strlen(flag+1)) > n))
         {
-        bool entry_found = false;
-        if(entry->special & cmVS7FlagTable::UserValue)
-          {
-          // This flag table entry accepts a user-specified value.  If
-          // the entry specifies UserRequired we must match only if a
-          // non-empty value is given.
-          int n = static_cast<int>(strlen(entry->commandFlag));
-          if(strncmp(flag+1, entry->commandFlag, n) == 0 &&
-             (!(entry->special & cmVS7FlagTable::UserRequired) ||
-              static_cast<int>(strlen(flag+1)) > n))
-            {
-            if(entry->special & cmVS7FlagTable::UserIgnored)
-              {
-              // Ignore the user-specified value.
-              this->FlagMap[entry->IDEName] = entry->value;
-              }
-            else
-              {
-              // Use the user-specified value.
-              this->FlagMap[entry->IDEName] = flag+1+n;
-              }
-            entry_found = true;
-            }
-          }
-        else if(strcmp(flag+1, entry->commandFlag) == 0)
+        if(entry->special & cmVS7FlagTable::UserIgnored)
           {
-          // This flag table entry provides a fixed value.
+          // Ignore the user-specified value.
           this->FlagMap[entry->IDEName] = entry->value;
-          entry_found = true;
           }
-
-        // If the flag has been handled by an entry not requesting a
-        // search continuation we are done.
-        if(entry_found && !(entry->special & cmVS7FlagTable::Continue))
+        else
           {
-          return;
+          // Use the user-specified value.
+          this->FlagMap[entry->IDEName] = flag+1+n;
           }
-
-        // If the entry was found the flag has been handled.
-        flag_handled = flag_handled || entry_found;
+        entry_found = true;
         }
+      }
+    else if(strcmp(flag+1, entry->commandFlag) == 0)
+      {
+      // This flag table entry provides a fixed value.
+      this->FlagMap[entry->IDEName] = entry->value;
+      entry_found = true;
+      }
 
-      // If any map entry handled the flag we are done.
-      if(flag_handled)
-        {
-        return;
-        }
+    // If the flag has been handled by an entry not requesting a
+    // search continuation we are done.
+    if(entry_found && !(entry->special & cmVS7FlagTable::Continue))
+      {
+      return true;
       }
+
+    // If the entry was found the flag has been handled.
+    flag_handled = flag_handled || entry_found;
     }
 
-  // This option is not known.  Store it in the output flags.
-  this->FlagString += " ";
-  this->FlagString +=
-    cmSystemTools::EscapeWindowsShellArgument(flag,
-                                              cmsysSystem_Shell_Flag_VSIDE);
+  return false;
 }
 
 //----------------------------------------------------------------------------

Index: cmLocalVisualStudio7Generator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmLocalVisualStudio7Generator.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- cmLocalVisualStudio7Generator.h	8 Mar 2007 19:57:28 -0000	1.35
+++ cmLocalVisualStudio7Generator.h	12 Mar 2007 16:35:11 -0000	1.36
@@ -72,6 +72,8 @@
   // return the source name for the object file
   virtual std::string GetSourceObjectName(cmSourceFile& );
 
+  void SetExtraFlagTable(cmVS7FlagTable const* table)
+    { this->ExtraFlagTable = table; }
 private:
   typedef cmLocalVisualStudio7GeneratorOptions Options;
   void ReadAndStoreExternalGUID(const char* name,
@@ -124,11 +126,32 @@
                   const char *libName, std::vector<std::string> *configs);
   virtual std::string GetTargetDirectory(cmTarget&);
 
+  cmVS7FlagTable const* ExtraFlagTable;
   std::vector<std::string> CreatedProjectNames;
   std::string ModuleDefinitionFile;
   int Version;
   std::string PlatformName; // Win32 or x64 
 };
 
+// This is a table mapping XML tag IDE names to command line options
+struct cmVS7FlagTable
+{
+  const char* IDEName;  // name used in the IDE xml file
+  const char* commandFlag; // command line flag
+  const char* comment;     // comment
+  const char* value; // string value
+  unsigned int special; // flags for special handling requests
+  enum
+  {
+    UserValue    = (1<<0), // flag contains a user-specified value
+    UserIgnored  = (1<<1), // ignore any user value
+    UserRequired = (1<<2), // match only when user value is non-empty
+    Continue     = (1<<3), // continue looking for matching entries
+
+    UserValueIgnored  = UserValue | UserIgnored,
+    UserValueRequired = UserValue | UserRequired
+  };
+};
+
 #endif
 

Index: cmGlobalVisualStudio8Generator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudio8Generator.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- cmGlobalVisualStudio8Generator.h	9 Nov 2006 14:57:23 -0000	1.8
+++ cmGlobalVisualStudio8Generator.h	12 Mar 2007 16:35:11 -0000	1.9
@@ -50,6 +50,7 @@
   virtual void Configure();
   virtual void Generate();
 protected:
+  static cmVS7FlagTable const* GetExtraFlagTableVS8();
   virtual void AddPlatformDefinitions(cmMakefile* mf);
   virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root,
                             std::vector<cmLocalGenerator*>& generators);

Index: cmGlobalVisualStudio8Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudio8Generator.cxx,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- cmGlobalVisualStudio8Generator.cxx	9 Nov 2006 14:57:23 -0000	1.16
+++ cmGlobalVisualStudio8Generator.cxx	12 Mar 2007 16:35:11 -0000	1.17
@@ -36,6 +36,7 @@
 {
   cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator;
   lg->SetVersion8();
+  lg->SetExtraFlagTable(this->GetExtraFlagTableVS8());
   lg->SetGlobalGenerator(this);
   return lg;
 }
@@ -245,3 +246,21 @@
       }
     }
 }
+
+//----------------------------------------------------------------------------
+static cmVS7FlagTable cmVS8ExtraFlagTable[] =
+{
+  // Precompiled header and related options.  Note that the
+  // UsePrecompiledHeader entries are marked as "Continue" so that the
+  // corresponding PrecompiledHeaderThrough entry can be found.
+  {"UsePrecompiledHeader", "Yu", "Use Precompiled Header", "2",
+   cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
+  {"PrecompiledHeaderThrough", "Yu", "Precompiled Header Name", "",
+   cmVS7FlagTable::UserValueRequired},
+  // There is no YX option in the VS8 IDE.
+  {0,0,0,0,0}
+};
+cmVS7FlagTable const* cmGlobalVisualStudio8Generator::GetExtraFlagTableVS8()
+{
+  return cmVS8ExtraFlagTable;
+}

Index: cmGlobalVisualStudio71Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudio71Generator.cxx,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- cmGlobalVisualStudio71Generator.cxx	12 Mar 2007 14:26:59 -0000	1.36
+++ cmGlobalVisualStudio71Generator.cxx	12 Mar 2007 16:35:11 -0000	1.37
@@ -35,6 +35,7 @@
 {
   cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator;
   lg->SetVersion71();
+  lg->SetExtraFlagTable(this->GetExtraFlagTableVS7());
   lg->SetGlobalGenerator(this);
   return lg;
 }

Index: cmGlobalVisualStudio8Win64Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudio8Win64Generator.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- cmGlobalVisualStudio8Win64Generator.cxx	11 May 2006 15:47:03 -0000	1.2
+++ cmGlobalVisualStudio8Win64Generator.cxx	12 Mar 2007 16:35:11 -0000	1.3
@@ -33,6 +33,7 @@
   cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator;
   lg->SetVersion8();
   lg->SetPlatformName(this->PlatformName.c_str());
+  lg->SetExtraFlagTable(this->GetExtraFlagTableVS8());
   lg->SetGlobalGenerator(this);
   return lg;
 }

Index: cmGlobalVisualStudio7Generator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudio7Generator.h,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- cmGlobalVisualStudio7Generator.h	9 Nov 2006 14:57:23 -0000	1.40
+++ cmGlobalVisualStudio7Generator.h	12 Mar 2007 16:35:11 -0000	1.41
@@ -20,6 +20,7 @@
 #include "cmGlobalGenerator.h"
 
 class cmTarget;
+struct cmVS7FlagTable;
 
 /** \class cmGlobalVisualStudio7Generator
  * \brief Write a Unix makefiles.
@@ -97,6 +98,7 @@
   virtual const char* GetCMakeCFGInitDirectory()  { return "$(OutDir)"; }
 
 protected:
+  static cmVS7FlagTable const* GetExtraFlagTableVS7();
   virtual void OutputSLNFile(cmLocalGenerator* root, 
                              std::vector<cmLocalGenerator*>& generators);
   virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root,

Index: cmGlobalVisualStudio7Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudio7Generator.cxx,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -d -r1.80 -r1.81
--- cmGlobalVisualStudio7Generator.cxx	12 Mar 2007 14:26:59 -0000	1.80
+++ cmGlobalVisualStudio7Generator.cxx	12 Mar 2007 16:35:11 -0000	1.81
@@ -21,7 +21,6 @@
 #include "cmMakefile.h"
 #include "cmake.h"
 
-
 cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator()
 {
   this->FindMakeProgramFile = "CMakeVS7FindMake.cmake";
@@ -138,7 +137,8 @@
 ///! Create a local generator appropriate to this Global Generator
 cmLocalGenerator *cmGlobalVisualStudio7Generator::CreateLocalGenerator()
 {
-  cmLocalGenerator *lg = new cmLocalVisualStudio7Generator;
+  cmLocalVisualStudio7Generator *lg = new cmLocalVisualStudio7Generator;
+  lg->SetExtraFlagTable(this->GetExtraFlagTableVS7());
   lg->SetGlobalGenerator(this);
   return lg;
 }
@@ -821,3 +821,24 @@
   // default is to be part of the build
   return true;
 }
+
+//----------------------------------------------------------------------------
+static cmVS7FlagTable cmVS7ExtraFlagTable[] =
+{
+  // Precompiled header and related options.  Note that the
+  // UsePrecompiledHeader entries are marked as "Continue" so that the
+  // corresponding PrecompiledHeaderThrough entry can be found.
+  {"UsePrecompiledHeader", "YX", "Automatically Generate", "2",
+   cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
+  {"PrecompiledHeaderThrough", "YX", "Precompiled Header Name", "",
+   cmVS7FlagTable::UserValueRequired},
+  {"UsePrecompiledHeader", "Yu", "Use Precompiled Header", "3",
+   cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
+  {"PrecompiledHeaderThrough", "Yu", "Precompiled Header Name", "",
+   cmVS7FlagTable::UserValueRequired},
+  {0,0,0,0,0}
+};
+cmVS7FlagTable const* cmGlobalVisualStudio7Generator::GetExtraFlagTableVS7()
+{
+  return cmVS7ExtraFlagTable;
+}



More information about the Cmake-commits mailing list