aboutsummaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2024-01-29 16:15:43 +0300
committerGitHub <noreply@github.com>2024-01-29 13:15:43 +0000
commit17bc235ab31aa48b9a7e7c444b6b4f4c22e4be39 (patch)
tree9749da62a8bf7d48c24788a461476eaa92db055f /src/CMakeLists.txt
parent8e2d258644aeaa13ba441f27e053dd05656517a5 (diff)
downloadgoogle-benchmark-17bc235ab31aa48b9a7e7c444b6b4f4c22e4be39.tar.gz
Output library / schema versions in JSON context block (#1742)
* CMake: `get_git_version()`: just use `--dirty` flag of `git describe` * CMake: move version normalization out of `get_git_version()` Mainly, i want `get_git_version()` to return true version, not something sanitized. * JSON reporter: store library version and schema version in `context` * Tools: discard inputs with unexpected `json_schema_version` * Extract version string into `GetBenchmarkVersiom()` --------- Co-authored-by: dominic <510002+dmah42@users.noreply.github.com>
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index daf82fb..943594b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -28,6 +28,13 @@ target_include_directories(benchmark PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
)
+set_property(
+ SOURCE benchmark.cc
+ APPEND
+ PROPERTY COMPILE_DEFINITIONS
+ BENCHMARK_VERSION="${VERSION}"
+)
+
# libpfm, if available
if (PFM_FOUND)
target_link_libraries(benchmark PRIVATE PFM::libpfm)