[CMake] Output capturing in MSVC [was: BundleUtilities and super-build]

Michael Wild themiwi at gmail.com
Tue Apr 26 03:41:45 EDT 2011


On 04/26/2011 06:51 AM, Michael Wild wrote:
> On 04/23/2011 12:46 PM, Michael Wild wrote:
>> Hi all
>> 
>> I'm trying to use BundleUtilities with MSVC 9 to install the 
>> required Qt4 DLL's of the GUI sub-project into a common prefix in 
>> the super-build binary directory. The process fails with the 
>> (abbreviated) output at the end of this message.
>> 
>> If I open the sub-project's .sln file directly and run the INSTALL
>>  target, it works perfectly fine.
>> 
>> Anybody got an idea what is going wrong here?
> 
> [...]
> 
> Ok, found it. Somehow the output of the command <cmd> in 
> execute_process(COMMAND <cmd> OUTPUT_VARIABLE <var>) is *not* 
> captured in <var> when running as a sub-project of a super-build. 
> Because of that, GetPrerequisites thinks the output of dumpbin.exe
> is empty and consequently fails to find the dependencies. I could fix
> it by having dumpbin.exe write to a file with the /out option
> instead and then reading that file back in, but what really needs
> fixing is CMake...
> 
> I'll try to come up with a minimal test-case and then file a bug 
> report.
> 
> Michael

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?

Is this worth investigating? Or should GetPrerequisites.cmake simply be
fixed to use the /out option when invoking dumpbin.exe? If the latter,
how many builds are currently broken because of this issue? Shouldn't
this pitfall be documented somewhere? Googling didn't turn up anything
useful...

Michael


More information about the CMake mailing list