summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Stürmer <michael.stuermer@schaeffler.com>2018-03-22 17:27:44 (GMT)
committerMichael Stürmer <michael.stuermer@schaeffler.com>2018-04-24 05:05:19 (GMT)
commitde549083e34906e4778a709497adc99f7f0dccbb (patch)
tree067c27e610322c354908a699c1cd4f913211c687
parent59ec7d50bdad2f07a32f3efffdad448f57ec7459 (diff)
downloadCMake-de549083e34906e4778a709497adc99f7f0dccbb.zip
CMake-de549083e34906e4778a709497adc99f7f0dccbb.tar.gz
CMake-de549083e34906e4778a709497adc99f7f0dccbb.tar.bz2
cmVisualStudio10TargetGenerator: warn if /clr flag is set manually
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx16
1 files changed, 14 insertions, 2 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 840494c..9a015cf 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -2490,8 +2490,20 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
// check for managed C++ assembly compiler flag. This overrides any
// /clr* compiler flags which may be defined in the flags variable(s).
if (this->ProjectType != csproj) {
- // TODO: add check here, if /clr was defined manually and issue
- // warning that this is discouraged.
+ // Warn if /clr was added manually. This should not be done
+ // anymore, because cmGeneratorTarget may not be aware that the
+ // target uses C++/CLI.
+ if (flags.find("/clr") != std::string::npos ||
+ defineFlags.find("/clr") != std::string::npos) {
+ if (configName == this->Configurations[0]) {
+ std::string message = "For the target \"" +
+ this->GeneratorTarget->GetName() +
+ "\" the /clr compiler flag was added manually. " +
+ "Set usage of C++/CLI by setting COMMON_LANGUAGE_RUNTIME "
+ "target property.";
+ this->Makefile->IssueMessage(cmake::MessageType::WARNING, message);
+ }
+ }
if (auto* clr =
this->GeneratorTarget->GetProperty("COMMON_LANGUAGE_RUNTIME")) {
std::string clrString = clr;