My use case is building a Fortran project with CMake, Ninja, Intel Fortran Compiler through Conan on Windows.
Commit c564a3e3 “Ninja: Always compile sources using absolute paths” included in CMake 3.21
had the following side effect for my use case.
When Ninja calls the Intel compiler for the preprocessing step the -P parameter now gets the Fortran source file with an absolute path.
The preprocessor adds this path as it was provided on the commandline as the first line (incl. “# 1”) in the preprocessed Fortran file.
There seems to be an bug in Intel compiler (I am using 19.1) which makes the compiler fail on lines longer than 139 characters. See for example here.
As I am using Conan for building the base path already is quiet long so that using an absolute path in the preprocessed file now leads to the Intel compiler issue. Using relative paths at this place (like in CMake <= 3.20) did not lead to this issue.
I also found the following CMake issue touching on this absolute vs. relative path issue in the preprocessed file altough in a different context.
I was wondering if CMake could again use relative paths just when calling the preprocessor although I recognise that my issue probably is more an issue of the Intel compiler.