[CMake] FindSWIG and cross compiling

Hendrik Sattler post at hendrik-sattler.de
Mon Oct 26 11:02:36 EDT 2009


Zitat von Giampiero Salvi <giampi at kth.se>:
> I have a project that builds fine both on Linux and on mingw32 using
> cmake version 2.6-patch 2.
>
> Now, I am trying to cross compile my project on a Linux (Ubuntu 9.04)
> machine for the target Windows platform using the mingw32 cross
> compiler. I have a toolchain more or less copied from
> http://www.itk.org/Wiki/CmakeMingw that looks like this:
[...]
> I get the error:
>
> CMake Error at /usr/share/cmake-2.6/Modules/FindSWIG.cmake:55 (MESSAGE):
>   SWIG was not found.  Please specify Swig executable location

This is caused by CMAKE_FIND_ROOT_PATH_MODE_INCLUDE not only affecting  
include files but all files found with find_path() or find_file().
FindSWIG.cmake needs a NO_CMAKE_FIND_ROOT_PATH at the end of the  
find_path() call since it will most likely always be the one on the  
host (any other will give you wrong paths).
The find_program() on top of it definitely needs a  
NO_CMAKE_FIND_ROOT_PATH as it is used for execution just below of that.

Not all cmake modules are ready to be used for cross-compiling and  
some probably will never (e.g. FindQt4.cmake).

HS




More information about the CMake mailing list