[CMake] cmake does not find modules when cross compiling

Bjørn Forsman bjorn.forsman at gmail.com
Wed Aug 17 09:49:20 EDT 2011


2011/8/17 Gonçalo Bernardo <goncalobernardo at gmail.com>:
> Dear all,
>
> I am using cmake and cmake-gui to cross-compile OpenCV. I wrote the
> following toolchain file:
>
> INCLUDE(CMakeForceCompiler)
>
> SET(CMAKE_CROSSCOMPILING TRUE)
>
> # this one is important
> SET(CMAKE_SYSTEM_NAME Linux)
> #this one not so much
> SET(CMAKE_SYSTEM_VERSION 1)
>
> # specify the cross compiler
> SET(CMAKE_C_COMPILER
> /usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-gcc)
> SET(CMAKE_CXX_COMPILER
> /usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-g++)
>
> # where is the target environment
> SET(CMAKE_FIND_ROOT_PATH  /media/rootfs /media/rootfs/usr)
>
> # search for programs in the build host directories
> SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
> # for libraries and headers in the target directories
> SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
> SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
>
> When i load this in cmake-gui i face some problems. the cross-compilers seem
> to be correctly identified but not the packages installed in my rootfs. for
> instance cmake-gui prints:
>
> checking for module 'libavcodec'
>
> package 'libavcodec' not found
>
> when libavcodec.so.52 is present in rootfs/usr/lib. The problem also happens
> with gstreamer, ffmpeg,...
>
> how can i find out which specific files is cmake looking for?
> any other suggestion on this?

Have you tried without this:

INCLUDE(CMakeForceCompiler)
SET(CMAKE_CROSSCOMPILING TRUE)

Best regards,
Bjørn Forsman


More information about the CMake mailing list