[CMake] pkgconfig and cross compiling

Alexander Neundorf a.neundorf-work at gmx.net
Tue Nov 4 18:57:36 EST 2008


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
unset the PKG_CONFIG_PATH env.var
figure out "prefix" for the package from --variable=pcfiledir

More comments ?
It doesn't take a <prefix>-pkg-config into account yet.

Alex
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pkg_config_libdir.patch
Type: text/x-diff
Size: 2985 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081105/71fc5c20/attachment.patch>


More information about the CMake mailing list