[CMake] Cross Compiling with cmake 2.8.5
Michael Hertling
mhertling at online.de
Fri Jul 29 16:35:25 EDT 2011
On 07/27/2011 04:28 PM, r.czerny at esa-grimma.de wrote:
> Hi all,
>
> I tried to cross-compile an internal application for windows on a linux
> machine,
> but failed, because cmake at some point re-start the configure process,
> and
> drops the CMAKE_SYSTEM_NAME variable along that way. Attached is a
> minimal CMakeLists.txt, which reproduces the problem.
>
> Is there a way to avoid the reconfiguration?
>
> TIA
> R. Czerny
>
>
> Console output:
> someone at debian-vm:~/cross/build$ cmake -DCMAKE_SYSTEM_NAME=Windows
> -DCMAKE_C_COMPILER=i586-mingw32msvc-gcc
> -DCMAKE_RC_COMPILER=i586-mingw32msvc-windres ..
> -- The C compiler identification is GNU
> -- Check for working C compiler: /usr/bin/i586-mingw32msvc-gcc
> -- Check for working C compiler: /usr/bin/i586-mingw32msvc-gcc -- works
> -- Detecting C compiler ABI info
> -- Detecting C compiler ABI info - done
> -- CC=TRUE CSN=Windows
> -- Configuring done
> You have changed variables that require your cache to be deleted.
> Configure will be re-run and you may have to reset some variables.
> The following variables have changed:
> CMAKE_RC_COMPILER= i586-mingw32msvc-windres
>
> -- The C compiler identification is GNU
> -- Check for working C compiler: /usr/bin/i586-mingw32msvc-gcc
> -- Check for working C compiler: /usr/bin/i586-mingw32msvc-gcc -- works
> -- Detecting C compiler ABI info
> -- Detecting C compiler ABI info - done
> -- CC=FALSE CSN=Linux
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /home/czerny/Quellen/hospec/foo/foo
When reconfiguring an already configured project, specifying certain
variables like CMAKE_C_COMPILER invalidates the cache and makes CMake
do another reconfiguration during which the command line settings are
lost, CMAKE_SYSTEM_NAME in your case; cf. [1-3]. AFAIK, the best you
can do is to use one build tree per toolchain from the first and
specify compilers by the environment variables CC, CXX, FC etc.
Regards,
Michael
[1] http://www.mail-archive.com/cmake@cmake.org/msg34486.html
[2] http://www.mail-archive.com/cmake@cmake.org/msg37060.html
[3] http://public.kitware.com/Bug/view.php?id=9980
More information about the CMake
mailing list