浏览代码

Generate proper Intel Fortran project version

The Intel Visual Fortran compiler plugin for MS Visual Studio may be one
of several versions of the Intel compiler.  This commit teaches CMake to
detect the plugin version and set the version number in .vfproj files.
See issue #9169.
Brad King 16 年之前
父节点
当前提交
2006e4a405
共有 1 个文件被更改,包括 13 次插入1 次删除
  1. 13 1
      Source/cmLocalVisualStudio7Generator.cxx

+ 13 - 1
Source/cmLocalVisualStudio7Generator.cxx

@@ -31,6 +31,9 @@
 
 #include <ctype.h> // for isspace
 
+// Package GUID of Intel Visual Fortran plugin to VS IDE
+#define CM_INTEL_PLUGIN_GUID "{B68A201D-CB9B-47AF-A52F-7EEC72E217E4}"
+
 static bool cmLVS6G_IsFAT(const char* dir);
 
 class cmLocalVisualStudio7GeneratorInternals
@@ -1675,10 +1678,19 @@ cmLocalVisualStudio7Generator
   
   cmGlobalVisualStudio7Generator* gg =
     static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator);
+
+  // Compute the version of the Intel plugin to the VS IDE.
+  // If the key does not exist then use a default guess.
+  std::string intelVersion = "9.10";
+  std::string vskey = gg->GetRegistryBase();
+  vskey += "\\Packages\\" CM_INTEL_PLUGIN_GUID ";ProductVersion";
+  cmSystemTools::ReadRegistryValue(vskey.c_str(), intelVersion,
+                                   cmSystemTools::KeyWOW64_32);
+
   fout << "<?xml version=\"1.0\" encoding = \"Windows-1252\"?>\n"
        << "<VisualStudioProject\n"
        << "\tProjectCreator=\"Intel Fortran\"\n"
-       << "\tVersion=\"9.10\"\n";
+       << "\tVersion=\"" << intelVersion << "\"\n";
   const char* keyword = target.GetProperty("VS_KEYWORD");
   if(!keyword)
     {