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

Marcel Loose loose at astron.nl
Sat Jul 11 17:27:38 EDT 2009


Hi Bill,

The problem is not in the invocation of gcc. That works fine. The
problem is that I lose the preprocessor definitions that were added with
add_definitions() when compiling assembly files. These assembly files
must be preprocessed by gcc. I have the feeling that CMake purposely
drops these. So the question is how I can persuade CMake to keep the -D
options on the command line.

Note that I have defined an assembler for BG/P that uses gcc as
frontend, using the *ASM*.cmake macros mentioned in my previous mail.

Best regards,
Marcel Loose.

On Fri, 2009-07-10 at 11:29 -0400, Bill Lorensen wrote:
> gcc has a command line option:
> 
> -Xassembler <arg>        Pass <arg> on to the assembler
> 
> Will this help?
> 
> Bill
> 
> On Fri, Jul 10, 2009 at 10:41 AM, Marcel Loose<loose at astron.nl> wrote:
> > Hi all,
> >
> > I'm trying to build a library that has, amongst a number of C/C++
> > sources, a number of assembly files as input. These are .S files which
> > need to be cross-compiled for BG/P by gcc, not by as (or gas) directly.
> >
> > I have defined a number of preprocessor definitions (-D options) using
> > add_definitions(). I noticed that these options are not passed to the
> > command line when compiling the assembly files, only when compiling the
> > C/C++ sources.
> >
> > Is there any way I can pass these -D options to the assembler as well?
> >
> > If needed, I can attach the files CMakeASM-BGPInformation.cmake,
> > CMakeTestASM-BGPCompiler.cmake and CMakeDetermineASM-BGPCompiler.cmake
> > that I wrote.
> >
> > Best regards,
> > Marcel Loose.
> >
> >
> >
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.cmake.org/mailman/listinfo/cmake
> >



More information about the CMake mailing list