← Back to context

Comment by pjmlp

14 hours ago

As far as I am aware, there no integrations available with Visual Studio, and not sure about C++20 modules and import std support.

A few weeks ago I decided to test C++ modules, but I had a hard time to figure out how to make them accepted by CMake. After a few days of struggle with `set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "d0edc3af-4c50-42ea-a356-e2862fe7a444")` (it was so hard to find the right UUID that worked with my version) and errors on `import std;`, I decided to give XMake a chance.

It took just a couple of minutes to have a working example that fully supported C++ modules and `import std`:

    set_languages("c++23")

    add_rules("mode.debug", "mode.release")

    target("mytest")
        set_kind("static")
        add_files("src/*.cpp")
        add_files("src/*.cppm", {public = true})
        set_policy("build.c++.modules", true)