[CMake] Output capturing in MSVC

Brad King brad.king at kitware.com
Tue Apr 26 08:16:39 EDT 2011


On 04/26/2011 03:41 AM, Michael Wild wrote:
> Seems like MSVC (I'm using 9.0) is messing with the standard streams...
> I put up a simple test project that only calls "dumpbin.exe /?" in a
> execute_process call. Funny thing is, that if configured from CMake-Gui
> or command line, the output is captured just fine. However, if I then
> touch the CMakeLists.txt to force a re-configure from within the IDE,
> the output is not captured anymore. Further, not all executables seem to
> be affected. I tried cl.exe (affected), find.exe (works fine) and a
> simple ANSI-C hello-world program (works fine).
> 
> @David, @Brad, @MSVC-gurus: Do you have any idea what's going on?

The IDE sets an environment variable "VS_UNICODE_OUTPUT" to a value
that tells MS tools running from within the IDE where to send their
output:

  http://msdn.microsoft.com/en-us/library/610ecb4h%28v=vs.80%29.aspx

In order to ensure that the tools send the output to their stdout
instead, one must unset this environment variable.  The ExternalProject
module already does this when running some tools.

-Brad


More information about the CMake mailing list