c++ - How to use VC++ modules in CMake -


ms visual c++ 2015 update 1 implements modules proposal.

here example of how 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   # default flags cl.exe cl.exe /c c.ixx                     # produces c.obj, gm.ifc cl.exe /c b.ixx                     # depends on gm.ifc, produces b.obj, fm.ifc cl.exe /c a.cpp                     # depends on fm.ifc, produces a.obj link.exe a.obj b.obj c.obj          # produces a.exe 

dependency graph:

c.ixx → gm.ifc → b.ixx → fm.ifc → a.cpp      ↘            ↓             ↙        c.obj     b.obj    a.obj             ↘     ↓      ↙                  a.exe 

each module has 1 file.ixx exports.
file compiled modulename.ifc , file.obj.

if file imports module m, m.ifc file must present.
default cl.exe searches .ifc files in current directory, it's possible specify explicit names or 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, question is: how use vc++ implementation of modules in cmake?
it's not necessary use msbuild backend, ninja fine too.

i don't believe has done build system work c++ modules @ time. it's (microsoft) msbuild support first, cmake possibility.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

post - imageshack API cURL -

dataset - MPAndroidchart returning no chart Data available -