Generating intermediate assembly files during compilation

Hi,

I want to make CMake generate intermediate assembly files for my C/C++ source code files and assemble them into object files in two distinct steps, and I want to know the most correct way of doing this.

If this requires platform-specific magic, I only need to make this work on Linux and with GNU toolchain.

In case anyone want to know the reason, it is because I want to patch these assembly files with an external program.

Thanks.