[CMake] Indrect function calls

Eric Noulard eric.noulard at gmail.com
Wed Sep 7 15:49:52 EDT 2011


2011/9/7 Firegurafiku <firegurafiku at gmail.com>:

Do not forget to CC the ML (or reply to ML).

>> With CMake:
>>  1) you can ask CMake for "double" evaluation
>>      using nested dollar ($) var value:
>>
>>     Try:
>>     set(COMP1_CFLAGS "Whatever")
>>     set(COMP2_CFLAGS "OrElse")
>>     set(COMPILER "COMP1")
>>
>>     set(CFLAGS ${${COMPILER}_CFLAGS})
>>     message("CFLAGS=${CFLAGS}")
> Yes I know it, but in my example avr_compiler_<COMPILER>_cflags() must
> construct cflags from other variables values, the way how it is
> constructed is very compiler-specific, so, using single variable isn't
> flexible enough.

OK.

>>   2) You can "emulate" function call evaluation using include
>>       this is awkward but seems to work, see example attached.
> Yes, it works but doesn't seems to be very good-looking.
>
>> That said adding a eval command to CMake could be fun,
>> even if I did never cross the urgent need for it.
> I guess this feature is not very hard to implement in cmake since it
> is a scripting language. Could you add such a feature request to cmake
> bugtracker?

You should discuss the request a little bit on the ML before filing
the feature request in order to verify that it seems reasonable to others
including Kitware people.

After you know that the feature seems acceptable open a feature request
yourself and since you think it shouldn't be to hard, go ahead and
provide a patch for that by attach it to the feature request.

Speaking for myself I won't have time any time soon to work on that, sorry.

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list