[CMake] Multiple toolchains in one CMakeList?

Joshua Jensen jjensen at workspacewhiz.com
Tue Feb 5 09:52:52 EST 2008


----- 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.

In the build system I use for this, it looks something like this:

AddExecutable the_ppu_program :
    sourcefile1.c
    sourcefile2.c
    [ AddSPUProgram spu_program_1 : spufile1.c spufile2.c ]
    [ AddSPUProgram spu_program_2 : spufile1.c spufile3.c ]
;

Josh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20080205/5b5be71a/attachment.html


More information about the CMake mailing list