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

Eric Noulard eric.noulard at gmail.com
Sat Jul 11 18:09:02 EDT 2009


2009/7/11 Marcel Loose <loose at astron.nl>:
> 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.

I don't know if you can persuade CMake to keep those for "compiling"
ASM instead of C but you may be you get the
currently added definitions using properties:
(on directory, target or source
 see cmake --help-properties)

e.g.:

get_directory_property(ASM_DEF DEFINITION)

then use the value of ASM_DEF in your *ASM*.cmake.

Take my opinion as "pure guess" because I does not know
much on how CMake*Compiler.cmake works so I don't know
if you may "share" some variables values between
the standard C  and your custom ASM.


> 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.


-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list