[CMake] pkg-config and Cross_compiling
Wookey
wookey at wookware.org
Wed Jul 2 20:06:50 EDT 2008
On 2008-07-02 19:39 +0200, Hendrik Sattler wrote:
> Am Mittwoch, 2. Juli 2008 18:59:37 schrieb Wookey:
> > I tried to fix the FindPkgConfig.cmake file to automaticaly do this,
> > but found that it uses execute_process to call pkg-config and there
> > seems to be no way to set an environment variable with this call. Am I
> > missing something? Fixing this module to look in
> > CMAKE_FIND_ROOT_PATH when cross-compiling seems like the best fix to
> > me, but there may be a better way?
>
> Yes, that should be fixed. It should work to use SET() to set an environment
> variable and the child process from EXECUTE_PROCESS should get the copy of
> that environment. BUT: you must use PKG_CONFIG_LIBDIR instead of
> PKG_CONFIG_PATH!
Ah, so I do - well done. That will avoid native libs being found.
I got the impression that SET() only set CMAKE variables, not
environment ones, but maybe they ammount to the same thing?
<fx: reads docs again> Ah, yes there is the ENV{} syntax. Brill. that
means I can now add
IF (CMAKE_CROSSCOMPILING)
SET(ENV{PKG_CONFIG_LIBDIR} ${CMAKE_FIND_ROOT_PATH}/lib/pkgconfig/)
to the toolchain file and that works fine.
Putting that in FindPkgConfig.cmake should do the trick.
> Additionally, I found that the include paths are another source of problems,
> not fully covered by the cmake cross compiling, yet. You really have to -I
> any path that is not known and specific to the cross compiler, using
> INCLUDE_DIRECTORIES(). This is not done automatically for the changed
> ROOT_PATH, yet.
Yes. I found that too. I added:
IF (CMAKE_CROSSCOMPILING)
INCLUDE_DIRECTORIES(BEFORE ${CMAKE_FIND_ROOT_PATH}/include)
to my toolchain file, but it would have been nice is cmake did it for
me.
Wookey
--
Principal hats: Balloonz - Toby Churchill - Aleph One - Debian
http://wookware.org/
More information about the CMake
mailing list