pkg_config quick non intrusive solution

Helio Chissini de Castro helio at kde.org
Thu Nov 13 20:11:27 CET 2008


On Quarta 12 Novembro 2008, Alexander Neundorf wrote:
> On Wednesday 12 November 2008, Helio Chissini de Castro wrote:
> > Hi alez
> >
> > Since you talked about the find_libraries that can make things right, i
> > was thinking how to solve the pkg_check_modules issue.
> >
> > So, testing QCA2 module, i got this:
> >
> >       foreach(ENTRY ${QCA2_LIBRARIES})
> >           find_library(TMP_LIB NAMES ${ENTRY} PATHS ${QCA2_LIBRARY_DIRS})
> >           if(QCA2_TMP_LIB AND TMP_LIB)
> >             set( QCA2_TMP_LIB "${QCA2_TMP_LIB};${TMP_LIB}" )
> >           else(QCA2_TMP_LIBi AND TMP_LIB)
> >             set( QCA2_TMP_LIB "${TMP_LIB};" )
> >           endif(QCA2_TMP_LIB AND TMP_LIB)
> >       endforeach(ENTRY ${QCA2_LIBRARIES})
> >       set(QCA2_LIBRARIES ${QCA2_TMP_LIB})
> >
> > So, i just use find_library to find real libraries iteraction over the
> > pkg_config provided ones and at end substitute QCA2_LIBRARIES, providing
> > proper /path/to/lib.so
> >
> > This could be a smal function on our kde modules or even a extra patch
> > for next cmake FindPkgconfig .cmake and will get rid of our headaches.
>
> Looks quite ok.
> I guess the FIND_LIBRARY() should have the NO_DEFAULT_PATH argument, so it
> only looks in the given directories. Or, probably better, use HINTS instead
> of PATHS, then the given dirs will be checked before the default dirs.
> You can also do
> list(APPEND QCA2_TMP_LIB ${TMP_LIB})
> then you don't have to check whether QCA2_TMP_LIB is empty or not.
>
> Alex

Since this will be not the only one package affected, can we create sort of a 
macro to do this ?
Will become a generic solution.

-- 
Helio Chissini de Castro
KDE Developer
Brasil/South America Primary Contact


More information about the Kde-buildsystem mailing list