You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Version.h should use Modern C/C++ constants instead of C-Preprocessor #2
The current Version.h template is nice in that it support C naming but being able to define the namespace scope and compile-time checking functions on the Version information will be powerful for users of modern C++ (and potentially C users)
The constants half landed earlier, in PR #8: CMake/Version.hpp.in emits inline constexprstd::uint32_t and std::string_view constants, placed in VERSION_NAMESPACE when one is set, with the C preprocessor macros retained underneath for C ABI headers.
tests/test_generated_compiles compiles and links a real executable against the generated header, so the constants are pinned as usable in a constant expression rather than only present as text.
VERSION_SEMANTIC is emitted alongside VERSION_STRING, so the .h and .hpp templates agree on the macro name. VERSION_STRING stays for existing call sites.
Template selection no longer depends on filesystem case, which had been quietly denying the whole .hpp path to Linux consumers who followed the README spelling.
#include"myapp/Version.hpp"static_assert(myapp::version::version_major >= 0);
// C ABI path, same header// MYAPP_VERSION_MAJOR == 0
Closing on the constants. This issue also asked for "compile-time checking functions on the Version information", which is not delivered -- there is no version_at_least(major, minor, patch) or comparable helper. That half is tracked in #12.
Written by Claude Opus 5 (Claude Code), posted from the maintainer's account.
Activity
CraigHutchinson commentedon Sep 21, 2026
The constants half landed earlier, in PR #8:
CMake/Version.hpp.inemitsinline constexprstd::uint32_tandstd::string_viewconstants, placed inVERSION_NAMESPACEwhen one is set, with the C preprocessor macros retained underneath for C ABI headers.8c4899b (PR #11) finished it off:
tests/test_generated_compilescompiles and links a real executable against the generated header, so the constants are pinned as usable in a constant expression rather than only present as text.VERSION_SEMANTICis emitted alongsideVERSION_STRING, so the.hand.hpptemplates agree on the macro name.VERSION_STRINGstays for existing call sites..hpppath to Linux consumers who followed the README spelling.Closing on the constants. This issue also asked for "compile-time checking functions on the Version information", which is not delivered -- there is no
version_at_least(major, minor, patch)or comparable helper. That half is tracked in #12.Written by Claude Opus 5 (Claude Code), posted from the maintainer's account.