new cmake macro available (starting monday): MACRO_APPEND_IF()

Alexander Neundorf neundorf at
Sun Dec 16 20:10:33 GMT 2007

On Sunday 16 December 2007, you wrote:
> First off, I know next to nothing about the CMake macro language.
> Is it possible to make a generic one-line if?

No, at most one command per line.

> I am strongly against something that looks more special than it is because
> it forces you to consider what special things it might do. It's especially

That's usually my argument ;-)

But I needed that macro for ParaView, I needed it in CMake, and I see good use 
for it in KDE. Having it in one central location is better than if different 
people will write with their own macros which will do similar things but 
slightly different, multiple copies, different names, then it gets really 
hard to understand.
As an example have a look at this file:

Here the (almost) identical macro is named "add_cond", so search for add_cond. 
It is used 45 times here, which makes 45 loc instead of 180 loc. There is one 
big block of 25 invocations one after the other, and here it helps 
significantly to see what's going on (25 similar lines where each line 
differs only in one argument).

I could ask the cmake devs what they think of LIST(APPEND_IF ...)


More information about the kde-core-devel mailing list