1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-19 19:43:23 +08:00

cmVisualStudio10TargetGenerator: warn if /clr flag is set manually

This commit is contained in:
Michael Stürmer
2018-03-22 18:27:44 +01:00
parent 59ec7d50bd
commit de549083e3

View File

@@ -2490,8 +2490,20 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
// check for managed C++ assembly compiler flag. This overrides any // check for managed C++ assembly compiler flag. This overrides any
// /clr* compiler flags which may be defined in the flags variable(s). // /clr* compiler flags which may be defined in the flags variable(s).
if (this->ProjectType != csproj) { if (this->ProjectType != csproj) {
// TODO: add check here, if /clr was defined manually and issue // Warn if /clr was added manually. This should not be done
// warning that this is discouraged. // 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 = if (auto* clr =
this->GeneratorTarget->GetProperty("COMMON_LANGUAGE_RUNTIME")) { this->GeneratorTarget->GetProperty("COMMON_LANGUAGE_RUNTIME")) {
std::string clrString = clr; std::string clrString = clr;