diff options
-rw-r--r-- | Source/cmakemain.cxx | 11 | ||||
-rw-r--r-- | Tests/RunCMake/message/RunCMakeTest.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/message/newline-script.cmake | 2 | ||||
-rw-r--r-- | Tests/RunCMake/message/newline-stdout.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/message/newline.cmake | 9 |
5 files changed, 26 insertions, 0 deletions
diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 1725375..64d93df 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -153,9 +153,20 @@ std::string cmakemainGetStack(cmake* cm) void cmakemainMessageCallback(const std::string& m, const cmMessageMetadata& md, cmake* cm) { +#if defined(_WIN32) + // FIXME: On Windows we replace cerr's streambuf with a custom + // implementation that converts our internal UTF-8 encoding to the + // console's encoding. It also does *not* replace LF with CRLF. + // Since stderr does not convert encoding and does convert LF, we + // cannot use it to print messages. Another implementation will + // be needed to print colored messages on Windows. + static_cast<void>(md); + std::cerr << m << cmakemainGetStack(cm) << "\n"; +#else cmsysTerminal_cfprintf(md.desiredColor, stderr, "%s", m.c_str()); fflush(stderr); // stderr is buffered in some cases. std::cerr << cmakemainGetStack(cm) << "\n"; +#endif } void cmakemainProgressCallback(const std::string& m, float prog, cmake* cm) diff --git a/Tests/RunCMake/message/RunCMakeTest.cmake b/Tests/RunCMake/message/RunCMakeTest.cmake index 0313ed1..1233838 100644 --- a/Tests/RunCMake/message/RunCMakeTest.cmake +++ b/Tests/RunCMake/message/RunCMakeTest.cmake @@ -1,5 +1,7 @@ include(RunCMake) +run_cmake_script(newline) + run_cmake(defaultmessage) run_cmake(nomessage) run_cmake(message-internal-warning) diff --git a/Tests/RunCMake/message/newline-script.cmake b/Tests/RunCMake/message/newline-script.cmake new file mode 100644 index 0000000..e9e3d5d --- /dev/null +++ b/Tests/RunCMake/message/newline-script.cmake @@ -0,0 +1,2 @@ +message(STATUS "one\ntwo") +message("one\ntwo") diff --git a/Tests/RunCMake/message/newline-stdout.txt b/Tests/RunCMake/message/newline-stdout.txt new file mode 100644 index 0000000..beca44e --- /dev/null +++ b/Tests/RunCMake/message/newline-stdout.txt @@ -0,0 +1,2 @@ +-- out='2d2d206f6e650a74776f0a' +-- err='6f6e650a74776f0a' diff --git a/Tests/RunCMake/message/newline.cmake b/Tests/RunCMake/message/newline.cmake new file mode 100644 index 0000000..97afba4 --- /dev/null +++ b/Tests/RunCMake/message/newline.cmake @@ -0,0 +1,9 @@ +execute_process( + COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_LIST_DIR}/newline-script.cmake" + OUTPUT_FILE newline-script-stdout.txt + ERROR_FILE newline-script-stderr.txt + ) +foreach(f out err) + file(READ newline-script-std${f}.txt hex HEX) + message(STATUS "${f}='${hex}'") +endforeach() |