xxxx_LIBRARY_DIRS not used

Thiago Macieira thiago at kde.org
Fri Dec 26 03:39:59 CET 2008


Hi all

It seems we have a problem with the xxxx_LIBRARY_DIRS variables not being 
used, even though they are set properly by PKG_CHECK_MODULE. That causes 
linking errors.

Let me give you a concrete example: Google Gadgets library (ggadget) in 
kdebase/workspace/plasma/scriptengines/google_gadgets. The CMakeLists.txt 
file has:

target_link_libraries(plasma_package_ggl
  ${GOOGLEGADGETS_LIBRARIES}
  plasma ${KDE4_KDECORE_LIBS} )

And the variable GOOGLEGADGETS_LIBRARIES contains a simple list of 
libraries to be linked to:

GOOGLEGADGETS_LIBRARIES:INTERNAL=ggadget-
qt-1.0;ggadget-1.0;QtGui;png;SM;ICE;QtCore;z;gthread-2.0;rt;glib-2.0;pthread;Xi;Xrender;Xrandr;freetype;fontconfig;Xext;X11;m;dl

As you can see, there is no directory information there. This comes from 
FindPkgConfig.cmake's call:
 _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" 
LIBRARIES           "(^| )-l" --libs-only-l )

Note the --libs-only-l line. The rest of the information is in the 
variable we're missing:

_pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" 
LIBRARY_DIRS        "(^| )-L" --libs-only-L )

GOOGLEGADGETS_LIBRARY_DIRS:INTERNAL=/opt/qt4/lib;/usr/X11R7/lib

So, the question is: how do we use this other variable? I see two options:

1) add the missing link_directories(${GOOGLEGADGETS_LIBRARY_DIRS}) to the 
CMakeLists.txt

2) use GOOGLEGADGETS_LDFLAGS in the TARGET_LINK_LIBRARIES command instead.

What is the recommended way?

PS: the link error comes from the fact that QtGui.pc lists too many 
libraries even in non-static mode, but the fix will have to wait Qt 4.6 as 
it proved too intrusive when I made it.

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/kde-buildsystem/attachments/20081226/1c9bdb58/attachment.sig 


More information about the Kde-buildsystem mailing list