KDE/kdelibs/kio

Alexander Neundorf neundorf at kde.org
Sun Feb 12 19:59:59 CET 2006


On Sunday 12 February 2006 18:49, Alexander Neundorf wrote:
> 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)

Ok, I had a closer look.
include_directories() is not target specific but a directory property, so the 
following works too:

add_library(kio ....)

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

If we really want to, this could be wrapped into a macro which could look like 
this:

macro_use_optional_package(kio ZLIB)

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