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
{{ message }}
Repository navigation
[workspace.build] defines are lost for sibling path dependencies #690
[workspace.build] defines reaches a workspace member built as the selected root, but does not reach the same member when it is a sibling path dependency. The documented inheritance rule says vectors including defines are inherited by every member. In contrast, [workspace.build] cxxflags = ["-D..."] works in both positions.
Environment
mcpp 2026.9.24.1 (repository commit b4824697)
Windows x86_64, LLVM 20.1.7, MSVC system sysroot 14.51.36231
Minimal reproduction
Root mcpp.toml:
[workspace]
members = ["lib", "app"]
[workspace.package]
version = "0.1.0"standard = "c++23"
[toolchain]
windows = "llvm@20.1.7"
[workspace.build]
defines = ["WORKSPACE_DEFINE=1"]
mcpp build -p app fails compiling lib.cpp with WORKSPACE_DEFINE missing in library dependency. The failing compile command has no -DWORKSPACE_DEFINE=1.
Replace defines = ["WORKSPACE_DEFINE=1"] with cxxflags = ["-DWORKSPACE_DEFINE=1"] in [workspace.build]. mcpp build -p app succeeds.
Expected
The lib member receives workspace defines in both builds, as documented in docs/07-workspace.md under the [workspace.build] merge rule.
Suspected cause
In src/build/prepare.cppm, fold_build_defines_into_flags(dep_manifest->buildConfig) runs for a path dependency before makePackageRoot calls inherit_workspace_build. The latter prepends the workspace defines after that fold, while makePackageRoot copies cflags and cxxflags to privateBuild without folding defines again. Thus inherited cxxflags reach the compiler, but inherited defines remain unused. The selected root takes a different path and works.
Activity
Sunrisepeak commentedon Sep 24, 2026
如果真的需要工作空间全局的宏, 目前先这样使用临时过度一下
defines传递的一致性, 等下个版本修复发布
fix: a host-tool sub-build merges its dependency's conditional sectio…
2026.9.25.1: workspace members compile the same way in every position…
docs: #690 records landed, with the release and ecosystem readings (#692
Sunrisepeak commentedon Sep 25, 2026
@julixian 更新了传递的一致性, xlings update mcpp -y 使用最新版本再试一试