summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorJulien Jemine <julien.jemine@gmail.com>2020-04-28 14:55:03 (GMT)
committerBrad King <brad.king@kitware.com>2020-04-29 11:35:57 (GMT)
commit197b4cbe186cd31a490fc3cfcaace55bd7123829 (patch)
tree92b65d5e04bfa70113bf6b39b952b8168dd2b044 /Source
parent73f81c5070e7880efe5acfc1827f60524116cee1 (diff)
downloadCMake-197b4cbe186cd31a490fc3cfcaace55bd7123829.zip
CMake-197b4cbe186cd31a490fc3cfcaace55bd7123829.tar.gz
CMake-197b4cbe186cd31a490fc3cfcaace55bd7123829.tar.bz2
VS: Add option for per-target PlatformToolset
Add a `VS_PLATFORM_TOOLSET` target property to set `PlatformToolset` in the `.vcxproj` file for specific targets. Document that this is safe only when the named toolset uses the same underlying compiler as the primary toolset. Fixes: #17429
Diffstat (limited to 'Source')
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 930db41..5f79eb0 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1236,7 +1236,10 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues(
} else {
e1.Element("CharacterSet", "MultiByte");
}
- if (const char* toolset = gg->GetPlatformToolset()) {
+ if (const char* projectToolsetOverride =
+ this->GeneratorTarget->GetProperty("VS_PLATFORM_TOOLSET")) {
+ e1.Element("PlatformToolset", projectToolsetOverride);
+ } else if (const char* toolset = gg->GetPlatformToolset()) {
e1.Element("PlatformToolset", toolset);
}
if (this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT") ||
@@ -1279,7 +1282,10 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValuesManaged(
o.RemoveFlag("Platform");
}
- if (const char* toolset = gg->GetPlatformToolset()) {
+ if (const char* projectToolsetOverride =
+ this->GeneratorTarget->GetProperty("VS_PLATFORM_TOOLSET")) {
+ e1.Element("PlatformToolset", projectToolsetOverride);
+ } else if (const char* toolset = gg->GetPlatformToolset()) {
e1.Element("PlatformToolset", toolset);
}