Do we trust pkg-config or not?

Matt Rogers mattr at kde.org
Sat Dec 9 15:47:35 CET 2006


On Friday 08 December 2006 23:40, Brad Hards wrote:
> I note that there are a number of modules that have a
> construct like:
>
>   INCLUDE(UsePkgConfig)
>
>   IF (NOT WIN32)
>     PKGCONFIG(qca _Qca2IncDir _Qca2LinkDir _Qca2LinkFlags _Qca2Cflags)
>
>     MESSAGE(STATUS "pkg-config returned ${_Qca2IncDir} for QCA 2 includes")
>     set(QCA2_DEFINITIONS ${_Qca2Cflags})
>   ENDIF (NOT WIN32)
>
>   FIND_PATH(QCA2_INCLUDE_DIR QtCrypto
>     PATHS
>     ${_Qca2IncDir}
>     )
>
>   MESSAGE(STATUS "QCA2_INCLUDE_DIR has value ${QCA2_INCLUDE_DIR}" )
>
>
> I don't understand what this is intended to accomplish, but it
> seems broken to me.
>
> Running this module gives me:
> -- pkg-config returned /usr/local/KDE-4.0/include/QtCrypto for QCA 2
> includes -- QCA2_INCLUDE_DIR has value /usr/local/include
> -- Found QCA2: /usr/local/KDE-4.0/lib/libqca.so
>
> The problem is that FiND_PATH is picking up a directory called QtCrypto (in
> /usr/local/include), rather than the header (also called QtCrypto).
>
> This is probably an artifact of my installation, but the fact remains that
> we are potentially throwing away some of the required -I cflags, because
> QCA2_INCLUDE_DIR is only ever a single entry (from FIND_PATH), but there
> could (and are, in this case) several entries).
>
> I think we should trust the pkg-config entries, where available:
>   IF (NOT WIN32)
>     PKGCONFIG(qca QCA2_INCLUDE_DIR _Qca2LinkDir _Qca2LinkFlags _Qca2Cflags)
>
>     MESSAGE(STATUS "pkg-config returned ${_Qca2IncDir} for QCA 2 includes")
>     set(QCA2_DEFINITIONS ${_Qca2Cflags})
>   ELSE (NOT WIN32)
>
>     FIND_PATH(QCA2_INCLUDE_DIR QtCrypto
>       PATHS
>       ${_Qca2IncDir}
>       )
>   ENDIF (NOT WIN32)
>
> Note that the same issue potentially applies to the linker / library
> options.
>
> Is there some reason not to trust the pkg-config options, given the chance
> of breakage that this introduces?
>
> Brad

I think what you're seeing in the QCA case is just debugging information that 
hasn't been cleaned up. It's not so much as but trust but about laziness to 
clean up something after it's been proven working. I think we should just go 
with whatever pkg-config gives and not print out anything. If you want to 
commit your changes to that, please feel free.

Thanks
--
Matt


More information about the Kde-buildsystem mailing list