admin管理员组

文章数量:1122846

I have a CMake project that generates build artifacts based on some image files using GLOB like so:

file(GLOB IN_FILES ${CMAKE_SOURCE_DIR}/images/*.png)
add_custom_command(
    OUTPUT ${OUT_FILE}
    COMMAND command-to-generate-build-artifact.sh
    DEPENDS ${IN_FILES}
    COMMENT "Generating stuff"
)
add_custom_target(generate_image_data ALL DEPENDS ${OUT_FILE})
add_dependencies(project generate_image_data)

The annoying thing about this is that if I add, remove, or rename any of these images, I need to remember to manually reconfigure CMake, and I pretty much always forget to do this, meaning my next build will break and it'll take me a moment to remember why.

Is there some way I can either change my CMakeLists.txt file so that reconfiguring isn't necessary, or set things up so that CMake automatically reconfigures itself when these files change? I'm using Visual Studio Code for this project.

本文标签: