Guarantee fypp files are preprocessed before compiling target sources - #98
Merged
wdeconinck merged 3 commits intoJul 29, 2026
Merged
Conversation
Member
|
Thanks @cresswellp that is really neat! |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #98 +/- ##
========================================
Coverage 51.07% 51.07%
========================================
Files 58 58
Lines 4854 4854
Branches 453 453
========================================
Hits 2479 2479
Misses 2375 2375 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
wdeconinck
approved these changes
Jul 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add a custom target to
fckit_target_preprocess_fyppto ensure all source files generated from fypp preprocessing are available before compiling any sources in the original target.The reason for the change is that if one of the generated sources is a module, files USE-ing that module can begin compiling before the relevant .mod file is available, resulting in build failures. This is a particular problem when using Ninja; its dynamic module dependency scanning will fail to notice any (yet-to-be-generated) modules in .fypp files, and begin compiling files that depend on those modules; even files in other targets that depend on the current library target.
Pre-processing is fast compared to compile times, so the additional dependencies are added by default as the cost to overall build time is negligible and there seems few good reasons not to guarantee the sources are available; but this can be disabled with the
NO_TARGET_DEPENDSoption if needed. We can reverse this if necessary (off by default) but having this on by default seems sensible.Note also if
fckit_target_preprocess_fyppis called twice on the same target, the custom target is only set up on the first call. A second call on the same input target would be unusual, though. As a belt-and-braces solution, either for a second call or when using theNO_TARGET_DEPENDSoption, the list of generated sources can be returned to the caller usingOUTPUT_SOURCES, so the calling project can explicitly manage its own dependencies if required.Tests are added for all new features.
Contributor Declaration
By opening this pull request, I affirm the following: