[CMake] process file contents

James C. Sutherland James.Sutherland at utah.edu
Wed May 12 14:07:20 EDT 2010


On May 12, 2010, at 11:43 AM, James C. Sutherland wrote:

> I would like to execute a command like:
> 	getrates -n < myFileName
> 
> I am trying to add this so it is processed after the target "getrates" is built
> 
> set( infile ${CMAKE_CURRENT_BINARY_DIR}/myFileName )
> add_custom_command( TARGET getrates
>   POST_BUILD
>   COMMAND "${CMAKE_CURRENT_BINARY_DIR}/getrates" " -n < ${infile}"
>   WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
>   VERBATIM
>   )
> 
> This does not seem to work, however.  CMake doesn't handle the "<" properly.  Any ideas about how to stream the contents of a file?
> 
> Thanks,
> 
> James

Got it.  It looks like removing the "" from the arguments does the job, i.e.
add_custom_command( TARGET getrates
  POST_BUILD
  COMMAND ${CMAKE_CURRENT_BINARY_DIR}/getrates -n < ${infile}
  WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
  VERBATIM
  )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100512/aa39effd/attachment.htm>


More information about the CMake mailing list