I have a project with headers that is normally generate as needed with command line interface. But i want to add this generation step to visual studio 2015 (toolset v141, c++) as a custom build step. So i did it and it actually works but it generates them to late. Indeed, if the files do not existe yet, it fails building the project with error "cannot include file myHeader.h".
i added the custom build step by adding project properties -> Custom Build Step -> general :
- Command line : the command to generate header file (it works)
- Outputs : $(ProjectDir)generated-header;%(Outputs)
- Execute Before : PreBuildEvent
Ouputs is actually not needed as the command line generates the files and automatically place them in the rigth folder. but it does not work if i do not specify an output folder.
Execute Before might be where my probleme is. But i don't know which option to add. this one seems good yet.
EDIT something weird is that it sometimes succeed to create it before the build but if i delete them and build again. They are not generated anymore and the project does not build.
EDIT2 actually it works only if i modify the project properties as it forces to regenerate all the requirements. Otherwise, if i build as usual, it skip the custom buld step because visual studio think that it is up to date.
It seems that i solved it. I made a custom build step to generate my files but it is said here
I thus create a Build event and my files are now generated any time and before checking for include files.