<ins/>Sample千呼万唤的 CMake 官方 C++ Modules 支持总算来了,主要就是用到了 target_sources 指令的 file_set 特性(3.28 支持 CXX_MODULES),文档在这里:target_sources — CMake 3.31.0-rc3 DocumentationRepeated calls for the same <target> append items in the order called.https://cmake.org/cmake/help/latest/command/target_sources.html#file-sets 用法相当简单,只需要对想添加 modules 源文件的 target 使用 target_sources+ FILE_SET CXX_MODULES 指定即可,下面是一个简单的例子: 对应的源文件:在 MSVC 17 2022 下成功编译运行。参考资料Modules (since C++20) - cppreference.comMost C++ projects use multiple translation units, and so they need to share declarations and definitions across those units. The usage of headers is prominent for this purpose, an example being the standard library whose declarations can be provided by including the corresponding header.https://en.cppreference.com/w/cpp/language/modulestarget_sources — CMake 3.31.0-rc3 DocumentationRepeated calls for the same <target> append items in the order called.https://cmake.org/cmake/help/latest/command/target_sources.htmlHow to use c++20 modules with CMake?Clang and MSVC already supports Modules TS from unfinished C++20 standard. Can I build my modules based project with CMake or other build system and how? I tried build2, it supports modules and it...https://stackoverflow.com/questions/57300495/how-to-use-c20-modules-with-cmake上一篇地表最强 Contact Shadow下一篇AMD ROCm 6.4.4 纯血 Windows 预览版尝鲜下一篇AMD ROCm 6.4.4 纯血 Windows 预览版尝鲜