Skip to content

Commit 30a37e1

Browse files
authored
set library version in bazel (google#1746)
* set library version in bazel
1 parent 17bc235 commit 30a37e1

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ cc_library(
5151
}),
5252
defines = [
5353
"BENCHMARK_STATIC_DEFINE",
54+
"BENCHMARK_VERSION=\\\"" + (module_version() if module_version() != None else "") + "\\\"",
5455
] + select({
5556
":perfcounters": ["HAVE_LIBPFM"],
5657
"//conditions:default": [],

src/benchmark.cc

+1-7
Original file line numberDiff line numberDiff line change
@@ -748,13 +748,7 @@ int InitializeStreams() {
748748

749749
} // end namespace internal
750750

751-
std::string GetBenchmarkVersiom() {
752-
#if defined(BENCHMARK_VERSION)
753-
return {BENCHMARK_VERSION};
754-
#else
755-
return "hello, bazel!";
756-
#endif
757-
}
751+
std::string GetBenchmarkVersiom() { return {BENCHMARK_VERSION}; }
758752

759753
void PrintDefaultHelp() {
760754
fprintf(stdout,

0 commit comments

Comments
 (0)