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

Benjamin Reed rangerrick at gmail.com
Fri Sep 8 11:03:06 EDT 2006


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

> Actually it's not invalid to compile it.  That's what a cross-compiler
> does.  It's invalid to run it.  CMake already has this distinction
> between TRY_COMPILE and TRY_RUN, so if TRY_RUN is used inappropriately,
> that's user error.  If CMake knows it's in some kind of
> cross-compilation mode, it can disallow TRY_RUN and deliver an error.

I don't know if this is what he meant, but at least as far as
universal binaries are concerned, TRY_COMPILE *can* cause issues.

For example, there are a number of autotool'd things that I have built
as universal binaries which fail to build out of the box because they
do:

* checking endianness... big endian

(or whatever)

if you're cross-compiling, you'll *still* get the wrong answer for
half of the universal binary.  On Mac OS X, the proper thing to do is
have your headers directly check for __BIG_ENDIAN__ and then things
will be managed at compile-time depending on which half of the
universal binary happens to be building at the time.

Regardless, that's not really something CMake can solve, it's a bug in
the assumptions of people writing tests.

(sorry for the pseudo-digression, but there are issues with
TRY_COMPILE and the "universal binary" style of cross-compiling, so I
thought I'd mention it)


More information about the CMake mailing list