From 910a2d62ba31526b662ddd4fff517791b0807bab Mon Sep 17 00:00:00 2001 From: cxh Date: Thu, 20 Nov 2025 09:30:32 +0800 Subject: [PATCH] 1 --- CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c57ceb6..7e07a7c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,11 @@ target_link_libraries(camera_to_rtsp ) # 运行时把 config.json 复制到 bin/ 目录 -add_custom_command(TARGET camera_to_rtsp POST_BUILD - COMMAND bash -c "if [ ! -f \"$/config.json\" ]; then cp \"${CMAKE_SOURCE_DIR}/config.json\" \"$/config.json\"; else echo config.json\ exists,\ skip\ copy; fi" +add_custom_command( + TARGET camera_to_rtsp POST_BUILD + COMMAND ${CMAKE_COMMAND} -E echo "Checking config.json..." + COMMAND ${CMAKE_COMMAND} -E test -f $/config.json + || ${CMAKE_COMMAND} -E copy + ${CMAKE_SOURCE_DIR}/config.json + $/config.json ) -