If PKG_CONFIG_PATH is set (such as during jhbuild) telepathy-glib is detected in the alternate directory, but the libraries and include files are then used from the system directories. example: $ pkg-config telepathy-glib --modversion 0.14.9 $ PKG_CONFIG_PATH=~/build/telepathy/lib64/pkgconfig pkg-config telepathy-glib --modversion 0.15.4.1 $ cd ~/projects/telepathy-qt4 $ PKG_CONFIG_PATH=~/build/telepathy/lib64/pkgconfig cmake . <snip> -- checking for module 'telepathy-glib>=0.15.1' -- found telepathy-glib, version 0.15.4.1 -- Found TelepathyGlib: /usr/lib64/libtelepathy-glib.so <snip>
Created attachment 50123 [details] [review] Ignore telepathy-glib installs in system when using another prefix If using another build prefix PKG_CONFIG_PATH is set. This means that pkg-config finds telepathy-glib.pc in the alternate prefix. However if telepathy-glib is also installed, the cmake code then goes and uses find_library/find_path, which by default use system directories. Remove usage of system directories, in the case where the pkg-config file is found.
After patch: $ PKG_CONFIG_PATH=/data/build/telepathy/lib64/pkgconfig cmake . <snip> -- checking for module 'telepathy-glib>=0.15.1' -- found telepathy-glib, version 0.15.4.1 -- Found TelepathyGlib: /data/build/telepathy/lib64/libtelepathy-glib.so <snip>
Branch here: http://cgit.collabora.com/git/user/stefw/telepathy-qt4.git/log/?h=build-fixes
Oh and without this build patch I obviously get build failures for telepathy-glib features used in telepathy-qt4 but not in my system telepathy-glib.
Afaik, find_path() and find_library() are meant to look first in the paths specified on their call, so they *should* use the pkg-config discovered paths BEFORE looking at the system paths. If this bug is still valid, I suspect there is something fishy about those PC_* variables. It may also have been a cmake bug at the time... In any case, I am not convinced that this patch is the correct approach.
We used to call find_library with PATHS option, but it has the lowest priority, this the standard system environment variables processed first. Use HINTS option to ensure the right order of lookup directories. See also: https://cmake.org/cmake/help/latest/command/find_library.html https://cgit.freedesktop.org/telepathy/telepathy-qt/commit/?id=92d1c0966d52887fe84718d5c769198956053f64
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.