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?
CMake has targets built in for both assembler and preprocessor output. For a file called src.cpp
, CMake generates the target src.s
for assembler output and src.i
for the preprocessor output. It generates the assembler/preprocessor outputs for each target seperately in case the compile flags are different. Using the make generator for your CMake project, you can get the assembler and preprocessor outputs like this:
make src.s # assembler output
make src.i # preprocessor output
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With