diff options
author | Steven Boswell <ulatekh@yahoo.com> | 2021-09-03 21:06:27 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-09-09 18:22:26 (GMT) |
commit | b284a21fee0907effe08a4314ffa725aa0c7c86e (patch) | |
tree | f46dd314bd644b685b45309a48b383ccaacddb27 /Source | |
parent | ed9abd99772cbdcb2e4dd195eb4a62104ce86c95 (diff) | |
download | CMake-b284a21fee0907effe08a4314ffa725aa0c7c86e.zip CMake-b284a21fee0907effe08a4314ffa725aa0c7c86e.tar.gz CMake-b284a21fee0907effe08a4314ffa725aa0c7c86e.tar.bz2 |
VS: Add missing label in C# project-build events
Fixes: #21440
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.cxx | 4 | ||||
-rw-r--r-- | Source/cmLocalVisualStudioGenerator.cxx | 11 | ||||
-rw-r--r-- | Source/cmLocalVisualStudioGenerator.h | 6 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 10 |
4 files changed, 26 insertions, 5 deletions
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 151470b..06d738f 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -566,7 +566,7 @@ public: } else { this->Stream << this->LG->EscapeForXML("\n"); } - std::string script = this->LG->ConstructScript(ccg); + std::string script = this->LG->ConstructScript(ccg, unmanaged); this->Stream << this->LG->EscapeForXML(script); } @@ -1779,7 +1779,7 @@ void cmLocalVisualStudio7Generator::WriteCustomRule( } std::string comment = this->ConstructComment(ccg); - std::string script = this->ConstructScript(ccg); + std::string script = this->ConstructScript(ccg, unmanaged); if (this->FortranProject) { cmSystemTools::ReplaceString(script, "$(Configuration)", config); } diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index 46f9d31..acddfe1 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -124,7 +124,8 @@ const char* cmLocalVisualStudioGenerator::GetReportErrorLabel() const } std::string cmLocalVisualStudioGenerator::ConstructScript( - cmCustomCommandGenerator const& ccg, const std::string& newline_text) + cmCustomCommandGenerator const& ccg, IsManaged isManaged, + const std::string& newline_text) { bool useLocal = this->CustomCommandUseLocal(); std::string workingDirectory = ccg.GetWorkingDirectory(); @@ -236,6 +237,14 @@ std::string cmLocalVisualStudioGenerator::ConstructScript( script += newline; script += "if %errorlevel% neq 0 goto "; script += this->GetReportErrorLabel(); + if (isManaged == managed) { + // These aren't generated by default for C# projects. + script += newline; + script += this->GetReportErrorLabel(); + script += newline; + script += "exit /b 0"; + script += newline; + } } return script; diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h index 91fb6b0..0e7f63f 100644 --- a/Source/cmLocalVisualStudioGenerator.h +++ b/Source/cmLocalVisualStudioGenerator.h @@ -31,7 +31,13 @@ public: virtual ~cmLocalVisualStudioGenerator(); /** Construct a script from the given list of command lines. */ + enum IsManaged + { + unmanaged, + managed + }; std::string ConstructScript(cmCustomCommandGenerator const& ccg, + IsManaged isManaged, 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 9407228..8a2acf3 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1465,7 +1465,10 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule( cmCustomCommandGenerator ccg(command, c, lg, true); std::string comment = lg->ConstructComment(ccg); comment = cmVS10EscapeComment(comment); - std::string script = lg->ConstructScript(ccg); + cmLocalVisualStudioGenerator::IsManaged isManaged = (this->Managed) + ? cmLocalVisualStudioGenerator::managed + : cmLocalVisualStudioGenerator::unmanaged; + std::string script = lg->ConstructScript(ccg, isManaged); bool symbolic = false; // input files for custom command std::stringstream additional_inputs; @@ -4205,7 +4208,10 @@ void cmVisualStudio10TargetGenerator::WriteEvent( comment += lg->ConstructComment(ccg); script += pre; pre = "\n"; - script += lg->ConstructScript(ccg); + cmLocalVisualStudioGenerator::IsManaged isManaged = (this->Managed) + ? cmLocalVisualStudioGenerator::managed + : cmLocalVisualStudioGenerator::unmanaged; + script += lg->ConstructScript(ccg, isManaged); stdPipesUTF8 = stdPipesUTF8 || cc.GetStdPipesUTF8(); } |