summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-02-24 12:15:48 -0500
committerBrad King <brad.king@kitware.com>2016-03-07 10:09:09 -0500
commit3aa6fea69c0bd1614e13a67eb23ca033c0fe1795 (patch)
treea747f925be171543b9b5249910abe9c629be02ea
parentf086c665da00228cabf465dc1eb7223d40fd6270 (diff)
downloadcmake-3aa6fea69c0bd1614e13a67eb23ca033c0fe1795.tar.gz
VS: Fix VS 2015 .vcxproj debug setting for older toolsets (#15986)
Since commit v3.4.2~2^2 (VS: Fix VS 2015 .vcxproj file value for GenerateDebugInformation, 2016-01-08) we generate invalid project files for the v110 and v120 toolsets. VS complains: C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(639,9): error MSB4030: "Debug" is an invalid value for the "GenerateDebugInformation" parameter of the "Link" task. The "GenerateDebugInformation" parameter is of type "System.Boolean". This reveals that our VS flag map selection should be based on the toolset instead of the version of VS. However, that will be a non-trivial change so for now fix this particular use case by hard-coding a correction to the flag map. Reported-by: Gregor Jasny <gjasny@googlemail.com>
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx28
1 files changed, 28 insertions, 0 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 6b46773919..c9c09fdfd5 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -2661,6 +2661,34 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
}
}
+ // Hack to fix flag version selection in a common use case.
+ // FIXME: Select flag table based on toolset instead of VS version.
+ if (this->LocalGenerator->GetVersion() >=
+ cmGlobalVisualStudioGenerator::VS14)
+ {
+ cmGlobalVisualStudio10Generator* gg =
+ static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
+ const char* toolset = gg->GetPlatformToolset();
+ if (toolset &&
+ (cmHasLiteralPrefix(toolset, "v100") ||
+ cmHasLiteralPrefix(toolset, "v110") ||
+ cmHasLiteralPrefix(toolset, "v120")))
+ {
+ if (const char* debug = linkOptions.GetFlag("GenerateDebugInformation"))
+ {
+ // Convert value from enumeration back to boolean for older toolsets.
+ if (strcmp(debug, "No") == 0)
+ {
+ linkOptions.AddFlag("GenerateDebugInformation", "false");
+ }
+ else if (strcmp(debug, "Debug") == 0)
+ {
+ linkOptions.AddFlag("GenerateDebugInformation", "true");
+ }
+ }
+ }
+ }
+
this->LinkOptions[config] = pOptions.release();
return true;
}