safesight-edge/tests/CMakeLists.txt
2026-01-13 08:28:55 +08:00

50 lines
1.2 KiB
CMake

include(FetchContent)
# Fetch Google Test
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG v1.14.0
)
# Prevent overriding the parent project's compiler/linker settings on Windows
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
# Legacy simple tests (keep for backward compatibility)
add_executable(rk3588_tests_legacy
test_main.cpp
${CMAKE_SOURCE_DIR}/src/utils/config_expand.cpp
)
target_include_directories(rk3588_tests_legacy PRIVATE
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/third_party
)
target_link_libraries(rk3588_tests_legacy PRIVATE project_options Threads::Threads)
add_test(NAME rk3588_tests_legacy COMMAND rk3588_tests_legacy)
# New Google Test based tests
add_executable(rk3588_gtests
test_result.cpp
test_spsc_queue.cpp
test_simple_json.cpp
test_config_expand.cpp
${CMAKE_SOURCE_DIR}/src/utils/config_expand.cpp
)
target_include_directories(rk3588_gtests PRIVATE
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/third_party
)
target_link_libraries(rk3588_gtests PRIVATE
project_options
Threads::Threads
GTest::gtest_main
)
include(GoogleTest)
gtest_discover_tests(rk3588_gtests)