[CMake] Double @-substitution and configure_file()??

Marcel Loose loose at astron.nl
Tue Jan 19 04:57:06 EST 2010


On Mon, 2010-01-18 at 11:55 -0500, David Cole wrote:
> On Mon, Jan 18, 2010 at 10:28 AM, Marcel Loose <loose at astron.nl>
> wrote:
>         Hi all,
>         
>         Is it possible to somehow do a double @-substitution when
>         using, e.g.,
>         configure_file, similar to a double ${${...}} construct.
>         
>         $ cat myvar.cmake
>         message(STATUS "@MYVAR@=@@MYVAR@@")
>         message(STATUS "${MYVAR}=${${MYVAR}}")
>         
>         $ cmake -D MYVAR=Hello -D Hello="Hello World" -P myvar.cmake
>         -- Hello=@Hello@
>         -- Hello=Hello World
>         
>         Apparently this doesn't produce the same results.
>         
>         Best regards,
>         Marcel Loose.
> 
> 
> No double-@ substitution, and I'm not sure it would be desirable....
> 
> But you could do something like this *before* configure_file:
> 
> set(myvar2name "${MYVAR}")
> set(myvar2val "${${MYVAR}}")
> message(STATUS "@myvar2name@=@myvar2val@")
> message(STATUS "${myvar2name}=${myvar2val}")
> 
> 
Yeah, that's what I was using as a "work-around". Guess I'll have to
stick to that. Thanks.

Regards,
Marcel Loose.




More information about the CMake mailing list