mirror of https://github.com/google/benchmark.git
Added support of packaged GTest for running unit tests. (#1226)
Signed-off-by: Vitaly Zaitsev <vitaly@easycoding.org>
This commit is contained in:
parent
1bd8098d3d
commit
400ed3f57a
|
@ -34,6 +34,7 @@ option(BENCHMARK_DOWNLOAD_DEPENDENCIES "Allow the downloading and in-tree buildi
|
||||||
# This option can be used to disable building and running unit tests which depend on gtest
|
# This option can be used to disable building and running unit tests which depend on gtest
|
||||||
# in cases where it is not possible to build or find a valid version of gtest.
|
# in cases where it is not possible to build or find a valid version of gtest.
|
||||||
option(BENCHMARK_ENABLE_GTEST_TESTS "Enable building the unit tests which depend on gtest" ON)
|
option(BENCHMARK_ENABLE_GTEST_TESTS "Enable building the unit tests which depend on gtest" ON)
|
||||||
|
option(BENCHMARK_USE_BUNDLED_GTEST "Use bundled GoogleTest. If disabled, the find_package(GTest) will be used." ON)
|
||||||
|
|
||||||
option(BENCHMARK_ENABLE_LIBPFM "Enable performance counters provided by libpfm" OFF)
|
option(BENCHMARK_ENABLE_LIBPFM "Enable performance counters provided by libpfm" OFF)
|
||||||
|
|
||||||
|
@ -308,7 +309,15 @@ if (BENCHMARK_ENABLE_TESTING)
|
||||||
if (BENCHMARK_ENABLE_GTEST_TESTS AND
|
if (BENCHMARK_ENABLE_GTEST_TESTS AND
|
||||||
NOT (TARGET gtest AND TARGET gtest_main AND
|
NOT (TARGET gtest AND TARGET gtest_main AND
|
||||||
TARGET gmock AND TARGET gmock_main))
|
TARGET gmock AND TARGET gmock_main))
|
||||||
include(GoogleTest)
|
if (BENCHMARK_USE_BUNDLED_GTEST)
|
||||||
|
include(GoogleTest)
|
||||||
|
else()
|
||||||
|
find_package(GTest CONFIG REQUIRED)
|
||||||
|
add_library(gtest ALIAS GTest::gtest)
|
||||||
|
add_library(gtest_main ALIAS GTest::gtest_main)
|
||||||
|
add_library(gmock ALIAS GTest::gmock)
|
||||||
|
add_library(gmock_main ALIAS GTest::gmock_main)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Reference in New Issue