[CMake] Finding wxwidgets for cross compilation under linux

Florent Teichteil florent.teichteil at gmail.com
Mon Oct 4 11:50:04 EDT 2010


Hi,

I am trying to build a wxWidgets-based application on linux for a win32
host. The win32 wxWidgets library is installed in
/usr/i686-pc-mingw32/usr/local . I have q symlink from
/usr/i686-pc-mingw32/usr/bin/wx-config to
/usr/i686-pc-mingw32/usr/local/bin/wx-config .

The cmake macro FIND_PACKAGE (wxWidgets COMPONENTS base core aui xml
REQUIRED) does not find the win32 cmake. My toolchain file is:

SET(CMAKE_SYSTEM_NAME Windows)
SET(CMAKE_C_COMPILER   /usr/bin/i686-pc-mingw32-gcc)
SET(CMAKE_CXX_COMPILER /usr/bin/i686-pc-mingw32-g++)
SET(CMAKE_FIND_ROOT_PATH  /usr/i686-pc-mingw32)
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

If I comment the first line SET(CMAKE_SYSTEM_NAME Windows), cmake can
find wxwidgets but then it is unable to link my program with the correct
mingw tools (for instance, cmake uses /usr/bin/ar instead of
/usr/bin/i686-pc-mingw32-ar). Explicitly setting the i686-pc-mingw32-ar
command in the toolchain file does not help.

Looking at the FindWxWidgets.cmake file, it seems that cmake switches to
the win32 find style, what should nevertheless be the unix find style
for cross compilation, shouldn't it?

Thank you very much in advance,
Florent Teichteil.


More information about the CMake mailing list