File tree Expand file tree Collapse file tree 1 file changed +22
-16
lines changed Expand file tree Collapse file tree 1 file changed +22
-16
lines changed Original file line number Diff line number Diff line change 2
2
# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
3
3
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
4
5
- include (FetchContent )
6
- FetchContent_Declare (
7
- googlebenchmark
8
- GIT_REPOSITORY https://github.com/google/benchmark.git
9
- GIT_TAG v1.9.0 )
10
-
11
- set (BENCHMARK_ENABLE_GTEST_TESTS
12
- OFF
13
- CACHE BOOL "" FORCE )
14
- set (BENCHMARK_ENABLE_TESTING
15
- OFF
16
- CACHE BOOL "" FORCE )
17
- set (BENCHMARK_ENABLE_INSTALL
18
- OFF
19
- CACHE BOOL "" FORCE )
20
- FetchContent_MakeAvailable (googlebenchmark )
5
+ set (GBENCH_VERSION 1.9.0 )
6
+
7
+ find_package (benchmark ${GBENCH_VERSION} QUIET )
8
+
9
+ if (NOT benchmark_FOUND )
10
+ include (FetchContent )
11
+ FetchContent_Declare (
12
+ googlebenchmark
13
+ GIT_REPOSITORY https://github.com/google/benchmark.git
14
+ GIT_TAG v${GBENCH_VERSION} )
15
+
16
+ set (BENCHMARK_ENABLE_GTEST_TESTS
17
+ OFF
18
+ CACHE BOOL "" FORCE )
19
+ set (BENCHMARK_ENABLE_TESTING
20
+ OFF
21
+ CACHE BOOL "" FORCE )
22
+ set (BENCHMARK_ENABLE_INSTALL
23
+ OFF
24
+ CACHE BOOL "" FORCE )
25
+ FetchContent_MakeAvailable (googlebenchmark )
26
+ endif ()
21
27
22
28
# In MSVC builds, there is no way to determine the actual build type during the
23
29
# CMake configuration step. Therefore, this message is printed in all MSVC
You can’t perform that action at this time.
0 commit comments