[CMake] building 64bit and 32bit libraries from same source

Magnus Therning magnus at therning.org
Thu Dec 12 01:43:23 EST 2013


On Wed, Dec 11, 2013 at 11:44 PM, Jacob Avraham
<Jacob.Avraham at compass-eos.com> wrote:
> Hi,
> I'm running on a 32bit Linux and I'd like to build from the same source, libraries complied and linked as 32bit and 64bit.
> They should be installed in /usr/lib and /usr/lib64.
> How do I go about and do that?

Personally I've never tried to build a 64-bit app/lib on a 32-bit
machine, only the other way around.  Looking at the packages available
for my favourite Linux distribution (ArchLinux) there doesn't seem to
be a compiler that could go the way you want.  It should be possible
though, you just need to get your hands on a compiler:
http://stackoverflow.com/questions/7582218/gcc-compile-a-64-bit-binary-on-32-bit-platform

So, the easiest way in CMake would be to create different folders and
then generate makefiles/ninjafiles/whatever with different CFLAGS
settings.

/M


More information about the CMake mailing list