auto generate dependencies for modules

Viewed 52

I start currently to understand modules

If we want to use import <iostream>; instead of old style #include <iostream> we need to "precompile" the iostream header file. We can do it manually by simply invoking g++ with:

g++ -xc++-system-header -std=c++20 -fmodules-ts iostream

But this needs a manually created set of rules for all used system header files for gnu make with all the dependencies pointing to the gcm.cache directory structure.

In case of old style #include directives, we simply have the -M or -MM flags to generate such dependencies for make automatically.

Q: How we can get such dependencies from g++ for imported modules automatically to set up the rules for gnu make?

The target is quite simple: Get all needed .gcm files precompiled before the build system needs these files for import.

0 Answers
Related