Hi all,

As mentioned in my previous post, there is a bug in the cmake module
FindwxWidgets.cmake that prevents any library using wxWidgets to cross
compile for Windows from Linux. Lines 192 to 198 are concerned by this bug:

IF(WIN32 AND NOT CYGWIN AND NOT MSYS)
  SET(wxWidgets_FIND_STYLE "win32")
ELSE(WIN32 AND NOT CYGWIN AND NOT MSYS)
  IF(UNIX OR MSYS)
    SET(wxWidgets_FIND_STYLE "unix")
  ENDIF(UNIX OR MSYS)
ENDIF(WIN32 AND NOT CYGWIN AND NOT MSYS)

The problem is that, when cross compiling from Linux for Windows, the
test "WIN32 AND NOT CYGWIN AND NOT MSYS" is true but find style should
be "unix", because the Windows-based wxWidget library is installed in a
unix environment.

Therefore, the following line replacement corrects this bug:

IF(WIN32 AND NOT CYGWIN AND NOT MSYS AND NOT CMAKE_CROSSCOMPILING)
  SET(wxWidgets_FIND_STYLE "win32")
ELSE(WIN32 AND NOT CYGWIN AND NOT MSYS AND NOT CMAKE_CROSSCOMPILING)
  IF(UNIX OR MSYS OR CMAKE_CROSSCOMPILING)
    SET(wxWidgets_FIND_STYLE "unix")
  ENDIF(UNIX OR MSYS OR CMAKE_CROSSCOMPILING)
ENDIF(WIN32 AND NOT CYGWIN AND NOT MSYS AND NOT CMAKE_CROSSCOMPILING)

The modified FindwxWidget.cmake module runs fine with the following
toolchain cmake file:

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)

Could this "patch" be applied in cmake svn, please?
All the best,
Florent
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to