[CMake] pkgconfig and cross compiling

Hendrik Sattler post at hendrik-sattler.de
Tue Nov 4 17:32:54 EST 2008


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.

> > And then, the <cross>-pkg-config is just useful for the case that the
> > build host does not have pkg-config itself.
>
> I don't understand what you mean . Can you please explain ?

Not every build host has pkg-config installed...

HS


More information about the CMake mailing list