Problem
Currently, include-what-you-use (iwyu) is only enforced for the main Prong library (CMakeLists.txt:110), but not for any of the example applications. This creates an inconsistency where:
- The library code must pass iwyu checks (good!)
- Example code can have incorrect/excessive includes without triggering errors (bad!)
According to CLAUDE.md:265, we should "NEVER bypass iwyu or clang-format". While clang-format is properly enforced for all examples via the format-example-sources target, iwyu is missing.
Current State
What has iwyu:
prong library target (via CXX_INCLUDE_WHAT_YOU_USE property)
What lacks iwyu:
prong_demo_app executable
- All 8 basic examples (
examples/basic/*/)
- All 4 intermediate examples (
examples/intermediate/*/)
- All 4 advanced examples (
examples/advanced/*/)
glfw_adapters library
Why This Matters
- Example code quality: Examples are learning resources and should demonstrate best practices
- Include hygiene: Examples may accumulate unnecessary includes that slow compilation
- Consistency: All code in the repository should follow the same standards
- Documentation: Examples with incorrect includes can mislead users
Proposed Solution
Add the CXX_INCLUDE_WHAT_YOU_USE property to:
- All example executables in individual CMakeLists.txt files
- The
glfw_adapters library
- The
prong_demo_app executable
Example configuration:
set_target_properties(01_hello_button PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/examples/basic/01_hello_button"
CXX_INCLUDE_WHAT_YOU_USE "${IWYU_PATH};-Xiwyu;--error;-Xiwyu;--verbose=3"
)
Affected Files
examples/CMakeLists.txt (demo app + glfw_adapters)
examples/basic/*/CMakeLists.txt (8 files)
examples/intermediate/*/CMakeLists.txt (4 files)
examples/advanced/*/CMakeLists.txt (4 files)
Total: 18 CMakeLists.txt files need updating
Problem
Currently,
include-what-you-use(iwyu) is only enforced for the main Prong library (CMakeLists.txt:110), but not for any of the example applications. This creates an inconsistency where:According to
CLAUDE.md:265, we should "NEVER bypass iwyu or clang-format". While clang-format is properly enforced for all examples via theformat-example-sourcestarget, iwyu is missing.Current State
What has iwyu:
pronglibrary target (viaCXX_INCLUDE_WHAT_YOU_USEproperty)What lacks iwyu:
prong_demo_appexecutableexamples/basic/*/)examples/intermediate/*/)examples/advanced/*/)glfw_adapterslibraryWhy This Matters
Proposed Solution
Add the
CXX_INCLUDE_WHAT_YOU_USEproperty to:glfw_adapterslibraryprong_demo_appexecutableExample configuration:
Affected Files
examples/CMakeLists.txt(demo app + glfw_adapters)examples/basic/*/CMakeLists.txt(8 files)examples/intermediate/*/CMakeLists.txt(4 files)examples/advanced/*/CMakeLists.txt(4 files)Total: 18 CMakeLists.txt files need updating