[cmake-developers] How to deal with assembler files

Brad King brad.king at kitware.com
Tue Aug 17 17:24:54 EDT 2010


On 08/17/2010 04:39 PM, Alexander Neundorf wrote:
> Still, there is the preprocessing bug.

I think some Fortran compilers need help with this too but we ignore
them right now.  I prefer a solution that may work for both, but just
for ASM for now.

In general the languages should be independent.  Both parts of your
proposal make ASM depend on C in one way or another.  It would be
best to add direct support for preprocessing sources.  We do not need
separate rules with dependencies for this; the preprocessing step
can be done at the same time as the compile step.

I envision something like this:

  SET(CMAKE_ASM_COMPILE_OBJECT
    "<CMAKE_ASM_PREPROCESSOR> <DEFINES> <INCLUDES> -o <OBJECT>.s -E <SOURCE>"
    "<CMAKE_ASM_COMPILER> <FLAGS> -o <OBJECT> <OBJECT>.s"
    )

(The <INCLUDES> token would need to be implemented for -I options.)

This first preprocesses to a source file right next to the object
file and then assembles it to create the object.  The preprocessor
can be the C compiler if C is enabled and /usr/bin/cpp otherwise
(but works either way).

-Brad



More information about the cmake-developers mailing list