diff options
author | Dāvis Mosāns <davispuh@gmail.com> | 2016-10-01 00:11:35 (GMT) |
---|---|---|
committer | Dāvis Mosāns <davispuh@gmail.com> | 2016-10-26 14:02:37 (GMT) |
commit | 335a29cb07a8d014a9ed4d4dbf25e49da3a78b33 (patch) | |
tree | a49c2857563391c6bd9f1ddd4624f3c3fa85a7df /Source/ctest.cxx | |
parent | fdd0ce915c0ab7e5a9f3b95612b35d845a7a5213 (diff) | |
download | CMake-335a29cb07a8d014a9ed4d4dbf25e49da3a78b33.zip CMake-335a29cb07a8d014a9ed4d4dbf25e49da3a78b33.tar.gz CMake-335a29cb07a8d014a9ed4d4dbf25e49da3a78b33.tar.bz2 |
Enable Unicode output to Windows consoles
Use KWSys ConsoleBuf to replace the `streambuf` on `std::cout` and
`std::cerr` so that process output can be encoded correctly for display
in a Windows console.
Diffstat (limited to 'Source/ctest.cxx')
-rw-r--r-- | Source/ctest.cxx | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Source/ctest.cxx b/Source/ctest.cxx index 8ab17b9..1acd240 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -10,6 +10,9 @@ #include "cmake.h" #include <cmsys/Encoding.hxx> +#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE) +#include <cmsys/ConsoleBuf.hxx> +#endif #include <iostream> #include <string.h> #include <string> @@ -110,6 +113,11 @@ static const char* cmDocumentationOptions[][2] = { // this is a test driver program for cmCTest. int main(int argc, char const* const* argv) { +#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE) + // Replace streambuf so we can output Unicode to console + cmsys::ConsoleBuf::Manager consoleOut(std::cout); + cmsys::ConsoleBuf::Manager consoleErr(std::cerr, true); +#endif cmsys::Encoding::CommandLineArguments encoding_args = cmsys::Encoding::CommandLineArguments::Main(argc, argv); argc = encoding_args.argc(); |