Skip to content

[FR] BENCHMARK_VERSION is not set by default #1768

@PhilipDeegan

Description

@PhilipDeegan

Is your feature request related to a problem? Please describe.
Since a recent addition adding usage of "BENCHMARK_VERSION", this project is now coupled to the official build tools and is not compatible with anything else.

Describe the solution you'd like
Default macro variables so we can ignore if they're not set

Describe alternatives you've considered
Setting BENCHMARK_VERSION during compilation via -DBENCHMARK_VERSION=version doesn't work as the macro is not converted to a string, see below.

Additional context
In my experience, converting define inputs to strings is better done via a helper macro like

#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)

such that inputs like -DBENCHMARK_VERSION=version

can be used like

std::string s{TOSTRING(BENCHMARK_VERSION)};

This IMO is simpler from a build perspective to not need any fancy escaping

see: https://coliru.stacked-crooked.com/a/ae9e4273382fe470

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions