Re: [CMake] Finding out the Endianness of a system at CMake config time

2006-11-23 Thread Stephan Tolksdorf
Sean McBride wrote: Remember that using TRY_COMPILE/TRY_RUN or any method that runs code on the build machine breaks cross-compilation. (...) Since a compiler knows what CPU it is compiling for (by definition), I think a better solution, in general, is to query the compiler. See Boost's

[CMake] Finding out the Endianness of a system at CMake config time

2006-11-22 Thread Mike Jackson
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

Re: [CMake] Finding out the Endianness of a system at CMake config time

2006-11-22 Thread Eric Noulard
May be you could use TRY_RUN to detect endianity with something like: TRY_RUN( ENDIANESS_RESULT ENDIANESS_COMPILE /tmp/ ${CMAKE_CURRENT_SOURCE_DIR}/make/endianess.c OUTPUT_VARIABLE ENDIANESS_OUT ) MESSAGE(STATUS ENDIANITY is :${ENDIANESS_OUT}) endianess.c is attached. The trouble I

Re: [CMake] Finding out the Endianness of a system at CMake config time

2006-11-22 Thread Brandon J. Van Every
Eric Noulard wrote: May be you could use TRY_RUN to detect endianity with something like: TRY_RUN( ENDIANESS_RESULT ENDIANESS_COMPILE /tmp/ ${CMAKE_CURRENT_SOURCE_DIR}/make/endianess.c OUTPUT_VARIABLE ENDIANESS_OUT ) MESSAGE(STATUS ENDIANITY is :${ENDIANESS_OUT}) endianess.c is

Re: [CMake] Finding out the Endianness of a system at CMake config time

2006-11-22 Thread Sean McBride
On 2006-11-22 19:00, Eric Noulard said: Sorry for my dummy answer: 1) There is a TestBigEndian.cmake already shipped with CMake (as of 2.4.3) 2) I should have checked ENDIANESS_RESULT and not ENDIANESS_OUT At the risk of repeating myself... :) Remember that using TRY_COMPILE/TRY_RUN or any

Re: [CMake] Finding out the Endianness of a system at CMake config time

2006-11-22 Thread Bill Hoffman
Sean McBride wrote: On 2006-11-22 19:00, Eric Noulard said: Sorry for my dummy answer: 1) There is a TestBigEndian.cmake already shipped with CMake (as of 2.4.3) 2) I should have checked ENDIANESS_RESULT and not ENDIANESS_OUT At the risk of repeating myself... :) Remember that