[CMake] how to compile as 32bit on a 64bit Linux host ?

m.hergarden m.hergarden at euphoria-it.nl
Fri Feb 15 06:11:27 EST 2013


Can you share a bit more context? I suspect there may be no single
correct answer, as it depends on your situation what the best way is. If
you are using a toolchain file you will have to put the decision of
using that file outside of your cmake file. You can also opt to put a
check inside your cmake file and set compiler flags (-m32 / -m64)
accordingly.
Using a toolchain file is more flexible when releasing a project, but
autoconfiguring is nice when running builds on buildservers through
ctest scripts.

Regards,
Micha

On 02/15/2013 11:46 AM, Martin Koller wrote:
> Hi all,
>
> for the question above I found different answers on the web, so I'm puzzled
> and wanted to know an authoritative answer from the cmake gurus.
>
> What I found:
> http://www.vtk.org/Wiki/CMake_Cross_Compiling#Information_how_to_set_up_various_cross_compiling_toolchains
> => "On mixed 32/64 bit Linux installations cross compilation cannot be used to build for 32/64 bit only."
>
> but also:
>
> http://stackoverflow.com/questions/4131158/how-to-cross-compile-for-linux-x86-with-linux-amd64-cmake-and-g
> => talking about using a toolchain file ...
>
> so please tell me: what is the correct way or is there no way ?
>



More information about the CMake mailing list