KDE/kdelibs/kio
William A. Hoffman
billlist at nycap.rr.com
Sun Feb 12 19:22:19 CET 2006
At 12:49 PM 2/12/2006, 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)
>
>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.
If it is an error when zlib is not found, then you do not want the IF part.
Just add the include and library. The NOTFOUND will cause cmake to issue an
error that variable X is required by this project, and must be set. This is better
than getting errors at link time because zlib was not found and was just left out
of the build process.
-Bill
More information about the Kde-buildsystem
mailing list