In my CMake build system, I autogenerate a header file. Previously, I was doing something like this
// old_auto_gen_file.hpp
#define VERSION_STRING "@VERSION_STRING@"
#define VERSION_MAJOR @VERSION_MAJOR@
where the @...@ get filled in through CMake.
I'd like to lose the #define if possible. I was thinking something like this
// new_auto_gen_file.hpp
static const std::string VERSION_STRING("@VERSION_STRING@");
static const int VERSION_MAJOR(@VERSION_MAJOR@);
However, I'm very confused if this is legit or not? Is this cool with c++11?
std::stringpart worked though. Figured I'd ask y'all to see if there could be potential problems.