Fix incorrect regeneration for IDL targets#40148
Fix incorrect regeneration for IDL targets#40148OneBlue wants to merge 1 commit intofeature/wsl-for-appsfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes a build regression where IDL-related CMake targets are always considered out-of-date, impacting incremental builds across dependent Windows components.
Changes:
- Tracks
dlldata_<platform>.cas an output from only the final proxy-IDL MIDL invocation to avoid conflicting/duplicated outputs. - Suppresses unwanted MIDL byproducts for “no proxy” IDLs by redirecting
/iid,/proxy, and/dlldataoutputs tonul. - Attempts to add a stamp-touch step for Visual Studio incremental up-to-date tracking on the IDL custom target.
| add_custom_target(${target} | ||
| COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${target} | ||
| DEPENDS ${TARGET_OUTPUTS} | ||
| SOURCES ${idl_files_with_proxy} ${idl_files_no_proxy}) |
There was a problem hiding this comment.
This custom target adds a COMMAND that touches a stamp file, but the stamp isn’t declared as an OUTPUT/BYPRODUCT. For non-MSBuild generators (e.g., Ninja/Makefiles), custom targets with commands and no tracked byproducts typically run every time the target is built, which would reintroduce the “always out of date” behavior. Also, the touched path is unquoted (breaks if the build dir has spaces) and uses CMakeFiles casing, while other stamp usage in this repo consistently touches/outputs ${CMAKE_CURRENT_BINARY_DIR}/CmakeFiles/<target> (e.g., cmake/FindMC.cmake, localization/CMakeLists.txt). Consider using the existing pattern: have the last MIDL add_custom_command produce the stamp as an OUTPUT (or set BYPRODUCTS on the target) and quote the path, keeping add_custom_target as DEPENDS-only.
Summary of the Pull Request
#40130 introduced a regression that caused the idl targets to always be considered out of date. This changes solves this by explicitly setting the target stamp file and fixing the output of the dlldata file to only one command
PR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed