MantisBT - CMake
View Issue Details
0011296CMakeModulespublic2010-10-07 03:472016-06-10 14:31
Florent Teichteil 
Richard Shaw 
normalminoralways
closedmoved 
CMake-2-8 
 
0011296: FindwxWidget.cmake prevents from cross compiling for Windows under Linux
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 0006187. 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
No tags attached.
has duplicate 0014092closed  FindwxWidget.cmake doesn't work when cross-compiling 
Issue History
2010-10-07 03:47Florent TeichteilNew Issue
2010-10-07 08:37Miguel FigueroaStatusnew => assigned
2010-10-07 08:37Miguel FigueroaAssigned To => Miguel Figueroa
2013-01-30 19:44abmaNote Added: 0032183
2013-04-16 02:25Rolf Eike BeerRelationship addedhas duplicate 0014092
2013-06-03 11:40Richard ShawNote Added: 0033213
2013-10-13 15:40Richard ShawNote Added: 0034115
2014-03-26 21:51Orion PoplawskiNote Added: 0035534
2014-08-20 09:32Richard ShawNote Added: 0036655
2014-08-20 10:26Richard ShawAssigned ToMiguel Figueroa => Richard Shaw
2014-08-20 10:26Richard ShawStatusassigned => acknowledged
2014-08-25 09:04Richard ShawNote Added: 0036674
2016-06-10 14:28Kitware RobotNote Added: 0041751
2016-06-10 14:28Kitware RobotStatusacknowledged => resolved
2016-06-10 14:28Kitware RobotResolutionopen => moved
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0032183)
abma   
2013-01-30 19:44   
i ran into the same bug. the suggested changes fixed it for me, too, please fix ASAP!
(0033213)
Richard Shaw   
2013-06-03 11:40   
Same fixed worked for me!
(0034115)
Richard Shaw   
2013-10-13 15:40   
This is an extremely simple patch and it is a pain to reapply every time a new cmake build gets installed on Fedora. Can someone please evaluate this and get it fixed?
(0035534)
Orion Poplawski   
2014-03-26 21:51   
Miguel - are you still responsible for for FindwxWidgets.cmake?
(0036655)
Richard Shaw   
2014-08-20 09:32   
Ok, I don't know how to reassign the bug to me but I'm now the upstream mantainer for {FindwxWidgets,UsewxWidgets}.cmake.

I plan on implementing this patch but I have some other observations:
1. Checking for platforms to determine which type of paths to use is inherently broken. Any new platform that's added will likely require that the conditionals be updated. It would be better to check by capability but I'm not sure how to do this.
2. In lieu of implementing a capability based solution, I would like to add an option so users can force it to be one or the other for corner cases.
3. Just noticed this... Do we really need the 2nd if(...) conditional? Although we may have all current cases covered from a practical point of view, from a technical point of view it's possible to fail both conditionals and not set the path type at all.
(0036674)
Richard Shaw   
2014-08-25 09:04   
Basic fix has been submitted for inclusion to the next release.

http://cmake.org/gitweb?p=stage/cmake.git;a=patch;h=33286235048495ceafb636d549d9a4e8891967ae [^]
(0041751)
Kitware Robot   
2016-06-10 14:28   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.