summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-03-27 11:38:36 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-03-27 11:39:29 (GMT)
commit2fe8ea555e75c3bd66f285c22bb7be342f5b939f (patch)
tree2b6042f87af7241ff52132f975c61b00f4b9aae0
parent032df7ae7b60dd347184a32b1ceedf9affed522f (diff)
parentdc93cbb0d8a1f0acb12097d18e7764e856818a7b (diff)
downloadCMake-2fe8ea555e75c3bd66f285c22bb7be342f5b939f.zip
CMake-2fe8ea555e75c3bd66f285c22bb7be342f5b939f.tar.gz
CMake-2fe8ea555e75c3bd66f285c22bb7be342f5b939f.tar.bz2
Merge topic 'llvm-rc-stderr' into release-3.17
dc93cbb0d8 llvm-rc: Print stderr output when calling tools through cmake_llvm_rc Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4525
-rw-r--r--Source/cmcmd.cxx9
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake5
-rw-r--r--Tests/RunCMake/CommandLine/llvm_rc_failing_first_command-stderr.txt1
-rw-r--r--Tests/RunCMake/CommandLine/llvm_rc_failing_second_command-stderr.txt1
4 files changed, 13 insertions, 3 deletions
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 7eeb97f..2bccbc7 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -1697,6 +1697,11 @@ int cmcmd::RunPreprocessor(const std::vector<std::string>& command,
}
auto status = process.GetStatus();
if (!status[0] || status[0]->ExitStatus != 0) {
+ auto errorStream = process.ErrorStream();
+ if (errorStream) {
+ std::cerr << errorStream->rdbuf();
+ }
+
return 1;
}
@@ -1765,6 +1770,10 @@ int cmcmd::RunLLVMRC(std::vector<std::string> const& args)
}
auto status = process.GetStatus();
if (!status[0] || status[0]->ExitStatus != 0) {
+ auto errorStream = process.ErrorStream();
+ if (errorStream) {
+ std::cerr << errorStream->rdbuf();
+ }
return 1;
}
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index 087ef21..f47e45c 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -673,12 +673,11 @@ function(run_llvm_rc)
set(RunCMake_TEST_NO_CLEAN 1)
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
-
run_cmake_command(llvm_rc_no_args ${CMAKE_COMMAND} -E cmake_llvm_rc)
run_cmake_command(llvm_rc_no_-- ${CMAKE_COMMAND} -E cmake_llvm_rc test.tmp ${CMAKE_COMMAND} -E echo "This is a test")
run_cmake_command(llvm_rc_empty_preprocessor ${CMAKE_COMMAND} -E cmake_llvm_rc test.tmp -- ${CMAKE_COMMAND} -E echo "This is a test")
- run_cmake_command(llvm_rc_failing_first_command ${CMAKE_COMMAND} -E cmake_llvm_rc test.tmp ${CMAKE_COMMAND} -E false -- ${CMAKE_COMMAND} -E echo "This is a test")
- run_cmake_command(llvm_rc_failing_second_command ${CMAKE_COMMAND} -E cmake_llvm_rc test.tmp ${CMAKE_COMMAND} -E echo "This is a test" -- ${CMAKE_COMMAND} -E false )
+ run_cmake_command(llvm_rc_failing_first_command ${CMAKE_COMMAND} -E cmake_llvm_rc test.tmp ${CMAKE_COMMAND} -P FailedProgram.cmake -- ${CMAKE_COMMAND} -E echo "This is a test")
+ run_cmake_command(llvm_rc_failing_second_command ${CMAKE_COMMAND} -E cmake_llvm_rc test.tmp ${CMAKE_COMMAND} -E echo "This is a test" -- ${CMAKE_COMMAND} -P FailedProgram.cmake )
if(EXISTS ${RunCMake_TEST_BINARY_DIR}/test.tmp)
message(SEND_ERROR "${test} - FAILED:\n"
"test.tmp was not deleted")
diff --git a/Tests/RunCMake/CommandLine/llvm_rc_failing_first_command-stderr.txt b/Tests/RunCMake/CommandLine/llvm_rc_failing_first_command-stderr.txt
new file mode 100644
index 0000000..765b708
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/llvm_rc_failing_first_command-stderr.txt
@@ -0,0 +1 @@
+CMake Error
diff --git a/Tests/RunCMake/CommandLine/llvm_rc_failing_second_command-stderr.txt b/Tests/RunCMake/CommandLine/llvm_rc_failing_second_command-stderr.txt
new file mode 100644
index 0000000..765b708
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/llvm_rc_failing_second_command-stderr.txt
@@ -0,0 +1 @@
+CMake Error