PDA

View Full Version : pkg-config



becrux
28th July 2008, 18:20
Hi guys,

I've a problem regarding pkg-config.

My project uses an external library in order to parse EXIF data. This parsing is optional, so I'd like to use pkg-config to check the presence of the library, and to proceed without it if absent.

I've added in my .pro file these rows:

CONFIG += ... link_pkgconfig
PKGCONFIG += exiv2

and it works.

What I want is to add a define switch to g++ according to the presence of exiv2 library.

I tried to use this code (of course, it's specified after the two rows above):

CHECK_EXIV2 = $$find ( LIBS, ".*exiv2.*" )
!isEmpty( CHECK_EXIV2 ) {
DEFINES += EXIV2
}

but it doesn't work. Looking into Makefile, I can see "-lexiv2" in LIBS variable, but this code fails anyway :(

How can I solve it?

Thanks so much :)

Regards,
Tony.