[cmake-developers] [CMake 0011296]: FindwxWidget.cmake prevents from cross compiling for Windows under Linux

Mantis Bug Tracker mantis at public.kitware.com
Thu Oct 7 03:47:23 EDT 2010


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=11296 
====================================================================== 
Reported By:                Florent Teichteil
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   11296
Category:                   Modules
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2010-10-07 03:47 EDT
Last Modified:              2010-10-07 03:47 EDT
====================================================================== 
Summary:                    FindwxWidget.cmake prevents from cross compiling for
Windows under Linux
Description: 
Hi all,

There is a bug in the cmake module FindwxWidgets.cmake that prevents any
library using wxWidgets to cross compile for Windows from Linux. Please
note that this bug is different from issue
http://www.cmake.org/Bug/view.php?id=6187. Lines 192 to 198 are
concerned by the present 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

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-10-07 03:47 Florent TeichteilNew Issue                                    
======================================================================




More information about the cmake-developers mailing list