[Cmake] Read a file

Nils H. Busch nilsb at cns . mpg . de
Mon, 17 Mar 2003 17:21:02 +0100


Andy Cedilnik wrote:

> Hi Geoffrey,
>
> INCLUDE does read file, but it has to be in CMake format. I understood
> Nils, that he wants to read file and store result to CMake variable.

Yes, that is what I meant.

>
> There is a way actually:
>
> SET(cat_prog cat)
> IF(WIN32)
>   IF(NOT UNIX)
>     SET(cat_prog type)
>   ELSE(NOT UNIX)
> ENDIF(WIN32)
>
> EXEC_PROGRAM(${cat_prog} ARGS /input/file.txt OUTPUT_VARIABLE variable)
>
> MESSAGE("Content of file is: ${variable}")
>
>                                 Andy
>

Alright. I am handling things like that in a little perl script now, as I
need to do some regex matching as well.

>
> On Mon, 2003-03-17 at 10:32, Geoffrey Cross wrote:
> > What about "INCLUDE"?  Isn't that what he meant?

Thanks a lot for your answers.

--
    Nils H. Busch
    Max-Planck-Institute of Cognitive Neuroscience
    phone:  ++49 (341) 9940-035 fax:  ++49 (341) 9940-204
    e-mail: nilsb at cns . mpg . de