diff options
author | Sumit Bhardwaj <bhardwajs@outlook.com> | 2021-12-16 18:19:40 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-12-16 20:31:14 (GMT) |
commit | aca153b104af02ebd140c888928e6e95d1d7f8c1 (patch) | |
tree | c214ab1ab64e37d5afbb5aabaa3a7bb8f626f90f | |
parent | b86c6977b11527c31f17a3551d498019fb324fa3 (diff) | |
download | CMake-aca153b104af02ebd140c888928e6e95d1d7f8c1.zip CMake-aca153b104af02ebd140c888928e6e95d1d7f8c1.tar.gz CMake-aca153b104af02ebd140c888928e6e95d1d7f8c1.tar.bz2 |
VS: Add custom VCEnd labels only in C# projects
In commit dff98aa9ca (VS: add missing label in C# project-build events,
2021-12-15) the condition for adding our own `VCEnd` label was based on
the project being managed or not. Since we support managed C++
projects, switch the condition to be based on whether the project is C#.
Issue: #21440
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.cxx | 5 | ||||
-rw-r--r-- | Source/cmLocalVisualStudioGenerator.cxx | 6 | ||||
-rw-r--r-- | Source/cmLocalVisualStudioGenerator.h | 4 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 18 |
4 files changed, 17 insertions, 16 deletions
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index a9db953..fd13c0b 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -574,8 +574,7 @@ public: { // If any commands were generated, finish constructing them. if (!this->First) { - std::string finishScript = - this->LG->FinishConstructScript(IsManaged::No); + std::string finishScript = this->LG->FinishConstructScript(IsCSharp::No); this->Stream << this->LG->EscapeForXML(finishScript) << "\""; } @@ -1818,7 +1817,7 @@ void cmLocalVisualStudio7Generator::WriteCustomRule( if (this->FortranProject) { cmSystemTools::ReplaceString(script, "$(Configuration)", config); } - script += this->FinishConstructScript(IsManaged::No); + script += this->FinishConstructScript(IsCSharp::No); /* clang-format off */ fout << "\t\t\t\t\t<Tool\n" << "\t\t\t\t\tName=\"" << customTool << "\"\n" diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index f696dea..a21293b 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -245,15 +245,15 @@ std::string cmLocalVisualStudioGenerator::ConstructScript( } std::string cmLocalVisualStudioGenerator::FinishConstructScript( - IsManaged isManaged, const std::string& newline) + IsCSharp isCSharp, const std::string& newline) { bool useLocal = this->CustomCommandUseLocal(); // Store the script in a string. std::string script; - if (useLocal && isManaged == IsManaged::Yes) { - // These aren't generated by default for C# projects. + if (useLocal && isCSharp == IsCSharp::Yes) { + // This label is not provided by MSBuild for C# projects. script += newline; script += this->GetReportErrorLabel(); } diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h index 2383a5a..82a62cf 100644 --- a/Source/cmLocalVisualStudioGenerator.h +++ b/Source/cmLocalVisualStudioGenerator.h @@ -31,14 +31,14 @@ public: virtual ~cmLocalVisualStudioGenerator(); /** Construct a script from the given list of command lines. */ - enum class IsManaged + enum class IsCSharp { No, Yes }; std::string ConstructScript(cmCustomCommandGenerator const& ccg, const std::string& newline = "\n"); - std::string FinishConstructScript(IsManaged isManaged, + std::string FinishConstructScript(IsCSharp isCSharp, const std::string& newline = "\n"); /** Label to which to jump in a batch file after a failed step in a diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index e09ac74..9523038 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1571,10 +1571,11 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule( } } } - cmLocalVisualStudioGenerator::IsManaged isManaged = (this->Managed) - ? cmLocalVisualStudioGenerator::IsManaged::Yes - : cmLocalVisualStudioGenerator::IsManaged::No; - script += lg->FinishConstructScript(isManaged); + cmLocalVisualStudioGenerator::IsCSharp isCSharp = + (this->ProjectType == VsProjectType::csproj) + ? cmLocalVisualStudioGenerator::IsCSharp::Yes + : cmLocalVisualStudioGenerator::IsCSharp::No; + script += lg->FinishConstructScript(isCSharp); if (this->ProjectType == VsProjectType::csproj) { std::string name = "CustomCommand_" + c + "_" + cmSystemTools::ComputeStringMD5(sourcePath); @@ -4308,10 +4309,11 @@ void cmVisualStudio10TargetGenerator::WriteEvent( } } if (!script.empty()) { - cmLocalVisualStudioGenerator::IsManaged isManaged = (this->Managed) - ? cmLocalVisualStudioGenerator::IsManaged::Yes - : cmLocalVisualStudioGenerator::IsManaged::No; - script += lg->FinishConstructScript(isManaged); + cmLocalVisualStudioGenerator::IsCSharp isCSharp = + (this->ProjectType == VsProjectType::csproj) + ? cmLocalVisualStudioGenerator::IsCSharp::Yes + : cmLocalVisualStudioGenerator::IsCSharp::No; + script += lg->FinishConstructScript(isCSharp); } comment = cmVS10EscapeComment(comment); if (this->ProjectType != VsProjectType::csproj) { |