Skip to content

Commit b514665

Browse files
committed
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
1 parent 9070a89 commit b514665

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

test/CMakeLists.txt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
project(test-ipc)
2+
3+
if(NOT MSVC)
4+
add_compile_options(
5+
-Wno-attributes
6+
-Wno-missing-field-initializers
7+
-Wno-unused-variable
8+
-Wno-unused-function)
9+
endif()
10+
11+
include_directories(
12+
${LIBIPC_PROJECT_DIR}/include
13+
${LIBIPC_PROJECT_DIR}/src
14+
${LIBIPC_PROJECT_DIR}/test
15+
${LIBIPC_PROJECT_DIR}/3rdparty
16+
${LIBIPC_PROJECT_DIR}/3rdparty/gtest/include)
17+
18+
# Collect only new test files (exclude archive directory)
19+
file(GLOB SRC_FILES
20+
${LIBIPC_PROJECT_DIR}/test/test_*.cpp
21+
)
22+
file(GLOB HEAD_FILES ${LIBIPC_PROJECT_DIR}/test/test_*.h)
23+
24+
# Ensure we don't include archived tests
25+
list(FILTER SRC_FILES EXCLUDE REGEX "archive")
26+
list(FILTER HEAD_FILES EXCLUDE REGEX "archive")
27+
28+
add_executable(${PROJECT_NAME} ${SRC_FILES} ${HEAD_FILES})
29+
30+
link_directories(${LIBIPC_PROJECT_DIR}/3rdparty/gperftools)
31+
target_link_libraries(${PROJECT_NAME} gtest gtest_main ipc)
32+
#target_link_libraries(${PROJECT_NAME} tcmalloc_minimal)

0 commit comments

Comments
 (0)