[CMake] Multiple toolchains in one CMakeList?

Alexander Neundorf a.neundorf-work at gmx.net
Tue Feb 5 14:42:15 EST 2008


On Tuesday 05 February 2008, Joshua Jensen wrote:
> ----- Original Message -----
> From: Brandon Van Every
> Date: 2/5/2008 7:23 AM
>
> > On Feb 5, 2008 6:50 AM, John Spray <john.c.spray at googlemail.com> wrote:
> >> Is it possible to build certain objects for one architecture and
> >> certain objects for another?
> >
> > Not in the same build.  You'd need 2 different invocations of CMake.
> > You could have 1 CMake use an execute_process to call the other CMake.
> >  The foreign build would need to output a library that the host build
> > recognizes as usable.  Otherwise you'd have to take over linking
> > manually with some kind of add_custom_command, however you usually get
> > it to work.  Why do you need the foreign code embedded in the host
> > library?  Wouldn't shipping libraries for multiple platforms be
> > enough?
>
> I'll give a simple example, if I'm understanding the request.  For the
> PS3, you link SPU code in the PPU executable.  SPU code is just .c/.cpp
> files, possibly with libraries linked in.  In any case, there are two
> separate toolchains needed, one for PPU code and one for SPU code.

Yes, I didn't forget that case.
Currently it is not possible to mix toolchains within one cmake project (you 
may be able to do some tweaks but nothin officially supported).
It would be a big new feature to support this, since then cmake has to be 
aware of multiple toolchains at once and use the correct (i.e. also multiple)  
CMakeCache.txt files accordingly.

Maybe you can come up with some macro which sets up things like the compiler 
and so on, but it won't work for compile tests etc.

Alex


More information about the CMake mailing list