Yo guys, this is a short tutorial on setting up c++ modules inclusive of LSP support (via clangd).
Copy and paste-able relevant portion:
cmake_minimum_required(VERSION 4.1.2)
set(CMAKE_EXPERIMENTAL_CXX_IMPORT_STD "451f2fe2-a8a2-47c3-bc32-94786d8fc91b")
set(CMAKE_CXX_COMPILER /usr/bin/clang++)
set(CMAKE_C_COMPILER /usr/bin/clang)
set(CMAKE_CXX_MODULE_STD ON)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_FLAGS "-stdlib=libc++ -Wno-reserved-module-identifier")
Relevant links: github.com/Kitware/CMake/blob/v4.3.2/Help/dev/experimental.rst#c-import-std-support
(change it to your version, and prepend https://, it won't let me put links directly)
Music from: streambeats.com/
*Apologies, small correction, c++ modules are from 20, not 23. Import std however is 23.