I'm trying to add a custom build step after the preprocessing using cmake.
After the c++ preprocessor step, I want to call a python script on each preprocessed source files to modify them. Here a Makefile example:
all : prog
#compilation step
prog: main.i
gcc main.i -g -Wall -o prog
#custom step
main.i: main.tmp
./my_script.py main.tmp > main.i
#only preprocessor step
main.tmp: main.c main.h
gcc -E main.c > main.tmp
how to achieve this with cmake ? The step should be applied on each c or cpp files of the project.
Indeed, this had to be done manualy : I added a custom target where I generate the preprocessed files:
with another custom target, I make a backup of main.cpp and then rename main.cpp.i into main.cpp. I can then apply my preprocessing process. Afterwards, I restore the source files.