Commit e5752411 authored by Bartosz Podrygajlo's avatar Bartosz Podrygajlo

Introduce googletest library

The library will be either found in the system or downloaded via FetchContent.
parent 9055fabe
......@@ -2507,6 +2507,21 @@ if(ENABLE_TESTS)
# meta-target: each test is supposed to add_dependencies(tests ${NEWTEST})
# then, it is possible to build and execute all tests using "ninja tests && ctest"
add_custom_target(tests)
find_package(GTest)
if (NOT GTest_FOUND)
message(STATUS "GTest package not found, will download googletest automatically. To prevent that install google test on your system (libgtest-dev)")
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG 58d77fa8070e8cec2dc1ed015d66b454c8d78850 # 1.12.1
)
set(BUILD_GMOCK OFF)
set(INSTALL_GTEST OFF)
FetchContent_MakeAvailable(googletest)
add_library(GTest::gtest ALIAS gtest)
add_library(GTest::gtest_main ALIAS gtest_main)
endif()
endif()
add_subdirectory(common)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment