[CMake] FIND_PATH/LIBRARY do not work when cross compiling.

Pablo d'Angelo pablo.dangelo at web.de
Tue Jul 31 14:03:27 EDT 2007


Hi all,

I'm trying the cross compilation support in the latest cvs, and am following 
the mingw wiki page (I'm on ubuntu feisty):
http://www.cmake.org/Wiki/CmakeMingw

The example there works fine, but as soon as I try to use external 
libraries, it can't find them automatically. For demonstration, I have 
extended the example slightly:

CMakeLists.txt:

MESSAGE("CMAKE_FIND_ROOT_PATH: "  ${CMAKE_FIND_ROOT_PATH} )
MESSAGE("CMAKE_SYSTEM_LIBRARY_PATH: "  ${CMAKE_SYSTEM_LIBRARY_PATH} )
MESSAGE("CMAKE_INCLUDE_PATH: "  ${CMAKE_INCLUDE_PATH} )
MESSAGE("CMAKE_SYSTEM_INCLUDE_PATH: "  ${CMAKE_SYSTEM_INCLUDE_PATH} )
FIND_PACKAGE(JPEG REQUIRED)
ADD_EXECUTABLE(hello main.c)

And I get this output:

$ ~/src/other/cmake/CMake/bin/cmake --version
cmake version 2.5-20070730
$ ~/src/other/cmake/CMake/bin/cmake 
-DCMAKE_TOOLCHAIN_FILE=~/mingw/Toolchain-mingw32.cmake ..
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
including Windows-gcc.cmake
-- Check for working C compiler: /usr/bin/i586-mingw32msvc-gcc
including Windows-gcc.cmake
-- Check for working C compiler: /usr/bin/i586-mingw32msvc-gcc -- works
-- Check size of void*
including Windows-gcc.cmake
-- Check size of void* - done
including Windows-gcc.cmake
-- Check for working CXX compiler: /usr/bin/i586-mingw32msvc-g++
including Windows-gcc.cmake
-- Check for working CXX compiler: /usr/bin/i586-mingw32msvc-g++ -- works
CMAKE_FIND_ROOT_PATH: /usr/i586-mingw32msvc
CMAKE_SYSTEM_LIBRARY_PATH:
CMAKE_INCLUDE_PATH:
CMAKE_SYSTEM_INCLUDE_PATH:
CMake Error: Could NOT find JPEG
-- Configuring done

The jpeg library is installed in the system directories:
/usr/i586-mingw32msvc/include/jpeglib.h
/usr/i586-mingw32msvc/lib/libjpeg.a

Any idea whats going wrong here?

ciao
   Pablo


More information about the CMake mailing list