Closed claremacrae closed 3 years ago
For header-only libraries, I generate a version header this way. Unlike the example, I prefer to use constexpr
instead of macros for type-safety.
Thanks @jwillikers
Can I check that I understand...
We now have this:
That generates a #define
in each release...
Are you suggesting to change that to something constexpr - if so, I hadn't see that before, but I like that idea...
If not that, I'm unsure how your comment relates to CMake... can you expand on it, please?
I whipped up an example because I think that will explain things perfectly. 👨🏫
Example: https://github.com/jwillikers/cmake_configure_version_header
Standards before C++17 would use char[]
instead of std::string_view
.
Thanks @jwillikers - that example is really clear... And I see how this would be useful...
Not everyone who uses this project uses it with CMake, so I would stick with our current structure - but I see that constexpr is a nicer - type-safe - way of setting the various version numbers...
I'll set up a separate issue to convert the #define
approach in to constexpr
instead...
closing as not really needed
This arose out of #40
Originally posted by @dheater in https://github.com/approvals/ApprovalTests.cpp/issues/40#issuecomment-569137963