[CMake] Problem finding files while cross-compiling

Pablo Yanez Trujillo shaoran at sakuranohana.org
Fri Feb 12 08:58:49 EST 2010


Hi

I need to compile a project with a arm cross-compiler. I've used
http://www.vtk.org/Wiki/CMake_Cross_Compiling to create my toolchain file=
:

----
# system name
set(CMAKE_SYSTEM_NAME "Linux")

# system version (in this case I choosed the kernel version)
set(CMAKE_SYSTEM_VERSION  "2.6.14-M5")

# the system pro
set(CMAKE_SYSTEM_PROCESSOR "armv4")


set(CMAKE_COMPILER_NAME_PREFIX "arm-9tdmi-linux-gnu-")

# the C Compiler
set(CMAKE_C_COMPILER "${CMAKE_COMPILER_NAME_PREFIX}gcc")

# the C++ Compiler
set(CMAKE_CXX_COMPILER "${CMAKE_COMPILER_NAME_PREFIX}g++")

# hardcode path just for test
SET(CMAKE_FIND_ROOT_PATH /home/PSE/yanez/projects/matrix500/buildtarget)

# 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)
SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
-----

Then I call cmake -DCMAKE_TOOLCHAIN_FILE=3D../arm-cross.cmake  ..

In /home/.../buildtarget I have libraries (e.g. ncurses) and tools that
already have been compiled with the arm-9tdmi-linux-gnu compiler.

My problem is that find_file/file_path do dot work as I expect. I have
some header files whose location path is determined by find_path but
cmake does not find the files: for example ncurses.h

find_path(NC_H ncurses.h DOC "...")
message("NC_H is ${NC_H}")

All I get is "NC_H is NC_H-NOTFOUND". When I use find_package(Curses)
then this file is found without problems. I've looked into the
FindCurses.cmake file and this file calls find_path twice and it seems
that it only functions if you call it so:

find_path(NC_H ncurses/ncurses.h ...)

If I do the same, then I get "NC_H is
/home/PSE/yanez/projects/matrix500/buildtarget/include". I don't
understand why.

I've create a dummy file buildtraget/lll/uuu und call

find_path(NC_H uuu ...) or find_path(NC_H lll/uuu ...)

in both cases the path of 'uuu' is not found. ???? I'm afraid I don't
understand how find_* really works.

What am I doing wrong?

Thanks
Pablo

--=20
Pablo Yanez Trujillo
OpenPGP Key: http://www.sakuranohana.org/gpg/shaoran.asc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100212/089bd807/attachment-0001.pgp>


More information about the CMake mailing list