Skip to content

Instantly share code, notes, and snippets.

@jniemann66
Created January 7, 2026 23:17
Show Gist options
  • Select an option

  • Save jniemann66/969639005c85dcc4aed9c0d65f838f36 to your computer and use it in GitHub Desktop.

Select an option

Save jniemann66/969639005c85dcc4aed9c0d65f838f36 to your computer and use it in GitHub Desktop.
cmake: windows copy-dlls post build
#cmake >= 3.21
if(WIN32)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_RUNTIME_DLLS:${PROJECT_NAME}>
$<TARGET_FILE_DIR:${PROJECT_NAME}>
COMMAND_EXPAND_LISTS
)
endif()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment