[CMake] How to pass -D options when compiling assembly files using gcc?

Alexander Neundorf a.neundorf-work at gmx.net
Fri Jul 24 16:16:25 EDT 2009


On Monday 13 July 2009, Michael Wild wrote:
> On 13. Jul, 2009, at 10:28, Eric Noulard wrote:
> > 2009/7/12 Marcel Loose <loose at astron.nl>:
> >> Hi Eric,
> >>
> >> Thanks, I'll try that tomorrow. Another option that occurred to me
> >> today
> >> is that, since I'm using gcc to preprocess and compile the assembly
> >> sources, I might add .S as source file extension to
> >> CMAKE_C_SOURCE_FILE_EXTENSIONS. Any idea if that might work?
> >
> > I really don't know.
> > Like I said before I have no experience with ASM file and CMake
> > nor the definition of a new compiler variant with CMake.
> >
> > Once you have tried a little more, I'd rather let CMake developer
> > or CMake user with more expeperience in the field
> > answer that one :-)
> >
> >
> > --
> > Erk
> > Membre de l'April - « promouvoir et défendre le logiciel libre » -
> > http://www.april.org
>
> Hi
>
> I think I remember once having seen that for such a thing the LANGUAGE
> property on the .S files was being set to C. Might want to give that a
> shot...
>
> set(ASM_SRCS foo.S bar.S)
> set_source_files_properties(${ASM_SRCS} PROPERTIES LANGUAGE C)

That's a bit ugly but it should do what you want.

I think it's this bug: http://public.kitware.com/Bug/view.php?id=8392
and I'm not completely sure how to fix it.
Should I add a CMakeASM-GCCInformation.cmake, and use that if the extension 
is .S ? (...and set it up so that it keeps the definitions).

Do other C compilers also support compiling assembler files or is this only 
gcc ?

Alex


More information about the CMake mailing list