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

Hendrik Sattler post at hendrik-sattler.de
Thu Sep 25 18:57:38 EDT 2008


Am Thursday 25 September 2008 23:50:33 schrieb Stefan Weber:
> I think I was not clear enough here: it is not working when I combine ASM
> source files and CXX source files and as I found out by now, this is
> probably not supported anways. (Mixing ASM and C++ source files would be
> the ideal scenario because I can do it with g++ directly, too)

Maybe I wasn't clear either: I use it on a mixed C/C++/ASM binary. 
Cross-compiling though but that shouldn't matter.

> Note the capital S in the file extension of the ASM file. It seems this is
> crucial: when I rename to a small s and manually pass it to g++ it does not
> work anymore. When I leave the cap S, it works. Looking a bit deeper shows
> that the ASM file has preprocessor macros in it, so it needs to go through
> g++ (and obviously g++ only looks at it if the S is capital)... now I'm
> totally confused...

Then tell CMake that this needs to go to the C++ compiler, not the assembler:
set_property (SOURCE myfile.S PROPERTY LANGUAGE CXX)

Else you should make you .S file work with as and not silently assume that g++ 
or gcc is used for it.

HS


More information about the CMake mailing list