cmake

Generate assembly for a target


I am trying to pass -S to GCC for one of my executables. I tried this:

set_target_properties(MyTarget PROPERTIES COMPILE_FLAGS "-S") 

but I get "file format not recognized; treating as linker script"

(It builds fine without that line)

Is there something wrong with passing -S like this? Or is there another way to have CMake output the assembly .s files?


Solution

  • If you're trying to actually build MyTarget and leave the generated assembly, you can replace -S with -save-temps and then do make MyTarget