Document C++20 module usage with CMake - #4891
Open
way4sahil wants to merge 2 commits into
Open
Conversation
way4sahil
force-pushed
the
docs/4237-cxx20-modules
branch
from
August 23, 2026 10:04
305e02e to
d0d9ada
Compare
vitaut
requested changes
Aug 24, 2026
vitaut
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the PR.
The documented example can fail because fmt::fmt-module is only defined when FMT_MODULE is enabled. Could you mention that FMT_MODULE needs to be enabled before adding fmt (or otherwise ensure modules are enabled via CMAKE_CXX_STANDARD)? This is already mentioned in the PR description but not in the documentation itself.
Also, the GCC/CMake/Ninja versions listed here seem to be requirements for CMake’s native module support rather than for fmt::fmt-module in general, since fmt also has the fallback path.
vitaut
reviewed
Aug 24, 2026
| import fmt; | ||
|
|
||
| int main() { | ||
| fmt::print("Hello, world!\\n"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds CMake guidance for using {fmt} as a C++20 module.
FMT_MODULEbefore adding {fmt} as a subdirectoryfmt::fmtimport fmt;in consumer source filesFixes #4237.