2021-08-19 06:29:11 +00:00
|
|
|
cmake_minimum_required(VERSION 3.14)
|
2020-01-27 03:36:34 +00:00
|
|
|
project(test)
|
|
|
|
|
2021-08-19 06:29:11 +00:00
|
|
|
include(FetchContent)
|
2021-08-17 23:13:31 +00:00
|
|
|
FetchContent_Declare(
|
2021-08-19 06:29:11 +00:00
|
|
|
googletest
|
|
|
|
URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip
|
2021-08-17 23:13:31 +00:00
|
|
|
)
|
2021-08-19 06:29:11 +00:00
|
|
|
# For Windows: Prevent overriding the parent project's compiler/linker settings
|
|
|
|
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
|
|
|
FetchContent_MakeAvailable(googletest)
|
2020-10-02 01:26:04 +00:00
|
|
|
|
2021-08-19 06:29:11 +00:00
|
|
|
enable_testing()
|
2020-10-02 01:26:04 +00:00
|
|
|
|
2021-08-17 23:13:31 +00:00
|
|
|
add_executable(test-main test1.cc test2.cc test3.cc)
|
|
|
|
|
|
|
|
target_include_directories(test-main PRIVATE ..)
|
2016-05-29 21:13:39 +00:00
|
|
|
|
2021-08-19 06:29:11 +00:00
|
|
|
include(GoogleTest)
|
|
|
|
gtest_discover_tests(test-main)
|
|
|
|
target_link_libraries(test-main PRIVATE gtest_main)
|