diff --git a/CMakeLists.txt b/CMakeLists.txt index 0806f5a..7eb9f54 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,10 +50,7 @@ target_link_libraries(camera_to_rtsp # 运行时把 config.json 复制到 bin/ 目录 add_custom_command(TARGET camera_to_rtsp POST_BUILD - COMMAND ${CMAKE_COMMAND} -E echo "Checking config.json..." - COMMAND ${CMAKE_COMMAND} -E test -e $/config.json - || ${CMAKE_COMMAND} -E copy - ${CMAKE_SOURCE_DIR}/config.json - $/config.json + COMMAND /bin/bash -c "if [ ! -f '$/config.json' ]; then cp '${CMAKE_SOURCE_DIR}/config.json' '$/config.json'; else echo 'config.json exists, skip copy'; fi" ) +