Skip to content

Commit

Permalink
CMake: add SIMPLEINI_USE_SYSTEM_GTEST option
Browse files Browse the repository at this point in the history
  • Loading branch information
topazus committed Dec 28, 2023
1 parent c42b0ef commit da07533
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/refs/tags/v1.14.0.zip
URL_HASH SHA1=0ac421f2ec11af38b0fff0f1992184032731a8bc
DOWNLOAD_EXTRACT_TIMESTAMP ON)
FetchContent_MakeAvailable(googletest)
if(SIMPLEINI_USE_SYSTEM_GTEST)
find_package(GTest REQUIRED)
else()
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/refs/tags/v1.14.0.zip
URL_HASH SHA1=0ac421f2ec11af38b0fff0f1992184032731a8bc
DOWNLOAD_EXTRACT_TIMESTAMP ON)
FetchContent_MakeAvailable(googletest)
endif()

add_executable(tests
ts-bugfix.cpp
Expand All @@ -15,7 +19,7 @@ add_executable(tests
ts-utf8.cpp)

add_test(NAME tests COMMAND tests)
target_link_libraries(tests PRIVATE ${PROJECT_NAME} gtest_main)
target_link_libraries(tests PRIVATE ${PROJECT_NAME} GTest::gtest_main)

add_custom_command(
TARGET tests POST_BUILD
Expand Down

0 comments on commit da07533

Please sign in to comment.