aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2023-10-30 21:54:05 +0100
committerJohannes Stoelp <johannes.stoelp@gmail.com>2023-10-30 21:54:05 +0100
commit222fec65b199de8004e5664edd03ced4f29cdb94 (patch)
tree026927ef23172f470c1086a5a489a4eebd59d93b /test
parentc1a82d50ef1d8adc4bdc5bd95c6777ae74f16b3b (diff)
downloadsysc-playground-222fec65b199de8004e5664edd03ced4f29cdb94.tar.gz
sysc-playground-222fec65b199de8004e5664edd03ced4f29cdb94.zip
cmake: move test build into own file test/CMakeLists.txt
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100644
index 0000000..b67735a
--- /dev/null
+++ b/test/CMakeLists.txt
@@ -0,0 +1,22 @@
+# Fetch googletest.
+# https://google.github.io/googletest/quickstart-cmake.html#set-up-a-project
+include(FetchContent)
+FetchContent_Declare(
+ googletest URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
+)
+set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
+FetchContent_MakeAvailable(googletest)
+
+# Generate CTestTestfile.cmake.
+enable_testing()
+# Include gtest_discover_tests macro.
+include(GoogleTest)
+
+foreach(T IN ITEMS lt_bus)
+ set(TGT test-${T})
+ add_executable(${TGT} ${T}.cc)
+ target_include_directories(${TGT} PRIVATE ${SRC})
+ target_compile_options(${TGT} PRIVATE -Wall -Wextra)
+ target_link_libraries(${TGT} GTest::gmock_main SystemC::systemc)
+ gtest_discover_tests(${TGT})
+endforeach()