[CMake] cross-compile and find_library
Davis Ford
davisford at gmail.com
Wed Sep 26 13:22:46 EDT 2012
Let me take another shot at this -- I created a gist that highlights the
problem: https://gist.github.com/3789287
I am supporting cross-compile for the Raspberry Pi Arm target in my
project, but I also build regularly on plain 'ol x86 linux so I can test
w/o having to go to the target. The Pi is awful slow at compilation, so I
want to do cross-compile also on Linux x86.
I am using 3rd party libraries from http://zeromq.org -- I have already
compiled them on the target hardware and checked them in to my project repo
directory structure:
Same libraries, compiled for different targets, stored in different paths
in my project directory structure.
I created a Toolchain file to cross-compile. So far that works fine, until
I want to go linking against the zeromq libraries.
Compiling for Linux/x86 works fine, and even compiling for Mac OS X but
when I run my Toolchain to cross-compile, it complains that it cannot find
the libraries for the target. I run the toolchain like this:
$ cmake -DCMAKE_TOOLCHAIN_FILE=../Toolchain-raspberrypi-arm.cmake ..
Using Raspberry Pi Tools found in
/home/davis/git/raspberrypi/toolsCMAKE_CROSSCOMPILING =>
TRUECMAKE_SYSTEM_NAME => Linux, PROJECT_SOURCE_DIR =>
/home/davis/git/ebike-firmware
CMAKE_CROSSCOMPILING is true...doing find_library for ZeroMQ...
CMake Error: The following variables are used in this project, but
they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the
CMake files:
CZMQ_LIB
linked by target "Runtime" in directory /home/davis/git/ebike-firmware/src
ZEROMQ_LIB
linked by target "Runtime" in directory /home/davis/git/ebike-firmware/src
-- Configuring incomplete, errors occurred!
The libraries, are indeed there. I thought using the
CMAKE_FIND_ROOT_PATH_MODE_LIBRARY
and the CMAKE_FIND_ROOT_PATH would force CMake to use an explicit path to
try to resolve libraries when you execute find_library, but even though the
files are there, it fails with NOTFOUND. Does it somehow inspect the
binary and consider its current architecture -- if it isn't a match, it
reports fail / NOTFOUND -- if so, how can I work around this?
Is there a better way to do what I'm trying to do??
On Mon, Sep 24, 2012 at 5:38 PM, Davis Ford <davisford at gmail.com> wrote:
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120926/63ec12f6/attachment.htm>
More information about the CMake
mailing list