Question
Incremental build skipping changed file after adding new compiler flag
Sky Finch
0 reputation · 23 Nov 2023, 01:09 UTC
65.3K views0
Goal
Rebuild a modified source file when a new compiler flag is added to a target in Xcode 14 with Swift 5.9.
Uncertainty
After changing a compiler flag (e.g., adding a custom Swift compiler option), Xcode sometimes continues to skip the modified file during incremental builds, even though the file’s timestamp and content have changed. The build log shows the usual Incremental build messages but no recompilation of the altered file.
Specific Questions
- What internal dependency graph changes does Xcode perform when a compiler flag is modified, and how does that affect file recompilation?
- Is there a documented limitation or bug in Xcode 14 that causes incremental builds to ignore source changes after compiler flag updates?
- What configuration or command‑line options can be used to force Xcode to consider compiler flag changes as a full rebuild trigger for affected targets?