diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index ac3c242..f01de33 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,5 +1,6 @@ cmake_minimum_required(VERSION 3.20) +# fetch google test to use for testing include(FetchContent) FetchContent_Declare( @@ -10,10 +11,16 @@ FetchContent_Declare( FetchContent_MakeAvailable(googletest) +# Add test executables add_executable(self_test self_test.cpp) add_executable(C_Callback_test test_C_Callback.cpp) + +# Link against google test and the C_Callback library target_link_libraries(self_test gtest_main) target_link_libraries(C_Callback_test gtest_main C_Callback) +# Ensure that C_Callback is built before the tests +add_dependencies(C_Callback_test C_Callback) + add_test(NAME self_test COMMAND self_test) add_test(NAME C_Callback_test COMMAND C_Callback_test)