更新时间:2023-01-26 14:54:29
使用 add_custom_command()添加构建后步骤, a href = https://cmake.org/cmake/help/v3.4/manual/cmake-generator-expressions.7.html#informational-expressions rel = nofollow noreferrer>生成器表达式:
You could just add a post-build step with add_custom_command() using generator expressions:
add_custom_command(
TARGET myBinary
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${CMAKE_CURRENT_SOURCE_DIR}/myTest.txt"
"$<TARGET_FILE_DIR:myBinary>/myTest.txt"
)
参考