[CMake] pkgconfig and cross compiling

Alexander Neundorf a.neundorf-work at gmx.net
Mon Nov 3 17:20:52 EST 2008


Hi,

I still have an uncommitted patch lying around here, you can find it attached.
It deals with pkgconfig when cross compiling.
What it does it sets the environment variable PKG_CONFIG_LIBDIR to the 
pkgconfig subdirs of each of the directories in CMAKE_FIND_ROOT_PATH.
E.g. if you have /opt/eldk-4.1/ppc_4xxFP/ppc_4xxFP in CMAKE_FIND_ROOT_PATH, 
then PKG_CONFIG_LIBDIR will contain 
/opt/eldk-4.1/ppc_4xxFP/ppc_4xxFP/usr/lib/pkgconfig .
This has the effect that pkgconfig will now first (?) look in the 
pkgconfig-directories for the target architecture and return the results from 
there.
But there are some issues:
-after checking the dirs from PKG_CONFIG_LIBDIR, it checks the dirs from 
PKG_CONFIG_PATH. E.g. on my system, PKG_CONFIG_PATH is set 
to /usr/lib/pkgconfig and /usr/local/lib/pkgconfig. This means that if 
somethign wasn't found in CMAKE_FIND_ROOT_PATH, it will still be found for my 
host system. This is wrong. But always setting PKG_CONFIG_PATH empty also 
doesn't sound good, since it may have been set on purpose. What to do here ?

-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.

So, with it still giving wrong results, I guess adding support for 
PKG_CONFIG_LIBDIR doesn't make sense, since it will still be wrong. Or is it 
just the eldk pc files which are not correct ?

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/20081103/2f236c55/attachment.patch>


More information about the CMake mailing list