summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-12-06 13:56:35 (GMT)
committerKitware Robot <kwrobot@kitware.com>2018-12-06 13:56:52 (GMT)
commitc0aab7a84a680d576143d5730afd19b841d85772 (patch)
tree33dc7fed0e63fcfadaa43c96e08803c93b5e9bba
parentfad7cfd464542831ad8d3dd9055c00d661d8e15e (diff)
parent100366a2674a79cdf654dd17a8929fe9ac2e303c (diff)
downloadCMake-c0aab7a84a680d576143d5730afd19b841d85772.zip
CMake-c0aab7a84a680d576143d5730afd19b841d85772.tar.gz
CMake-c0aab7a84a680d576143d5730afd19b841d85772.tar.bz2
Merge topic 'cmcmd_touch_err'
100366a267 cmake: add error message when '-E touch' fails Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2671
-rw-r--r--Source/cmcmd.cxx4
-rw-r--r--Tests/RunCMake/CommandLine/E_touch-nonexistent-dir-result.txt1
-rw-r--r--Tests/RunCMake/CommandLine/E_touch-nonexistent-dir-stderr.txt1
-rw-r--r--Tests/RunCMake/CommandLine/RunCMakeTest.cmake2
4 files changed, 8 insertions, 0 deletions
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 45881aa..930ced9 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -691,6 +691,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
if (args[1] == "touch" && args.size() > 2) {
for (std::string::size_type cc = 2; cc < args.size(); cc++) {
if (!cmSystemTools::Touch(args[cc], true)) {
+ std::cerr << "cmake -E touch: failed to update \"";
+ std::cerr << args[cc] << "\".\n";
return 1;
}
}
@@ -701,6 +703,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
if (args[1] == "touch_nocreate" && args.size() > 2) {
for (std::string::size_type cc = 2; cc < args.size(); cc++) {
if (!cmSystemTools::Touch(args[cc], false)) {
+ std::cerr << "cmake -E touch_nocreate: failed to update \"";
+ std::cerr << args[cc] << "\".\n";
return 1;
}
}
diff --git a/Tests/RunCMake/CommandLine/E_touch-nonexistent-dir-result.txt b/Tests/RunCMake/CommandLine/E_touch-nonexistent-dir-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_touch-nonexistent-dir-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/E_touch-nonexistent-dir-stderr.txt b/Tests/RunCMake/CommandLine/E_touch-nonexistent-dir-stderr.txt
new file mode 100644
index 0000000..470d811
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/E_touch-nonexistent-dir-stderr.txt
@@ -0,0 +1 @@
+^cmake -E touch: failed to update ".+/touch-nonexistent-dir/foo"\.$
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index ef48852..a37b7f1 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -22,7 +22,9 @@ run_cmake_command(E_echo_append ${CMAKE_COMMAND} -E echo_append)
run_cmake_command(E_rename-no-arg ${CMAKE_COMMAND} -E rename)
run_cmake_command(E_server-arg ${CMAKE_COMMAND} -E server --extra-arg)
run_cmake_command(E_server-pipe ${CMAKE_COMMAND} -E server --pipe=)
+
run_cmake_command(E_touch_nocreate-no-arg ${CMAKE_COMMAND} -E touch_nocreate)
+run_cmake_command(E_touch-nonexistent-dir ${CMAKE_COMMAND} -E touch "${RunCMake_BINARY_DIR}/touch-nonexistent-dir/foo")
run_cmake_command(E_time ${CMAKE_COMMAND} -E time ${CMAKE_COMMAND} -E echo "hello world")
run_cmake_command(E_time-no-arg ${CMAKE_COMMAND} -E time)