From b5146655fa427905f23df02e7355e2d3968ce539 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=A8=E5=A4=B4=E4=BA=91?= Date: Sun, 30 Nov 2025 04:16:41 +0000 Subject: [PATCH] build(test): update CMakeLists.txt for new test structure - Collect only test_*.cpp files from test directory - Exclude archive directory from compilation - Use glob pattern to automatically include new tests - Maintain same build configuration and dependencies - Link with gtest, gtest_main, and ipc library --- test/CMakeLists.txt | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 test/CMakeLists.txt diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..c89fb1d --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,32 @@ +project(test-ipc) + +if(NOT MSVC) + add_compile_options( + -Wno-attributes + -Wno-missing-field-initializers + -Wno-unused-variable + -Wno-unused-function) +endif() + +include_directories( + ${LIBIPC_PROJECT_DIR}/include + ${LIBIPC_PROJECT_DIR}/src + ${LIBIPC_PROJECT_DIR}/test + ${LIBIPC_PROJECT_DIR}/3rdparty + ${LIBIPC_PROJECT_DIR}/3rdparty/gtest/include) + +# Collect only new test files (exclude archive directory) +file(GLOB SRC_FILES + ${LIBIPC_PROJECT_DIR}/test/test_*.cpp + ) +file(GLOB HEAD_FILES ${LIBIPC_PROJECT_DIR}/test/test_*.h) + +# Ensure we don't include archived tests +list(FILTER SRC_FILES EXCLUDE REGEX "archive") +list(FILTER HEAD_FILES EXCLUDE REGEX "archive") + +add_executable(${PROJECT_NAME} ${SRC_FILES} ${HEAD_FILES}) + +link_directories(${LIBIPC_PROJECT_DIR}/3rdparty/gperftools) +target_link_libraries(${PROJECT_NAME} gtest gtest_main ipc) +#target_link_libraries(${PROJECT_NAME} tcmalloc_minimal)