mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-02 11:49:55 -06:00
MSVC: Preserve linker output encoding
When using the Ninja or Makefile generator with MSVC on Windows
we invoke the linker through a `cmake -E vs_link_{exe,dll}` wrapper.
Preserve the linker output encoding to match `link.exe` behavior
instead of forcing UTF-8.
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
|
||||
#if defined(CMAKE_BUILD_WITH_CMAKE) && defined(_WIN32)
|
||||
# include "bindexplib.h"
|
||||
# include "cmsys/ConsoleBuf.hxx"
|
||||
#endif
|
||||
|
||||
#if defined(CMAKE_BUILD_WITH_CMAKE) && defined(_WIN32) && !defined(__CYGWIN__)
|
||||
@@ -1545,6 +1546,15 @@ private:
|
||||
// still works.
|
||||
int cmcmd::VisualStudioLink(std::vector<std::string> const& args, int type)
|
||||
{
|
||||
#if defined(_WIN32) && defined(CMAKE_BUILD_WITH_CMAKE)
|
||||
// Replace streambuf so we output in the system codepage. CMake is set up
|
||||
// to output in Unicode (see SetUTF8Pipes) but the Visual Studio linker
|
||||
// outputs using the system codepage so we need to change behavior when
|
||||
// we run the link command.
|
||||
cmsys::ConsoleBuf::Manager consoleOut(std::cout);
|
||||
cmsys::ConsoleBuf::Manager consoleErr(std::cerr, true);
|
||||
#endif
|
||||
|
||||
if (args.size() < 2) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user