Add support for C++ modules#1051
Add support for C++ modules#1051mikomikotaishi wants to merge 1 commit intoleethomason:masterfrom mikomikotaishi:master
Conversation
|
I still don't know about the module thing - I see the use. But the PR does multiple things - updates docs (which seems good, at quick glance), adds a #define for a constant (which doesn't seem necessary), as well as the modules. At the least, this needs to be broken up - start with docs, I think? |
|
OK, I can split this PR into multiple PRs |
The reason this is done is because macros cannot be exported by modules, and must be converted to actual symbols in order to be exportable. The simplest way to be exportable is to make them inlined compile-time constants, which will have external linkage, but this is only necessary for modules. |
|
First made a PR updating the README and another for the constants definitions and linkage. After that I'll re-make the modules PR. |
This PR proposes C++ module support, for users of C++20 and later who prefer to use modules to access the library rather than headers. This feature is enabled by passing
tinyxml2_BUILD_MODULEto CMake, and generates a moduletinyxml2, identical to the namespace. I have further updated the README with additional improvements to formatting (such as highlighted blocks).A previous PR, #1002, proposed C++ modules, however was rejected for including additional build system support beyond CMake (the officially supported build system). It was mentioned that modules are "much more modern" than TinyXML, but this proposal does not increase minimum C++ version required, as the feature is opt-in.