diff --git a/BUILD.bazel b/BUILD.bazel index 0178e2c009..d72ae86728 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -51,6 +51,7 @@ cc_library( }), defines = [ "BENCHMARK_STATIC_DEFINE", + "BENCHMARK_VERSION=\\\"" + (module_version() if module_version() != None else "") + "\\\"", ] + select({ ":perfcounters": ["HAVE_LIBPFM"], "//conditions:default": [], diff --git a/src/benchmark.cc b/src/benchmark.cc index 489c8a0a4f..8ec30c88c0 100644 --- a/src/benchmark.cc +++ b/src/benchmark.cc @@ -748,13 +748,7 @@ int InitializeStreams() { } // end namespace internal -std::string GetBenchmarkVersiom() { -#if defined(BENCHMARK_VERSION) - return {BENCHMARK_VERSION}; -#else - return "hello, bazel!"; -#endif -} +std::string GetBenchmarkVersiom() { return {BENCHMARK_VERSION}; } void PrintDefaultHelp() { fprintf(stdout,