[CMake] Adding cross-compiler support to CMake ...

Benjamin Reed rangerrick at gmail.com
Mon Sep 11 13:15:11 EDT 2006


On 9/11/06, Brandon J. Van Every <bvanevery at gmail.com> wrote:

>  You'd have to trace through everything to see what's ultimately used.  I
> didn't mean, "Endianness checks in CMake are implemented directly with
> TRY_RUN."  Nor indirectly; I have no idea.  I meant, "Conceptually, an
> Endinanness check must be implemented by compiling and running code."
> Either that or the compiler correctly defines the Endinanness for you
> somehow, and you query it somehow.

Right; but what I'm saying is that conceptually, endianness checking
at configure time fails for universal binaries; because you're only
going to be right for the platform you're building on, not necessarily
the multiple platforms you're targetting.

When I build a universal binary, a single "gcc -o" command creates
multiple architecture binaries at the same time, encapsulated into a
single binary object.  If you decided at configure time what
endianness you have, it won't work, you have to do it at the time you
convert your .c (or whatever) to an object file.

It's a corner-case of "cross-compiling" unique to OSX (AFAIK) but I
wouldn't be surprised to see other platforms pick up on the idea, it
works pretty nicely.


More information about the CMake mailing list