[CMake] Assembler and C++ for the same target

Hendrik Sattler post at hendrik-sattler.de
Sat Sep 27 15:27:01 EDT 2008


Am Thursday 25 September 2008 19:42:34 schrieb Hendrik Sattler:
> Am Thursday 25 September 2008 17:45:54 schrieb Stefan Weber:
> > I am working on a C++ project which is using a single assembler file
> > (among all the C++ files). In the mailinglist archives I found some hints
> > on how to use the experimental ASM mode. However, as I only have a single
> > ASM file, I'm not sure how to handle that: Ideally, I would like to pass
> > it to add_library with all the other source files (in the same way I can
> > pass it to C++ which automatically forwards it to the assembler). This is
> > not working,
>
> Stop. The next step is no logical one. If it doesn't work for one target,
> why should it for another?
>
> > cmake_minimum_required(VERSION 2.6)
> > project(TEST)
> > enable_language(ASM)
> > add_library(asmtest MyAsm.S)
>
> That looks fine.

I have to correct myself. Probably due to different incompatible ASM 
compilers, you have to set the LANGUAGE property of each ASM file with e.g.
  set_property ( SOURCE MyAsm.S PROPERTY LANGUAGE ASM )

It does _not_ work without that.

I found a bug with CMake-2.6.1 with this: a -Dasmtest_EXPORTS is given to as 
and my as from gcc-4.1.2 doesn't like that at all (aborts with an error).
Strangely, all other defines from the COMPILE_DEFINITIONS property are _NOT_ 
given in the as call (another bug, I assume).

HS


More information about the CMake mailing list