Skip to content

Commit d3d01a3

Browse files
authored
Offer GoogleTest and GoogleBenchmark to downstream components (#1490)
Signed-off-by: Juan Cruz Viotti <[email protected]>
1 parent a03319d commit d3d01a3

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

CMakeLists.txt

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ option(SOURCEMETA_CORE_DOCS "Build the Sourcemeta Core docs" OFF)
1717
option(SOURCEMETA_CORE_INSTALL "Install the Sourcemeta Core library" ON)
1818
option(SOURCEMETA_CORE_ADDRESS_SANITIZER "Build Sourcemeta Core with an address sanitizer" OFF)
1919
option(SOURCEMETA_CORE_UNDEFINED_SANITIZER "Build Sourcemeta Core with an undefined behavior sanitizer" OFF)
20+
option(SOURCEMETA_CORE_CONTRIB_GOOGLETEST "Build the GoogleTest library for downstream consumers" OFF)
21+
option(SOURCEMETA_CORE_CONTRIB_GOOGLEBENCHMARK "Build the GoogleBenchmark library for downstream consumers" OFF)
2022

2123
include(Sourcemeta)
2224

@@ -94,9 +96,17 @@ if(PROJECT_IS_TOP_LEVEL)
9496
endif()
9597

9698
# Testing
99+
100+
if(SOURCEMETA_CORE_CONTRIB_GOOGLETEST OR SOURCEMETA_CORE_TESTS)
101+
find_package(GoogleTest REQUIRED)
102+
endif()
103+
104+
if(SOURCEMETA_CORE_CONTRIB_GOOGLEBENCHMARK OR SOURCEMETA_CORE_BENCHMARK)
105+
find_package(GoogleBenchmark REQUIRED)
106+
endif()
107+
97108
if(SOURCEMETA_CORE_TESTS)
98109
enable_testing()
99-
find_package(GoogleTest REQUIRED)
100110

101111
if(SOURCEMETA_CORE_REGEX)
102112
add_subdirectory(test/regex)
@@ -137,9 +147,8 @@ if(SOURCEMETA_CORE_TESTS)
137147
add_subdirectory(test/packaging)
138148
endif()
139149
endif()
150+
endif()
140151

141-
if(SOURCEMETA_CORE_BENCHMARK)
142-
find_package(GoogleBenchmark REQUIRED)
143-
add_subdirectory(benchmark)
144-
endif()
152+
if(SOURCEMETA_CORE_BENCHMARK)
153+
add_subdirectory(benchmark)
145154
endif()

0 commit comments

Comments
 (0)