You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The section in README-cmake.md on library copying isn't strictly correct, because that custom command is dependent on the executable, not the libraries being copied. In my own work on the SDL code, I've run into situations where the executable isn't rebuilt, its POST_BUILD event not triggered, but the libraries were rebuilt, so the custom command ended up not getting rerun. For those not working on the SDL code, a situation where the executable-dependent custom command wouldn't run would be after an update of SDL, with the executable's code unchanged, the user running a build operation at that point. Additionally, using CMAKE_LIBRARY_OUTPUT_DIRECTORY for SDL provided by a package manager, acquired in CMake via find_package(), won't work at all, since the library isn't built as part of your project in such a situation.
This is the correct way to have the copying command dependent on the library. This command does always rerun every build, but using copy_if_different at least optimizes the copying to only actually copy the library when it changes on-disk, it does a file timestamp check to only copy when the timestamp changes. The dependency on the library results in this copy command only running after the library is built:
The section in README-cmake.md on library copying isn't strictly correct, because that custom command is dependent on the executable, not the libraries being copied. In my own work on the SDL code, I've run into situations where the executable isn't rebuilt, its
POST_BUILD
event not triggered, but the libraries were rebuilt, so the custom command ended up not getting rerun. For those not working on the SDL code, a situation where the executable-dependent custom command wouldn't run would be after an update of SDL, with the executable's code unchanged, the user running a build operation at that point. Additionally, usingCMAKE_LIBRARY_OUTPUT_DIRECTORY
for SDL provided by a package manager, acquired in CMake viafind_package()
, won't work at all, since the library isn't built as part of your project in such a situation.This is the correct way to have the copying command dependent on the library. This command does always rerun every build, but using
copy_if_different
at least optimizes the copying to only actually copy the library when it changes on-disk, it does a file timestamp check to only copy when the timestamp changes. The dependency on the library results in this copy command only running after the library is built:The text was updated successfully, but these errors were encountered: