Skip to content

Commit

Permalink
Offer GoogleTest and GoogleBenchmark to downstream components
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
  • Loading branch information
jviotti committed Jan 28, 2025
1 parent a03319d commit 7596790
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ option(SOURCEMETA_CORE_DOCS "Build the Sourcemeta Core docs" OFF)
option(SOURCEMETA_CORE_INSTALL "Install the Sourcemeta Core library" ON)
option(SOURCEMETA_CORE_ADDRESS_SANITIZER "Build Sourcemeta Core with an address sanitizer" OFF)
option(SOURCEMETA_CORE_UNDEFINED_SANITIZER "Build Sourcemeta Core with an undefined behavior sanitizer" OFF)
option(SOURCEMETA_CORE_CONTRIB_GOOGLETEST "Build the GoogleTest library for downstream consumers" OFF)
option(SOURCEMETA_CORE_CONTRIB_GOOGLEBENCHMARK "Build the GoogleBenchmark library for downstream consumers" OFF)

include(Sourcemeta)

Expand Down Expand Up @@ -94,9 +96,17 @@ if(PROJECT_IS_TOP_LEVEL)
endif()

# Testing

if(SOURCEMETA_CORE_CONTRIB_GOOGLETEST OR SOURCEMETA_CORE_TESTS)
find_package(GoogleTest REQUIRED)
endif()

if(SOURCEMETA_CORE_CONTRIB_GOOGLEBENCHMARK OR SOURCEMETA_CORE_BENCHMARK)
find_package(GoogleBenchmark REQUIRED)
endif()

if(SOURCEMETA_CORE_TESTS)
enable_testing()
find_package(GoogleTest REQUIRED)

if(SOURCEMETA_CORE_REGEX)
add_subdirectory(test/regex)
Expand Down Expand Up @@ -137,9 +147,8 @@ if(SOURCEMETA_CORE_TESTS)
add_subdirectory(test/packaging)
endif()
endif()
endif()

if(SOURCEMETA_CORE_BENCHMARK)
find_package(GoogleBenchmark REQUIRED)
add_subdirectory(benchmark)
endif()
if(SOURCEMETA_CORE_BENCHMARK)
add_subdirectory(benchmark)
endif()

0 comments on commit 7596790

Please sign in to comment.