What makes cmake variables important?

Alexander Neundorf neundorf at kde.org
Tue Sep 18 03:30:29 BST 2007


On Monday 17 September 2007 04:37, you wrote:
> On Sun, Sep 16, 2007 at 08:07:51PM -0400, Alexander Neundorf wrote:
...
> > But the macro needs a better name.
> > Suggestions ?
>
> this all sucks. :-P

That doesn't exactly help ;-)

> after looking at it myself, i noticed that i have the following in kdm
> (and that's the reason why it works for those libs, [ade] :):
>
> macro(define_library LIB FN)
>         set(varname ${FN}_in_${LIB})
>         string(TOUPPER ${LIB}_LIBRARIES libname)
>         check_library_exists(${LIB} ${FN} "" ${varname})
>         set(${libname})
>         if (${varname})
>                 set(${libname} ${LIB})
>         endif (${varname})
> endmacro(define_library)
>
> and then:
>
> define_library(s authenticate)
> define_library(posix4 sched_yield)
> define_library(socket connect)
> define_library(resolv dn_expand)

A problem with this is that it is hard for somebody else to figure out what's 
going on. So if you use e.g. SOCKET_LIBRARIES later on, it is not possible to 
find where this variable is set by just searching for this string in the 
cmake files, since the variable name is constructed via string operations in 
the macro.

Alex




More information about the kde-core-devel mailing list