This commit is contained in:
cxh 2025-12-30 08:57:07 +08:00
parent a29fd84e0b
commit b7620ff057

View File

@ -52,15 +52,13 @@ target_link_libraries(${APP_NAME}
${CMAKE_SOURCE_DIR}/third_party/lib/libpaho-mqtt3c.a
)
#
#
add_custom_command(TARGET ${APP_NAME} POST_BUILD
COMMAND sh -c
"if [ ! -f \"$<TARGET_FILE_DIR:${APP_NAME}>/${CONFIG_FILE}\" ]; then \
mkdir -p \"$<TARGET_FILE_DIR:${APP_NAME}>\" && \
"test -f \"$<TARGET_FILE_DIR:${APP_NAME}>/${CONFIG_FILE}\" || \
(mkdir -p \"$<TARGET_FILE_DIR:${APP_NAME}>\" && \
cp \"${CMAKE_SOURCE_DIR}/${CONFIG_EXAMPLE_FILE}\" \
\"$<TARGET_FILE_DIR:${APP_NAME}>/${CONFIG_FILE}\" && \
echo \"config.json created from example\"; \
else \
echo \"config.json exists, keep it\"; \
fi"
echo \"config.json created from example\")"
)