Generated sources and dependencies in Visual Studio

Maarten
Mon, 10 May 2021 15:07:50 +0000
Code

I have a Fortran project which I’m porting to Intel Visual Fortran (parallel studio) on Windows. CMake (in my case) generates the Visual Studio solution and project files.
A number of the source files are generated in pre build steps. Some of the generated files depend on non-generated files.

The problem I’m having is that the order of compilation of the source files is not correct which results in errors due to missing module (.mod) files. I assume that this is because the generated source files are not present at the start of the build, so the dependencies cannot be determined.

How can I fix this? I guess one option would be to create a separate target for generating the files, and another target for the actually building them. But I’m hoping there’s a more elegant solution.

Cheers,
Maarten

5 posts - 3 participants