Skip to content

[CMake] Fix dictionary depfile target under CMP0116 OLD - #23010

Closed
guitargeek wants to merge 1 commit into
root-project:masterfrom
guitargeek:ninja_fixup
Closed

[CMake] Fix dictionary depfile target under CMP0116 OLD#23010
guitargeek wants to merge 1 commit into
root-project:masterfrom
guitargeek:ninja_fixup

Conversation

@guitargeek

Copy link
Copy Markdown
Contributor

Follows up on ae4d830, which switched ROOT_GENERATE_DICTIONARY() from IMPLICIT_DEPENDS to a proper DEPFILE, but rebuilt every dictionary on every incremental build with older Ninja (e.g. 1.8.2 on Alma 8):

  ninja: expected depfile '.../io/io/G__RIO.depfile' to mention
         'io/io/G__RIO.cxx', got 'G__RIO.cxx'

rootcling writes the depfile target as the plain dictionary name it is given ("G__RIO.cxx") relative to CMAKE_CURRENT_BINARY_DIR. ROOT pins CMP0116 to OLD globally (see 7392b02), and under OLD the Ninja generator consumes the depfile verbatim and expects the target relative to the top-level build directory ("io/io/G__RIO.cxx"). The mismatch makes older Ninja treat the dictionary as perpetually out of date; newer Ninja tolerates it, which is why the regression only showed up on some platforms.

This commit suggests to enable CMP0116 NEW locally around the dictionary add_custom_command so CMake transforms the depfile to whatever the active generator needs.

Follows up on ae4d830, which switched ROOT_GENERATE_DICTIONARY()
from IMPLICIT_DEPENDS to a proper DEPFILE, but rebuilt every dictionary
on every incremental build with older Ninja (e.g. 1.8.2 on Alma 8):

```txt
  ninja: expected depfile '.../io/io/G__RIO.depfile' to mention
         'io/io/G__RIO.cxx', got 'G__RIO.cxx'
```

rootcling writes the depfile target as the plain dictionary name it is
given (`"G__RIO.cxx"`) relative to CMAKE_CURRENT_BINARY_DIR. ROOT pins
`CMP0116` to OLD globally (see 7392b02), and under OLD the Ninja
generator consumes the depfile verbatim and expects the target relative
to the top-level build directory (`"io/io/G__RIO.cxx"`). The mismatch
makes older Ninja treat the dictionary as perpetually out of date; newer
Ninja tolerates it, which is why the regression only showed up on some
platforms.

This commit suggests to enable CMP0116 NEW locally around the dictionary
`add_custom_command` so CMake transforms the depfile to whatever the
active generator needs.
@guitargeek guitargeek self-assigned this Aug 4, 2026
@guitargeek
guitargeek requested a review from bellenot as a code owner August 4, 2026 13:14
@guitargeek

Copy link
Copy Markdown
Contributor Author

Superseded by #23011

@guitargeek guitargeek closed this Aug 4, 2026
@guitargeek
guitargeek deleted the ninja_fixup branch August 4, 2026 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant