Skip to content

Ninja: Restore support for Fortran in a symlinked build tree

Brad King requested to merge brad.king/cmake:ninja-fortran-symlink into master

Since !5485 (merged), Fortran stopped working in a build tree whose path contains a symlink. The reason is that the P1689r3 format's work-directory field gets populated with the realpath (via getcwd) of the build tree instead of the logical path to the build tree used for generating relative paths in build.ninja. This causes the Fortran.dd file to get absolute (real)paths to .o files, and Ninja does not match them with the relative .o file paths in build.ninja.

Fix this by dropping use of the work-directory field. This restores our prior approach of generating paths in the dyndep file using the same forms of paths received from the buildsystem generator. The P1689r3 paper's format may need to be revised to account for this.

Fixes: #21683 (closed)
Backport: release

Merge request reports