[CMake] can't pipe cl.exe in a custom command
Alexander.Camek at elektrobit.com
Alexander.Camek at elektrobit.com
Tue Nov 6 08:04:57 EST 2007
Hi,
> I'm trying to grab the cl.exe banner so I can determine the
> MSVC version number. If cl.exe is in the path, then the
> following works at a Windows Command Prompt. This gives a
> short banner with the VC version number and copyright.
>
> cl /? 2> banner.txt
>
> But when I try to do it in a custom command, I can't get it
> to pipe to a file. I see the output go by in the Visual
> Studio output window, with 1> prefixed in front of all the
> lines, and it is saved in BuildLog.htm, but cbanner.txt has 0
> length no matter whether I use >
> 1> 2> as the pipe. Does MSVC simply not have a notion of piping or
> something? Do I have to do something MSVC-specific to
> capture the output or the error?
>
> IF(MSVC)
> ADD_CUSTOM_COMMAND(
> OUTPUT ${CMAKE_BINARY_DIR}/cbanner.txt
> WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
> COMMAND ${CMAKE_C_COMPILER} /? 2> cbanner.txt
> )
> ADD_CUSTOM_TARGET(cbanner ALL
> DEPENDS ${CMAKE_BINARY_DIR}/cbanner.txt
> )
> ENDIF(MSVC)
Had a similar problem during generating a file with >> or with >.
Then I used VERBATIM and it worked.
Maybe this will help here too.
Greetings
Alexander
----------------------------------------------------------------
Please note: This e-mail may contain confidential information
intended solely for the addressee. If you have received this
e-mail in error, please do not disclose it to anyone, notify
the sender promptly, and delete the message from your system.
Thank you.
More information about the CMake
mailing list