[CMake] Help with Execute_Process

Carminati Federico Federico.Carminati at cern.ch
Wed Jul 16 03:55:56 EDT 2008


Hello,
   thanks for your answer. I did not realise that the output of  
Execute_Process could be several lines long and that this output could  
be parsed with String. It is working fine now. BEst,

Federico Carminati
CERN-PH
1211 Geneva 23
Switzerland
Tel: +41 22 76 74959
Fax: +41 22 76 79480
Mobile: +41 76 487 4843

On 15 Jul 2008, at 22:00, Bill Hoffman wrote:

> 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