[CMake] Will ${string_${var}_string} work?

Sylvain Benner benner at virtools.com
Fri Sep 15 08:01:54 EDT 2006


Yes it should work. I encountered no issue using this trick so far.

Sylvain

> Hi all,
>     sorry I'm a cmake newbie and I need to know one thing.
> 
> Is it safe to do e.g.
> 
>    SET( ABC_VAR_DEF   "test2" )
> 
>    ...
> 
>    SET( MYVARIABLE   "VAR" )
>    IF( ${ABC_${MYVARIABLE}_DEF} STREQUAL "test2" )
> 
> # will ABC_VAR_DEF be correctly compared with "test2" string?
>     ....
> 
> ?
> 
> I'd like to do the ${string_${var}_string} trick in a FOREACH loop...
> I'm used to this kind of tricks in the BASH shell using eval() function 
> but I'm not sure if it will work with Cmake under all platforms..
> 
> Thanks a lot !
> Francesco
> 
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>


More information about the CMake mailing list