Ninja: Debug symbols in Fortran with Intel compiler on Windows
Description There is a problem with debugging Fortran code, because the source code reference in the object file is not set correctly.
Additional Information Apparently, during preprocessing of a source file with the Intel compiler the result is written to the terminal and then redirected into a subfolder. This behavior is defined in
CMAKE_Fortran_PREPROCESS_SOURCE (more precisely, here: -E > <PREPROCESSED_SOURCE>).
The preprocessed file contains a reference to the source file in the first line comment (# 1 “…\main.f” in the minimal example),
which is used by the Intel compiler to create the reference in the object file. But since the preprocessed file is shifted into a subfolder, the relative path becomes outdated and in the object file we get an invalid path (CMakeFiles\hello_world_fortran.dir…\main.f in the minimal example).
Version Information The problem appears with Ninja version 1.9.0, CMake version 3.19.3, IFort version 220.127.116.11, and Fortran 77.