Building C++20 Modules

Is there a general way to tell the linker that .mpp is a CXX extension?

I downloaded cxx-modules-sandbox and I was able to successfully build it by code like this after ever add_library:

set_target_properties(simple PROPERTIES LINKER_LANGUAGE CXX)

Obviously this had to be set for every target.
I am using Microsoft Visual Studio Community 2019
Version 16.5.2

Visual Studio builds OK, however when using ninja (version 1.10.0) the build fails with lots of linker errors for:

  • link-use
  • link-use-mask
  • good-scanner
  • generated

You need a patched CMake to use that repository. The latest version in use contains the .mpp extension logic needed (it’s not accessible from just CMake variables unfortunately). See the docker branch of the repo for the instructions to build the needed environment.

Thanks for this @ben.boeckel, I sounds like it’s a bit complicated to do at present.