[CMake] Recommended Multilib Build Approach?

Eric Noulard eric.noulard at gmail.com
Tue Jul 31 07:22:21 EDT 2012


2012/7/31 m.hergarden <m.hergarden at euphoria-it.nl>:
> On 07/30/2012 11:28 PM, Xavier Besseron wrote:
>>
>> This is quite independent of CMake. It works with other build systems
>> like autotools/makefile as well.
>>
>> CFLAGS="-m32" CXXFLAGS="-m32" tells CMake to pass the '-m32' to the C
>> and C++ compilers.
>> It tells the compiler to generate code that runs on any i386 system
>> (cf gcc manpage).
>>
>> LDFLAGS="-melf_i386" tells CMake to pass the '-melf_i386' to the linker.
>> It tells the linker to use the i386 ELF format for the binary (cf ld
>> manpage).
>>
>> This works for GNU compiler/linker at least. I haven't tried other
>> compilers.
>
> On Linux there is an application called linux32 that changes the way the os
> presents itself to an application. It will help the cmake modules make
> better decisions about the platform they are building on.

Thank you Micha, I wasn't aware of that.
It appears that the generic tool behind linux32 is "setarch"

Here is a link for reference:
http://linux.die.net/man/8/linux32
http://linux.die.net/man/8/setarch

I never tried it with cmake for building 32 vs 64 binaries on 64 bits system,
I'll try it.
-- 
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org


More information about the CMake mailing list