[CMake] Encapsulating macros
Alexander Neundorf
a.neundorf-work at gmx.net
Tue Oct 20 13:14:49 EDT 2009
On Tuesday 20 October 2009, Theodore Papadopoulo wrote:
> Following-up a previous message "Re: [CMake] Updating cache entries on
> variable modification", I would like
> to encapsulate the FIND_LIBRARY.
>
> Taking a simple example, let's assume that I'd like to have a list of
> all the calls of FIND_LIBRARY I did.
> Is there a way of creating a cmake script that basically does something
> like:
>
> MACRO(SAVED_FIND_LIBRARY)
> FIND_LIBRARY(${ARGN})
> ENDMACRO()
>
> MACRO(FIND_LIBRARY VAR)
> SET(MY_LIB_LIST ${MY_LIB_LIST} ${VAR})
> SAVED_FIND_LIBRARY(${VAR} ${ARGN})
> ENDMACRO()
>
> Obviously this does not work....
> Is there a tricky way to achieve this, or should resign myself to use a
> new name ?
There was something...
If you override an already existing macro/command, the previous version is
still available, but with an underscore prefixed, i.e. _find_library().
I'm not sure I remember correctly, but it was somethign close to this.
Alex
More information about the CMake
mailing list