summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-12-03 13:54:23 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-12-03 13:54:33 (GMT)
commit67cbfed81981a25aa56a3d05a267c1acf6ea5781 (patch)
tree19a020f41949e8055f0ae8ec2d94df8226ffa382
parentd565f9f0ee849e541036d26dc1bd69e6ce908d84 (diff)
parent13a7ae2194d44f955712d65fecf0b741049da00e (diff)
downloadCMake-67cbfed81981a25aa56a3d05a267c1acf6ea5781.zip
CMake-67cbfed81981a25aa56a3d05a267c1acf6ea5781.tar.gz
CMake-67cbfed81981a25aa56a3d05a267c1acf6ea5781.tar.bz2
Merge topic 'vs-csproj-scripts' into release-3.22
13a7ae2194 VS: Revert "Add missing label in C# project-build events" Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6781
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx4
-rw-r--r--Source/cmLocalVisualStudioGenerator.cxx11
-rw-r--r--Source/cmLocalVisualStudioGenerator.h6
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx10
-rw-r--r--Tests/CMakeLists.txt1
-rw-r--r--Tests/VSManagedCustomCommand/CMakeLists.txt15
-rw-r--r--Tests/VSManagedCustomCommand/example.txt4
7 files changed, 25 insertions, 26 deletions
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 5d3e11a..96dda53 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -567,7 +567,7 @@ public:
} else {
this->Stream << this->LG->EscapeForXML("\n");
}
- std::string script = this->LG->ConstructScript(ccg, unmanaged);
+ std::string script = this->LG->ConstructScript(ccg);
this->Stream << this->LG->EscapeForXML(script);
}
@@ -1780,7 +1780,7 @@ void cmLocalVisualStudio7Generator::WriteCustomRule(
}
std::string comment = this->ConstructComment(ccg);
- std::string script = this->ConstructScript(ccg, unmanaged);
+ std::string script = this->ConstructScript(ccg);
if (this->FortranProject) {
cmSystemTools::ReplaceString(script, "$(Configuration)", config);
}
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index 4ed1dd9..03213ef 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -124,8 +124,7 @@ const char* cmLocalVisualStudioGenerator::GetReportErrorLabel() const
}
std::string cmLocalVisualStudioGenerator::ConstructScript(
- cmCustomCommandGenerator const& ccg, IsManaged isManaged,
- const std::string& newline_text)
+ cmCustomCommandGenerator const& ccg, const std::string& newline_text)
{
bool useLocal = this->CustomCommandUseLocal();
std::string workingDirectory = ccg.GetWorkingDirectory();
@@ -238,14 +237,6 @@ 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 0e7f63f..91fb6b0 100644
--- a/Source/cmLocalVisualStudioGenerator.h
+++ b/Source/cmLocalVisualStudioGenerator.h
@@ -31,13 +31,7 @@ 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 d2c49ae..a871e4c 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1488,10 +1488,7 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule(
cmCustomCommandGenerator ccg(command, c, lg, true);
std::string comment = lg->ConstructComment(ccg);
comment = cmVS10EscapeComment(comment);
- cmLocalVisualStudioGenerator::IsManaged isManaged = (this->Managed)
- ? cmLocalVisualStudioGenerator::managed
- : cmLocalVisualStudioGenerator::unmanaged;
- std::string script = lg->ConstructScript(ccg, isManaged);
+ std::string script = lg->ConstructScript(ccg);
bool symbolic = false;
// input files for custom command
std::stringstream additional_inputs;
@@ -4241,10 +4238,7 @@ void cmVisualStudio10TargetGenerator::WriteEvent(
comment += lg->ConstructComment(ccg);
script += pre;
pre = "\n";
- cmLocalVisualStudioGenerator::IsManaged isManaged = (this->Managed)
- ? cmLocalVisualStudioGenerator::managed
- : cmLocalVisualStudioGenerator::unmanaged;
- script += lg->ConstructScript(ccg, isManaged);
+ script += lg->ConstructScript(ccg);
stdPipesUTF8 = stdPipesUTF8 || cc.GetStdPipesUTF8();
}
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index ecb54c7..36bbc62 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -2236,6 +2236,7 @@ if(BUILD_TESTING)
if(NOT "${CMAKE_GENERATOR}" MATCHES "Visual Studio 9 "
AND NOT CMAKE_GENERATOR_TOOLSET)
ADD_TEST_MACRO(VSWindowsFormsResx VSWindowsFormsResx)
+ ADD_TEST_MACRO(VSManagedCustomCommand)
endif()
add_test(VSExternalInclude ${CMAKE_CTEST_COMMAND}
diff --git a/Tests/VSManagedCustomCommand/CMakeLists.txt b/Tests/VSManagedCustomCommand/CMakeLists.txt
new file mode 100644
index 0000000..2228875
--- /dev/null
+++ b/Tests/VSManagedCustomCommand/CMakeLists.txt
@@ -0,0 +1,15 @@
+cmake_minimum_required(VERSION 3.20)
+project(VSManagedCustomCommand CXX)
+
+add_custom_command(OUTPUT middle.txt
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/example.txt ${CMAKE_CURRENT_BINARY_DIR}/middle.txt
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/example.txt
+ )
+
+add_custom_command(OUTPUT example.cxx
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/middle.txt ${CMAKE_CURRENT_BINARY_DIR}/example.cxx
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/middle.txt
+ )
+
+add_library(example SHARED example.cxx)
+set_property(TARGET example PROPERTY COMMON_LANGUAGE_RUNTIME "")
diff --git a/Tests/VSManagedCustomCommand/example.txt b/Tests/VSManagedCustomCommand/example.txt
new file mode 100644
index 0000000..05f95f1
--- /dev/null
+++ b/Tests/VSManagedCustomCommand/example.txt
@@ -0,0 +1,4 @@
+__declspec(dllexport) int example()
+{
+ return 0;
+}