[CMake] pkgconfig and cross compiling
Alexander Neundorf
a.neundorf-work at gmx.net
Tue Nov 4 16:45:57 EST 2008
On Tuesday 04 November 2008, Hendrik Sattler wrote:
> Alexander Neundorf schrieb:
> > -Once it found the correct pc-file, it returns the result. Problem: the
> > results don't contain the target architecture prefix, e.g. here incdir
> > gives "/usr/include" while it should be
> > /opt/eldk-4.1/ppc_4xxFP/ppc_4xxFP/usr/include .
> > So what to do ? Try to automatically adjust it by adding some appropriate
> > path in the beginning ? Ignore it and use the wrong include dir ? Sounds
> > even worse.
>
> $export PKGCONFIG_LIB_DIR=/opt/eldk-4.1/ppc_4xxFP/ppc_4xxFP
> $pkg-config \
> --define-variable=prefix=/opt/eldk-4.1/ppc_4xxFP/ppc_4xxFP/usr/ \
> some_package
>
> should give you the correct result as the other paths should be defined
> relative to prefix.
Yes, I just tried.
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> ?
> 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. ?
> 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.
> 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 ?
Alex
More information about the CMake
mailing list