Skip to content

cmake: propagate generated-file dependencies to the compile order - #16077

Open
LDAP wants to merge 1 commit into
mesonbuild:masterfrom
LDAP:fix/cmake-object-depends
Open

cmake: propagate generated-file dependencies to the compile order#16077
LDAP wants to merge 1 commit into
mesonbuild:masterfrom
LDAP:fix/cmake-object-depends

Conversation

@LDAP

@LDAP LDAP commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

I ran into #9062 when trying to build glslang as subproject.

I'm not familiar with meson internals, so this is an AI generated patch. However, it fixed the issue in my case, so I wanted to submit it here for proper review:

The CMake subproject translation dropped two kinds of compile-order dependency on generated files:

  • OBJECT_DEPENDS, set via set_source_files_properties(), was not parsed at all, so a source including a generated header had no edge to the custom target producing it.
  • Only the direct custom-target dependencies of a target were collected. CMake's ninja backend emits cmake_object_order_depends_target_* edges for the transitive closure, so a custom target reachable only through another regular target was lost.

Both make clean builds fail non-deterministically with a missing generated header. Parse OBJECT_DEPENDS in the trace parser, resolve file-level dependencies to the custom target generating the file, and walk the dependency graph transitively when collecting the custom targets a target must wait for.

Fixes #9062

The CMake subproject translation dropped two kinds of compile-order
dependency on generated files:

  * OBJECT_DEPENDS, set via set_source_files_properties(), was not
    parsed at all, so a source including a generated header had no edge
    to the custom target producing it.
  * Only the direct custom-target dependencies of a target were
    collected. CMake's ninja backend emits
    cmake_object_order_depends_target_* edges for the transitive
    closure, so a custom target reachable only through another regular
    target was lost.

Both make clean builds fail non-deterministically with a missing
generated header. Parse OBJECT_DEPENDS in the trace parser, resolve
file-level dependencies to the custom target generating the file, and
walk the dependency graph transitively when collecting the custom
targets a target must wait for.

Fixes mesonbuild#9062
@LDAP
LDAP requested a review from mensinda as a code owner August 6, 2026 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

build.ninja is missing dependencies present in cmake subproject

1 participant