How to prevent CMake to add an empty /Fd flag

ElBorak3
Mon, 14 Jul 2025 14:30:48 +0000
Usage

In CMake, while using the ninja generator, when I try to build my fortran project, an empty /Fd flag (the flag used to specify the path name of the generated .pdb) is always set at the end of the command passed to the ifort compiler. I am trying to generate multiple static libraries (.lib). I tried forcing the /Fd flag with the correct path by using CMAKE_Fortran_FLAGS_DEBUG but it then gets overwritten by the empty /Fd flag added by CMake. Setting the target properties COMPILE_PDB_OUTPUT_DIRECTORY or COMPILE_PDB_NAME does not affect the empty flag /Fd added. My goal here is to have a single .PDB generated by every static library that I generate. Note that I am using the Intel Ifort compiler and I am using ninja as my generator. Is there any way I can solve this problem or force the right /Fd flag at the END of the command passed to Ifort so that it overwrites correctly?

1 post - 1 participant