Test for new cmake

This commit is contained in:
2025-08-03 20:34:52 +08:00
parent d35d096374
commit 4f277b00d5

View File

@@ -82,11 +82,28 @@ else()
)
endif()
foreach(test_file ${TEST_FILES})
get_filename_component(test_name ${test_file} NAME_WE) # utFoo
add_executable(${test_name}
${SRC_FILES}
${INCLUDE_FILES}
${test_file}
)
target_link_libraries(${test_name} PRIVATE GTest::gtest_main)
target_include_directories(${test_name} PRIVATE ${INCLUDE_DIR})
target_compile_options(${test_name} PRIVATE ${TARGET_COMPILER_OPTIONS})
include(GoogleTest)
gtest_discover_tests(${test_name})
endforeach()
add_executable(ut_all
${SRC_FILES}
${INCLUDE_FILES}
${TEST_FILES}
)
target_link_libraries(ut_all
GTest::gtest_main
)