architecture - CMake Multiarchitecture Compilation -


I want to know how can I write a CMake setup that can be used by any compiler and OS using both x86 and x64 Allows to compile for architecture.

It would be great if the SIMKK had 32 / 64bit options outside the box. Not so, so you will need to apply one of the different compiler or generator dependent methods. Eg:

  • GCC (on Linux) and some other compilers, e.g. CFLAGS and CXXFLAGS to include the Sun Studio -m32 (32-bit build) or -m64 (64-bit build).

  • Use Windows, Visual Studio generator 64 bit generator, e.g. 32bit to compile 64-bit (x64)

    Semicare-G "Visual Studio 10 Win64" path \ to \ source \ dir

  • Mac OS X. Use the CMAKE_OSX_ARCHITECTURES to leave the "Win64" in the generator name to generate the CMake variable

    cmake -DCMAKE_OSX_ARCHITECTURES = i386 / path / to / source / dir 32 bit build will be compiled

    64 bit will be compiled from cmake -DCMAKE_OSX_ARCHITECTURES = x86_64 / path / / source / dir

    Semicax will create "-DCMAKE_OSX_ARCHITECTURES = x86_64; i386" / path / to / source / dir 96-bit universal binaries :)

    The above word has changed slightly.



Comments