[cmake-developers] automoc
Brad King
brad.king at kitware.com
Mon Oct 23 13:25:57 EDT 2006
Alexander Neundorf wrote:
> So I have the impression it _has_ to be a per-target thing.
> So we actually could also do:
>
> kde4_add_library(kdecore AUTOMOC kurl.cpp kapplication.cpp ...)
>
> Handling optional keywords in cmake macros is possible, but quite hard to do.
I like this approach. Then only one extra argument is needed to take
care of everything. If it is possible to implement the check for the
optional keyword without changing CMake let's just go with that for now
because it is probably too late to get LIST changes into 2.4.4. Even if
the check is inefficient it is only done once per target.
> Maybe a LIST(CONTAINS <list> <value> <result>) would help with the handling of
> optional keywords. Then I could do
>
> set(srcs ${ARGN})
> list(CONTAINS srcs AUTOMOC _hasAutomoc)
> if(_hasAutomoc)
> list(REMOVE_ITEM srcs AUTMOC})
> endif(_hasAutomoc)
> add_executable(target ${srcs})
>
> It would be nicer if REMOVE_AT could be used, but then I need the index of the
> keyword in the list. And _hasAutomoc can't be used for this, since index 0 is
> a valid index but would be evaluated to FALSE if used in a test as above.
Currently REMOVE_AT would not be any faster than REMOVE_ITEM anyway
because the conversion from string to vector still must be done
internally. If you send me a patch for list(CONTAINS) I'll apply it.
-Brad
More information about the cmake-developers
mailing list