I want to know how to make Cmake give me a target that will allow me to save the .i files from my C program with the macro expansion, etc completed.
Will I need to make a custom target to do this?
I want to know how to make Cmake give me a target that will allow me to save the .i files from my C program with the macro expansion, etc completed.
Will I need to make a custom target to do this?
If your are using the Makefile generator, then there are already targets for .i files. Type
make help
, and you will see all the targets, including those suffixed by.i
,.s
, and.o
.If you don't want to manually run the make targets and filter for .i extensions, you could do it like this:
Alternatively, I sometimes used
compile_command.json
withnpm
's command line tool for json:Note however that there might be edge cases (like target directories that have not been created yet).