KDE/kdelibs/kio

Alexander Neundorf neundorf at kde.org
Sun Feb 12 18:49:03 CET 2006


On Sunday 12 February 2006 18:35, Christian Ehrlicher wrote:
...
> > +if(ZLIB_FOUND)
> > +   include_directories(${ZLIB_INCLUDE_DIR})
> > +endif(ZLIB_FOUND)
...
> why do we need to add this?
> I mean - can't we simply say the we need ZLIB and cmake adds all things
> automagically?

Basically:
if (ZLIB_FOUND)
  include_directories(${ZLIB_INCLUDE_DIR})
endif (ZLIB_FOUND)
...
if (ZLIB_FOUND)
  target_link_libraries(kio ${ZLIB_LIBRARY})
endif (ZLIB_FOUND)

is just that, we say "we need zlib". After all, it is a bit more typing but it 
is simple and obvious.

Or maybe you mean something different:
we could also just use
include_directories(..... ${ZLIB_INCLUDE_DIR} )
...
target_link_libraries(kio ... ${ZLIB_LIBRARY})

This would work if ZLIB_INCLUDE_DIR and ZLIB_LIBRARY are empty if they haven't 
been found. Currently they are set to "NOTFOUND", so linking to NOTFOUND 
won't work. According to the cmake developers NOTFOUND has some advantage 
over empty, IIRC if the value is NOTFOUND then the package is searched again 
again when cmake runs the next time, if it is just empty it doesn't try to 
find it again.

Bye
Alex
-- 
Work: alexander.neundorf AT jenoptik.com - http://www.jenoptik-los.de
Home: neundorf AT kde.org                - http://www.kde.org
      alex AT neundorf.net               - http://www.neundorf.net


More information about the Kde-buildsystem mailing list