Alex Aparin
Alex Aparin

Reputation: 4522

How to compile and link generated files within msvc?

My msvc 2015 project has foo.smth file with custom build tool. That file is used to generate foo1.c and foo2.c source files, which will be located in temp/intermediate directory. Is there any way to compile and link such files using compiler and linker's options from my project? Maybe there is way to implicitly add such files for compiler and linker?

UPD: at the moment, foo.smth file has Item Type = Custom Build Tool. Its command uses third party application to generate .c files

Upvotes: 1

Views: 475

Answers (1)

Michael Kenzel
Michael Kenzel

Reputation: 15951

In the properies of your Custom Build Tool item, you should find the Add Outputs to Item Type property. If you set it to ClCompile (or select C/C++ compiler from the drop-down menu), that should cause the files listed in the Outputs property to be emitted as inputs for the C++ compiler. These should then automatically be compiled using your project's default C/C++ settings…

Upvotes: 1

Related Questions