MS Visual C ++ 2015 Update 1 implements a proposal of modules .
Here is an example of how this works:
Sources:
// c.ixx | // b.ixx | // a.cpp module GM; | import GM; | import FM; export void g() {} | module FM; | int main() { f(); } | export void f() { g(); } |
Build Commands:
set CL=/EHsc /experimental:module
Dependency Graph:
c.ixx → GM.ifc → b.ixx → FM.ifc → a.cpp ↘ ↓ ↙ c.obj b.obj a.obj ↘ ↓ ↙ a.exe
Each module has one file.ixx with its export.
This file will be compiled into ModuleName.ifc and file.obj .
If the file imports the M module, the M.ifc file must be present.
By default, cl.exe searches for .ifc files in the current directory, but you can specify explicit names or a search path:
cl.exe /c a.cpp -- or -- cl.exe /c a.cpp /module:reference FM.ifc -- or -- cl.exe /c a.cpp /module:search ./
So the question is: How to use the implementation of VC ++ modules in CMake ?
No need to use the MSBuild backend, the ninja is fine too.
c ++ visual-c ++ cmake c ++ - modules
Abyx
source share