automoc4 from kdesupport now supported for building KDE
David Faure
faure at kde.org
Wed Jun 4 14:25:09 CEST 2008
On Wednesday 04 June 2008, Andreas Pakulat wrote:
> > But that means modifying global variables, i.e. affecting all other calls to find_library?
> > This doesn't sound right. When looking for libbz2 we surely don't want to look into
> > ${KDE4_LIB_INSTALL_DIR} ${KDE4_LIB_DIR} ${QT_LIBRARY_DIR} ...
>
> Well, you can first add them and then remove them again.
Before and after *every* single call to find_library? Hello? This isn't autoconf anymore, we are looking
for _convenient_ solutions here :)
> > Yes. However this means not using NO_DEFAULT_PATH, so this brings up this orthogonal issue:
> >
> > Imagine I have a /usr/lib/libphonon.so from kubuntu (so it's old, and was compiled in release mode),
> > and I compile my own libphonon.so into my own prefix (say /opt/phonon/lib/libphonon.so or whatever).
> > IIRC a call to find_library() would prefer the one in /usr/lib/libphonon.so even when doing
> > find_library(PHONON_LIBRARY NAMES phonon PATHS /opt/phonon/lib)
> > because the system paths are checked first (right? I hope I don't remember wrongly).
>
> Right, but with that call you could set CMAKE_PREFIX_PATH and have your
> phonon in /opt found.
But the code already mentions /opt/phonon/lib, so it should find it there automatically.
For this we -do- want autoconf-like behavior: autodetection whenever possible, otherwise
every user would have to set a huge number of variables when configuring any kde module.
Personally I am testing things with "everything in its own prefix", but most people don't do that,
they use the same prefix for everything (say /usr/local, or some kde-related prefix), and any
lib in that prefix should be found automatically, without even the need to set CMAKE_PREFIX_PATH,
as long as we can, in the cmake modules code, figure out that "likely default path"
(which we do. but it should have priority over /usr/lib!).
> > Right Alex? This is the reason for the NO_DEFAULT_PATH in FindPhonon? Or is the reason
> > rather that you wanted CMAKE_SYSTEM_LIBRARY_PATH to have more priority than qt's [old] phonon?
> > (but that's a tough choice, they could both be too old :)
> >
> > Removing NO_DEFAULT_PATH fixes my problem (phonon is found when setting CMAKE_PREFIX_PATH correctly)
> > OK about this patch, Alex?
>
> No, thats wrong, it breaks when one has phonon in /usr/lib and also in
> install dir, but the latter one should be used.
This is exactly what's wrong about find_library IMHO.
We need a way to get the following priority order:
* user-specified prefix (CMAKE_PREFIX_PATH)
* likely default locations (kde lib install dir etc.)
* system fallback defaults (/usr)
> You should add a second
> call to find_library without NO_DEFAULT_PATH after the first one.
That's ugly and we don't want to do that - as Brad said.
> That
> uses phonon from KDE paths+CMAKE_SYSTEM_LIBRARY_PATH+install dir if
> available and else uses the one that it finds in the default paths,
> including CMAKE_PREFIX_PATH and CMAKE_LIBRARY_PATH variables.
Those last two are user-specified, surely they should have priority?
Otherwise there's no way to override the builtin-default-locations like "kde install dir"
or "/usr/lib" (that's what CMAKE_SYSTEM_LIBRARY_PATH is, isn't it?).
--
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
More information about the Kde-buildsystem
mailing list