Mike Jackson wrote:
I have recently joined a project where I am to do some coding. The
code base is cross platform HPC type code and the original coders have
defined their own little/big endian #defines (L_ENDIAN & B_ENDIAN).
They pass this into the compiler via -DL_ENDIAN during compiles.
Is there a way to automatically have cmake figure this out for me?
Right now I have an OPTION(....) clause in my CMakeLists.txt file to
select the right value.. which is stupid and error prone but it worked
to boot strap the process for the moment.
Any hints would be appreciated..
You could do a TRY_COMPILE with a snippet of C code that tests for
endinanness. I always forget how to write such a snippet off the top of
my head. I typically look at an Autoconf ./configure script to see what
they did, or Google around for it. The Chicken Scheme CMake build has
an example of detecting whether the stack grows downward, in
StackGrowsDownward.c.
Cheers,
Brandon Van Every
_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake