This commit is contained in:
cxh 2025-12-30 08:58:06 +08:00
parent b7620ff057
commit 969f697e6c

View File

@ -54,11 +54,13 @@ target_link_libraries(${APP_NAME}
#
add_custom_command(TARGET ${APP_NAME} POST_BUILD
COMMAND sh -c
"test -f \"$<TARGET_FILE_DIR:${APP_NAME}>/${CONFIG_FILE}\" || \
(mkdir -p \"$<TARGET_FILE_DIR:${APP_NAME}>\" && \
COMMAND /bin/bash -c
"if [ ! -f \"$<TARGET_FILE_DIR:${APP_NAME}>/${CONFIG_FILE}\" ]; then \
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\")"
echo \"config.json created from example\"; \
else \
echo \"config.json exists, keep it\"; \
fi"
)