[CMake] FindBoost problem when cross-compiling

ross hennessy roscoh at gmail.com
Tue Mar 31 02:21:31 EDT 2009


> In your toolchain file, what do you have
> CMAKE_FIND_ROOT_PATH_MODE_INCLUDE set to? If it is set to ONLY, then
> cmake will only look in the CMAKE_FIND_ROOT_PATH for boost, which is
> probably set to $QNX_TARGET. Since you most likely don't have boost in
> your $QNX_TARGET directory, findBoost will fail. I set it to BOTH in my
> toolchain file, although I'm not sure this is entirely a good idea.

You have been very helpful again. This does indeed solve the problem.

> Alternatively you can copy the boost tree into $QNX_TARGET/usr/include
> or somewhere. Maybe there's a better solution I'm not aware of?

This got me reading on the right track and I found a section in the
cmake cross-compiling documentation at
http://www.vtk.org/Wiki/CMake_Cross_Compiling which mentions that you
should create a directory for additional library dependencies "and add
this to CMAKE_FIND_ROOT_PATH, so the FIND_XXX() commands will search
there too." So I was also able to solve the problem by setting
CMAKE_FIND_ROOT_PATH_MODE_INCLUDE to ONLY and adding $ENV{BOOST_ROOT}
to CMAKE_FIND_ROOT_PATH. I'm happy with this solution as it gives me
more control over where the FIND_PATH is searching (I also don't like
the idea of copying multiple versions of boost to different install
locations for all the required targets).

Thanks, Ross


More information about the CMake mailing list