title: Mixing C and assembly sources and build with cmake
body: <p>I'm using eclipse for building a avr-gcc project that mixes assembly code and C source files.
  I want to get rid of the automatic makefile generation of eclipse because I need to automate some process into the makefiles and for other reasons.</p>
  
  <p>I used cmake some times ago and I was happy with it so I want to try to compile my source files using it. Everything run as expected with C sources. The problem is that at the end I need to compile some assembly files (actually 2) and add them to the target.</p>
  
  <p>I googled around but I didn't found a way for doing this. 
  someone have an idea on how to do this?</p>
  
  <p>The problem is that in eclipse I have
      -x assembler-with-cpp</p>
  
  <p>added to gcc argument list. I need to find a way for selectively add this param to the standard gcc argument list only for the asm files. I didn't find around any way for doing this. </p>
  
  <p>thank you in advance</p>
  
  <p>SOLUTION:
  set in CMakeLists.txt every file to compile in the same list</p>
  
  <pre><code>enable_language(C ASM)
  
  set ( SOURCES 
      foo.c
      bar.c
      foobar.s
  )
  
  add_executable(program  ${SOURCES} ) 
  </code></pre>
  
  <p>in the Toolchain file you should place:</p>
  
  <pre><code>SET(ASM_OPTIONS "-x assembler-with-cpp")
  SET(CMAKE_ASM_FLAGS "${CFLAGS} ${ASM_OPTIONS}" )
  </code></pre>
  
  <p>the second line is just if you need to pass extra options while compiling asm files. I wanted to pass all the CFLAGS plus some ASM_OPTIONS</p>