From 92d76b50aa50df14491685f049b7ba109f0d8697 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 8 Sep 2016 01:20:35 +0200 Subject: [PATCH] Make the add_custom_command output more predictable I otherwise get: Expected stderr to match: expect-err> CMake Error at AppendNotOutput.cmake:1 \(add_custom_command\): expect-err> add_custom_command given APPEND option with output.* expect-err> which is not already a custom command output. expect-err> Call Stack \(most recent call first\): expect-err> CMakeLists.txt:3 \(include\) Actual stderr: actual-err> CMake Error at AppendNotOutput.cmake:1 (add_custom_command): actual-err> add_custom_command given APPEND option with output actual-err> "/home/stephen/dev/src/cmake/with actual-err> space/Tests/RunCMake/add_custom_command/AppendNotOutput-build/out" which is actual-err> not already a custom command output. actual-err> Call Stack (most recent call first): actual-err> CMakeLists.txt:3 (include) Using a specific line for paths is a style already used elsewhere for the same reason, such as CMP0041 output. --- Source/cmAddCustomCommandCommand.cxx | 4 ++-- Tests/RunCMake/add_custom_command/AppendNotOutput-stderr.txt | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index 2c4a4ca91..2e284989b 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -263,8 +263,8 @@ bool cmAddCustomCommandCommand::InitialPass( // No command for this output exists. std::ostringstream e; - e << "given APPEND option with output \"" << output[0] - << "\" which is not already a custom command output."; + e << "given APPEND option with output\n\"" << output[0] + << "\"\nwhich is not already a custom command output."; this->SetError(e.str()); return false; } diff --git a/Tests/RunCMake/add_custom_command/AppendNotOutput-stderr.txt b/Tests/RunCMake/add_custom_command/AppendNotOutput-stderr.txt index 96d097228..cd542d875 100644 --- a/Tests/RunCMake/add_custom_command/AppendNotOutput-stderr.txt +++ b/Tests/RunCMake/add_custom_command/AppendNotOutput-stderr.txt @@ -1,5 +1,8 @@ CMake Error at AppendNotOutput.cmake:1 \(add_custom_command\): - add_custom_command given APPEND option with output.* + add_custom_command given APPEND option with output + + .*RunCMake/add_custom_command/AppendNotOutput-build/out.* + which is not already a custom command output. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)