[CMake] How to use different assemblers in single build?

Alexander Neundorf a.neundorf-work at gmx.net
Fri May 11 15:36:47 EDT 2012


On Friday 11 May 2012, Alexey Istomin wrote:
> Is it possible to use different assemblers in single build with CMake?
> 
> I try to use CMake for building embedded application - statically linked
> elf file. Main CPU has 2 cores: general-purpose MIPS based core and DSP.
> Project has simple structure: main dir contains asm and C sources for Mips
> core, dsp-lib subdir has only asm sources for DSP core:
> 
> main/
>  crt0-mips.s
>  main.c
>  ...
>  dsp-lib/
>  fft.s
>  ....
> 
> GCC compiler and assembler are used for Mips sources, special assembler
> (dspasm) based on gnu should be used for DSP. Main should be linked with
> dsp lib into single elf file. I can successfully build main app without
> dsp-lib. But when I try to add dsp-lib subdir and set dspadm as assembler,
> CMake still uses mips-asm in the dsp-lib. Is it any solution? 

Yes.
You need to duse two different assembler "dialects", each "dialect" counts as 
a separate language to cmake, so you can have many in parallel.

So you should add e.g. a ASM-DSP dialect, and set the language of the source 
files to ASM-DSP.
This this assembler will be invoked on these files.
Adding an assembler dialect is not hard, you need just a few tiny files:
http://www.cmake.org/Wiki/CMake/Assembler

This page is slightly out of date, but the documentation how to add a new 
assembler is still valid.
Just have a look at the Modules/ directory for the ASM-related files, you 
should see how this works.

Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120511/c784e47d/attachment.htm>


More information about the CMake mailing list