r/cpp • u/TheRavagerSw • Aug 26 '26
Libraries trying to support multiple build configurations and standards are harming their health
Some libraries try to support:
- Header/Source
- Header only
- Header only + Module Wrapper
- Header/Source + Module Wrapper
- All standards between and including C++11 and C++23
- Exceptions and noException
- RTTI and noRTTI
At the same time.
These libraries are very very hard to read and thus they get less and less contributions over time.
What should be done:
- Libraries should support only one mode of compilation, header only header source etc
- Libraries should support exactly one standard, and that standard includes extensions, gnu++23 and c++23 are not the same thing
- Libraries should very clearly have boundaries on what belong in a toolchain and what belongs to project. For example a library should not set flags related to exceptions that's a toolchain issue.
Some extra stuff:
- C++ libraries without C API's should not be consumed via system package managers at all, and public libraries shouldn't try to adhere to that.
- Libraries shouldn't try to use tools they build to build themselves, rather they should export packages like wayland::scanner etc and use that.