title: Processing assembler files in cmake
body: <p>I'm trying to create a binary file in cmake which:
   - depeneds on some .c source files
   - also depeneds on an assembler .s file</p>
  
  <p>Now I have added the .c files normally by setting a variable as a list which contains all .c files in a directory. All good so far.</p>
  
  <p>Now I need to add that assembler file as well as part of my binary directory. I did some research in the mailing archieve of cmake and I saw that with assembler files it's a little different you can't just include them as you do with the c files. You have to sometime preprocess them and include their output as a dependecy to the final binary file. Or so I understood.</p>
  
  <p>The way I tried to do it in my project is something like this:</p>
  
  <ul>
  <li>get assembler file name and path using a get_filename_component command:</li>
  <li><p>in an 'add_custom_command' preprocess the file like this:</p>
  
  <p>COMMAND ${COMPILER_NAME} --preprocess=p ${ASSEMBLER_FILE_NAME} > 
      ${OUT_S_FILE}
  Where OUT_S_FILE will be added as a dependency to a target which will be then added as a dependency to the binary file so that it gets created before the binary is created. Now I do not understand the --preprocess=p argument I tried googleing it but to no avail I do not know if it's correct or what it actually does(I have seen it in an example which took care of some assembler files).</p></li>
  <li><p>set a variable: "ASM_OUT_FILE" to path of the file processed above</p></li>
  <li>create a custom target which depends on this "ASM_OUT_FILE"</li>
  </ul>
  
  <p>Finally add this target as a dependency so it gets created before the binary is created.</p>
  
  <p>I'm sorry I cannot provide more actually example for what I've done but it's work related :D.</p>
  
  <p>The result is "no rule to make target for that assembler file" as if the file was not there but it is(I checked). </p>
  
  <p>Please tell me if possible if there are other things I need to do or if I'm doing something wrong in handling this assembler file. Thank you for reading and I'm sorry if my erxplanation was not so clear!</p>
  
  <p>Edit:</p>
  
  <pre><code>set_source_files_properties(assembly_file.s PROPERTIES COMPILE_FLAGS "-x assembler-with-cpp")
  </code></pre>