C++20 module mapper
Alexander Christensen
alex_c007@hotmail.com
Tue Oct 19 15:58:06 GMT 2021
Hi, I hope I write to the right place.
I would like to know how to use the module mapper, documented here https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Module-Mapper.html,
to change the location of the expected gcm.cache directory. Given an example project layout:
src/
Makefile
project_1/
// .cpp source files
Makefile
project_2/
// .cpp source files
Makefile
Compiling from inside project_1 and project_2 folders does not work with the default module mapper, as gcc expects the module cache
to be located in current working directory, which is a problem if project_2 references modules built in project_1.
However, I can specify a module-mapping file. But I can't get it to work.
What would be the correct syntax for such a file, located in project_2, to override the default module cache to read from modules in
src/gcm.cache/ and NOT src/project_2/gcm.cache/ ? This does not work:
// module_mapping.txt
'$root' ../gcm.cache/
And I do not want to prepend "cd .. && " to all build commands in src/project_2/Makefile.
Sincerely,
Alexander
More information about the Gcc-help
mailing list