summaryrefslogtreecommitdiffstats
path: root/Source/CPack/cpack.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/CPack/cpack.cxx')
-rw-r--r--Source/CPack/cpack.cxx35
1 files changed, 22 insertions, 13 deletions
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 5c45b14..af80cbf 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -2,6 +2,20 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include <cmConfigure.h>
+#include <cmsys/CommandLineArguments.hxx>
+#include <cmsys/Encoding.hxx>
+#include <iostream>
+#include <map>
+#include <sstream>
+#include <stddef.h>
+#include <string>
+#include <utility>
+#include <vector>
+
+#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE)
+#include <cmsys/ConsoleBuf.hxx>
+#endif
+
#include "cmCPackGenerator.h"
#include "cmCPackGeneratorFactory.h"
#include "cmCPackLog.h"
@@ -10,21 +24,11 @@
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmState.h"
+#include "cmStateSnapshot.h"
#include "cmSystemTools.h"
-#include "cmTypeMacro.h"
#include "cm_auto_ptr.hxx"
#include "cmake.h"
-#include <cmsys/CommandLineArguments.hxx>
-#include <cmsys/Encoding.hxx>
-#include <iostream>
-#include <map>
-#include <sstream>
-#include <stddef.h>
-#include <string>
-#include <utility>
-#include <vector>
-
static const char* cmDocumentationName[][2] = {
{ CM_NULLPTR, " cpack - Packaging driver provided by CMake." },
{ CM_NULLPTR, CM_NULLPTR }
@@ -84,6 +88,13 @@ int cpackDefinitionArgument(const char* argument, const char* cValue,
// this is CPack.
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);
+ consoleOut.SetUTF8Pipes();
+ cmsys::ConsoleBuf::Manager consoleErr(std::cerr, true);
+ consoleErr.SetUTF8Pipes();
+#endif
cmsys::Encoding::CommandLineArguments args =
cmsys::Encoding::CommandLineArguments::Main(argc, argv);
argc = args.argc();
@@ -415,9 +426,7 @@ int main(int argc, char const* const* argv)
}
doc.SetSection("Generators", v);
-#undef cout
return doc.PrintRequestedDocumentation(std::cout) ? 0 : 1;
-#define cout no_cout_use_cmCPack_Log
}
if (cmSystemTools::GetErrorOccuredFlag()) {