[CMake] Help with Execute_Process
Bill Hoffman
bill.hoffman at kitware.com
Tue Jul 15 16:00:43 EDT 2008
Alan W. Irwin wrote:
> On 2008-07-15 13:10+0200 Carminati Federico wrote:
>
>> Hello,
>> I would like to execute the following command
>>
>> Execute_Process(
>> COMMAND svn info | grep \"Last Changed Rev:\" | cut -d: -f2
>> OUTPUT_VARIABLE _res)
>>
>> But concatenation with pipes does not work. Any hint? Best regards,
>
> I haven't tried this myself, but the execute_process documentation says:
>
> "Runs the given sequence of one or more commands with the standard
> output of
> each process piped to the standard input of the next. A single standard
> error pipe is used for all processes."
>
> So I think
>
> COMMAND svn info
> COMMAND grep \"Last Changed Rev:\" COMMAND cut -d: -f2
>
> should do what you want.
>
That should work, but it would be better to just get the output of svn
info into a cmake string and process it in CMake directly. That way
your project will not depend on grep and cut being on the system.
-Bill
--
Bill Hoffman
Kitware, Inc.
28 Corporate Drive
Clifton Park, NY 12065
bill.hoffman at kitware.com
http://www.kitware.com
518-371-3971 (phone and fax)
More information about the CMake
mailing list