Sfoglia il codice sorgente

Merge topic 'fortran-linker-flags'

17b0fe03 Fix incremental linking setting for Fortran + VS
Brad King 11 anni fa
parent
commit
2fefe9e575

+ 16 - 2
Source/cmLocalVisualStudio7Generator.cxx

@@ -592,6 +592,15 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorLinkFlagTable[] =
   {0,0,0,0,0}
 };
 
+cmVS7FlagTable cmLocalVisualStudio7GeneratorFortranLinkFlagTable[] =
+{
+  {"LinkIncremental", "INCREMENTAL:NO", "link incremental",
+   "linkIncrementalNo", 0},
+  {"LinkIncremental", "INCREMENTAL:YES", "link incremental",
+   "linkIncrementalYes", 0},
+  {0,0,0,0,0}
+};
+
 //----------------------------------------------------------------------------
 // Helper class to write build event <Tool .../> elements.
 class cmLocalVisualStudio7Generator::EventWriter
@@ -1056,8 +1065,13 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
     extraLinkOptions += " ";
     extraLinkOptions += targetLinkFlags;
     }
-  Options linkOptions(this, Options::Linker,
-                      cmLocalVisualStudio7GeneratorLinkFlagTable);
+  Options linkOptions(this, Options::Linker);
+  if(this->FortranProject)
+    {
+    linkOptions.AddTable(cmLocalVisualStudio7GeneratorFortranLinkFlagTable);
+    }
+  linkOptions.AddTable(cmLocalVisualStudio7GeneratorLinkFlagTable);
+
   linkOptions.Parse(extraLinkOptions.c_str());
   if(!this->ModuleDefinitionFile.empty())
     {

+ 38 - 3
Source/cmVisualStudioGeneratorOptions.cxx

@@ -24,6 +24,26 @@ std::string cmVisualStudioGeneratorOptionsEscapeForXML(std::string ret)
   return ret;
 }
 
+//----------------------------------------------------------------------------
+cmVisualStudioGeneratorOptions
+::cmVisualStudioGeneratorOptions(cmLocalVisualStudioGenerator* lg,
+                                 Tool tool,
+                                 cmVisualStudio10TargetGenerator* g):
+  cmIDEOptions(),
+  LocalGenerator(lg), Version(lg->GetVersion()), CurrentTool(tool),
+  TargetGenerator(g)
+{
+  // Preprocessor definitions are not allowed for linker tools.
+  this->AllowDefine = (tool != Linker);
+
+  // Slash options are allowed for VS.
+  this->AllowSlash = true;
+
+  this->FortranRuntimeDebug = false;
+  this->FortranRuntimeDLL = false;
+  this->FortranRuntimeMT = false;
+}
+
 //----------------------------------------------------------------------------
 cmVisualStudioGeneratorOptions
 ::cmVisualStudioGeneratorOptions(cmLocalVisualStudioGenerator* lg,
@@ -36,9 +56,8 @@ cmVisualStudioGeneratorOptions
   TargetGenerator(g)
 {
   // Store the given flag tables.
-  cmIDEFlagTable const** ft = this->FlagTable;
-  if(table) { *ft++ = table; }
-  if(extraTable) { *ft++ = extraTable; }
+  this->AddTable(table);
+  this->AddTable(extraTable);
 
   // Preprocessor definitions are not allowed for linker tools.
   this->AllowDefine = (tool != Linker);
@@ -51,6 +70,22 @@ cmVisualStudioGeneratorOptions
   this->FortranRuntimeMT = false;
 }
 
+//----------------------------------------------------------------------------
+void cmVisualStudioGeneratorOptions::AddTable(cmVS7FlagTable const* table)
+{
+  if(table)
+    {
+    for(int i=0; i < FlagTableCount; ++i)
+      {
+      if (!this->FlagTable[i])
+        {
+        this->FlagTable[i] = table;
+        break;
+        }
+      }
+    }
+}
+
 //----------------------------------------------------------------------------
 void cmVisualStudioGeneratorOptions::FixExceptionHandlingDefault()
 {

+ 7 - 0
Source/cmVisualStudioGeneratorOptions.h

@@ -38,6 +38,13 @@ public:
                                  cmVS7FlagTable const* extraTable = 0,
                                  cmVisualStudio10TargetGenerator* g = 0);
 
+  cmVisualStudioGeneratorOptions(cmLocalVisualStudioGenerator* lg,
+                                 Tool tool,
+                                 cmVisualStudio10TargetGenerator* g = 0);
+
+  // Add a table of flags.
+  void AddTable(cmVS7FlagTable const* table);
+
   // Store options from command line flags.
   void Parse(const char* flags);
   void ParseFinish();