new cmake macro available (starting monday): MACRO_APPEND_IF()
Alexander Neundorf
neundorf at kde.org
Sun Dec 16 17:05:22 GMT 2007
On Sunday 16 December 2007, David Faure wrote:
...
> Is this really worth it? The if/set/endif lines are clear and
> human-readable, while macro_append_if sounds like "there's some magic
> involved here, including some condition and some appending" but without
> being as clear for the casual reader, IMHO. Not a strong veto, just
> wondering...
If you have many such statements, it can get quite long. E.g. 10 times would
be 40 vs. 10 loc, which are easier to overview.
if(SOMETHING_FOUND)
set(mySrcs ${mySrcs} file1.cpp file2.cpp)
endif(SOMETHING_FOUND)
if(FOO_FOUND)
set(mySrcs ${mySrcs} foo.cpp)
endif(FOO_FOUND)
if(BAR_FOUND)
set(mySrcs ${mySrcs} bar.cpp)
endif(BAR_FOUND)
vs.
macro_append_if(SOMETHING_FOUND mySrcs file1.cpp file2.cpp)
macro_append_if(FOO_FOUND mySrcs foo.cpp)
macro_append_if(BAR_FOUND mySrcs bar.cpp)
Alex
More information about the kde-core-devel
mailing list