[CMake] pkgconfig and cross compiling

Hendrik Sattler post at hendrik-sattler.de
Wed Nov 5 01:41:37 EST 2008


Am Wednesday 05 November 2008 00:57:36 schrieb Alexander Neundorf:
> On Tuesday 04 November 2008, Hendrik Sattler wrote:
> > Am Tuesday 04 November 2008 22:45:57 schrieb Alexander Neundorf:
> > > So, if e.g. CMAKE_FIND_ROOT_PATH is /opt/eldk-4.1/ppc_4xxFP/ppc_4xxFP ,
> > > then I would have to query pkg-config for the variable "prefix", then
> > > prepend this prefix with the directory (the right one) from
> > > CMAKE_FIND_ROOT_PATH, and then call pkg-config with
> > > --define-variable=prefix=<the constructed prefix> ?
> >
> > Maybe you should ask the pkg-config people about this? The windows-only
> > behaviour/options would be very handy for cross-compile support.
> >
> > > > BTW: <cross>-pkg-config as proposed here should indeed be used if
> > > > present. However(!) and like the one above, it will also fail if you
> > > > have more than one root prefix.
> > >
> > > I checked, my eldk doesn't come with an own pkg-config, so I don't have
> > > some <cross>-pkg-config around.
> > > How would this <cross>-pkg-config behave ?
> > > How would it handle the PKG_CONFIG_LIBDIR and PKG_CONFIG_PATH variables
> > > ? Does it print the adjusted path for e.g. include dir etc. ?
> >
> > Don't know, never had one because the host's pkgconfig should be
> > sufficient.
> >
> > > > The right fix would be to do the same as on Windows and automatically
> > > > define prefix relative to the location of the .pc file that is
> > > > currently in use (and remove the prefix variable from all those
> > > > files).
> > >
> > > Is there a way to tell pkgconfig to print the full path of the pc file
> > > which it found ?
> > > I don't see this in the help.
> >
> > It is only hidden in the source code:
> > $ pkg-config --variable=pcfiledir
> >
> > Maybe that can be used to solve the issue. Still, on Windows this is
> > handled automatically by pkg-config itself.
>
> Thanks for all the comments.
> Please have a look at the attached patch and give it a try.
> It does:
> set the PKG_CONFIG_LIBDIR env.var

yes

> unset the PKG_CONFIG_PATH env.var

no

> figure out "prefix" for the package from --variable=pcfiledir

no

> More comments ?

Maybe it was an old patch?

HS



More information about the CMake mailing list