diff --git a/test/application/HunttingCamera/CMakeLists.txt b/test/application/HunttingCamera/CMakeLists.txt index f44ff83f..8a329c63 100644 --- a/test/application/HunttingCamera/CMakeLists.txt +++ b/test/application/HunttingCamera/CMakeLists.txt @@ -84,4 +84,6 @@ endif() define_file_name(${TARGET_NAME}) -# add_subdirectory(tool) \ No newline at end of file +# if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tool/CMakeLists.txt") +# add_subdirectory(tool) +# endif() \ No newline at end of file diff --git a/test/application/MissionManager/CMakeLists.txt b/test/application/MissionManager/CMakeLists.txt index f4e8c70d..5d541c10 100644 --- a/test/application/MissionManager/CMakeLists.txt +++ b/test/application/MissionManager/CMakeLists.txt @@ -1,2 +1,4 @@ -add_subdirectory(tool) \ No newline at end of file +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tool/CMakeLists.txt") + add_subdirectory(tool) +endif() \ No newline at end of file diff --git a/test/hal/CMakeLists.txt b/test/hal/CMakeLists.txt index 0350e00d..d0e591af 100644 --- a/test/hal/CMakeLists.txt +++ b/test/hal/CMakeLists.txt @@ -68,4 +68,6 @@ endif() define_file_name(${TARGET_NAME}) -add_subdirectory(tool) \ No newline at end of file +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tool/CMakeLists.txt") + add_subdirectory(tool) +endif() \ No newline at end of file diff --git a/test/middleware/AppManager/CMakeLists.txt b/test/middleware/AppManager/CMakeLists.txt index d448c77a..878917d8 100644 --- a/test/middleware/AppManager/CMakeLists.txt +++ b/test/middleware/AppManager/CMakeLists.txt @@ -79,4 +79,6 @@ endif() define_file_name(${TARGET_NAME}) -add_subdirectory(tool) \ No newline at end of file +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tool/CMakeLists.txt") + add_subdirectory(tool) +endif() \ No newline at end of file diff --git a/test/middleware/DeviceManager/CMakeLists.txt b/test/middleware/DeviceManager/CMakeLists.txt index 1e365fbd..afe34319 100644 --- a/test/middleware/DeviceManager/CMakeLists.txt +++ b/test/middleware/DeviceManager/CMakeLists.txt @@ -77,4 +77,6 @@ endif() define_file_name(${TARGET_NAME}) -add_subdirectory(tool) \ No newline at end of file +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tool/CMakeLists.txt") + add_subdirectory(tool) +endif() \ No newline at end of file diff --git a/test/middleware/McuAskBase/CMakeLists.txt b/test/middleware/McuAskBase/CMakeLists.txt index f4e8c70d..5d541c10 100644 --- a/test/middleware/McuAskBase/CMakeLists.txt +++ b/test/middleware/McuAskBase/CMakeLists.txt @@ -1,2 +1,4 @@ -add_subdirectory(tool) \ No newline at end of file +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tool/CMakeLists.txt") + add_subdirectory(tool) +endif() \ No newline at end of file diff --git a/test/middleware/McuManager/CMakeLists.txt b/test/middleware/McuManager/CMakeLists.txt index 2025f331..2751c35a 100644 --- a/test/middleware/McuManager/CMakeLists.txt +++ b/test/middleware/McuManager/CMakeLists.txt @@ -87,4 +87,6 @@ add_custom_command( endif() define_file_name(${TARGET_NAME}) -add_subdirectory(tool) \ No newline at end of file +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tool/CMakeLists.txt") + add_subdirectory(tool) +endif() \ No newline at end of file diff --git a/test/middleware/MediaManager/CMakeLists.txt b/test/middleware/MediaManager/CMakeLists.txt index 9f59db8f..fa189660 100644 --- a/test/middleware/MediaManager/CMakeLists.txt +++ b/test/middleware/MediaManager/CMakeLists.txt @@ -78,4 +78,6 @@ endif() define_file_name(${TARGET_NAME}) -add_subdirectory(tool) \ No newline at end of file +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tool/CMakeLists.txt") + add_subdirectory(tool) +endif() \ No newline at end of file diff --git a/test/utils/McuProtocol/CMakeLists.txt b/test/utils/McuProtocol/CMakeLists.txt index f4e8c70d..5d541c10 100644 --- a/test/utils/McuProtocol/CMakeLists.txt +++ b/test/utils/McuProtocol/CMakeLists.txt @@ -1,2 +1,4 @@ -add_subdirectory(tool) \ No newline at end of file +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tool/CMakeLists.txt") + add_subdirectory(tool) +endif() \ No newline at end of file diff --git a/test/utils/TcpModule/CMakeLists.txt b/test/utils/TcpModule/CMakeLists.txt index f51ec8c4..0619c71a 100644 --- a/test/utils/TcpModule/CMakeLists.txt +++ b/test/utils/TcpModule/CMakeLists.txt @@ -65,4 +65,6 @@ endif() define_file_name(${TARGET_NAME}) -# add_subdirectory(tool) \ No newline at end of file +# if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tool/CMakeLists.txt") +# add_subdirectory(tool) +# endif() \ No newline at end of file diff --git a/test/utils/UartDevice/CMakeLists.txt b/test/utils/UartDevice/CMakeLists.txt index 3d633483..57956873 100644 --- a/test/utils/UartDevice/CMakeLists.txt +++ b/test/utils/UartDevice/CMakeLists.txt @@ -65,4 +65,6 @@ endif() define_file_name(${TARGET_NAME}) -add_subdirectory(tool) \ No newline at end of file +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tool/CMakeLists.txt") + add_subdirectory(tool) +endif() \ No newline at end of file diff --git a/tools/README.md b/tools/README.md index 6b002f6f..f7be89b0 100644 --- a/tools/README.md +++ b/tools/README.md @@ -1,4 +1,13 @@ # 1. 工具 ## 1.1. 概述 -  该目录存放使用到的工具。 \ No newline at end of file +  该目录存放使用到的工具。 + +## 1.2. delete_test_code.sh + +  删除测试工具代码。 + +使用方法: +``` + ./delete_test_code.sh ../../test/ +``` \ No newline at end of file diff --git a/tools/shell/delete_test_code.sh b/tools/shell/delete_test_code.sh index 8d9c5891..2206019b 100755 --- a/tools/shell/delete_test_code.sh +++ b/tools/shell/delete_test_code.sh @@ -24,6 +24,17 @@ find "$1" -type d -name "tool" | while read -r tool_dir; do else echo "No 'src' directory found in '$tool_dir'" fi + + # 检查CMakeLists.txt文件是否存在,然后删除 + cmake_file="$tool_dir/CMakeLists.txt" + if [ -f "$cmake_file" ]; then + rm "$cmake_file" + if [ $? -eq 0 ]; then + echo "Deleted 'CMakeLists.txt' in '$tool_dir'" + else + echo "Error deleting 'CMakeLists.txt' in '$tool_dir'" + fi + fi done echo "Operation completed." \ No newline at end of file