[cmake-developers] Question about cross-compilation concept in CMake

Jiri Malak malak.jiri at gmail.com
Mon Mar 3 11:46:51 EST 2014


> On 03/01/2014 08:53 AM, Jiri Malak wrote:
>> I am working on full cross-compilation stuff for Open Watcom toolchain in CMake.
>> I study CMake internals, but I am not sure what is prefered method for cross-compilation by
>> CMake.
>> I see two concept one for Microsoft compilers where each target platform has own generator and
>> second one is for UNIX like toolchains which switch prefix/suffix to names for one architecture
>> per taget platform.
>
> The VS generator approach (w/ Win64 suffixes on generator name) came
> from way back when 64-bit tools first came out with VS and we needed
> a way to get the existing 32-bit-only VS generator to know it should
> use x64 instead.  It should not have been added to the generator name
> but it is too late to change now.  Also it was meant only for when
> the host system could run both architectures.  The ARM and WinCE
> variants were added later but so far no one has thoroughly determined
> the right way to do true cross-compiling with the VS IDE generators.
>
> Full cross-compiling support was added later for Makefile generators
> and is described here:
>
>  http://www.cmake.org/Wiki/CMake_Cross_Compiling
>
> The expectation is to use a CMAKE_TOOLCHAIN_FILE when the target arch
> cannot run on the host.
>
>> For Open Watcom looks better first approach, define one Generator
>> for each processor architecture, now 16 and 32-bit Intel processors,
>> next for 64-bit intel processor (as soon as OW will support
>> it) and define one target platform for each OS type.
>
> The target platform and native build system used should be treated
> orthogonally.  The target architecture does not belong in the generator
> name, and as explained above is only in VS for historical reasons.
>
> The preferred method for other generators is to have CMake detect the
> target information from the toolchain in use, or have it specified by
> an explicit CMAKE_TOOLCHAIN_FILE for true cross-compiling cases.
>
> -Brad
>
>
Thanks for your explanation.
It is hard for me to find some CMake concept document, that my question can be a little chaotic.
I didn't find any real example for true cross-compilation configuration.
I don't suppose that anybody will use 16-bit host, that I can take into account only Windows 32/64
and Linux 32/64 Intel hosts, potentialy OS/2 32-bit.
But Targets will be much more.

Thanks

Jiri





More information about the cmake-developers mailing list