Fortran: Unrecognized flag '-F' provided to gfortran on macOS when linking to a Framework
Architecture: macOS 13.5 (Ventura) with gfortran [GNU Fortran (Homebrew GCC 13.2.0) 13.2.0]
Problem description:
I am trying to build a Fortran target linking with LAPACK:
target_link_libraries(MyFortranTarget PRIVATE ${LAPACK_LIBRARIES})
The variable LAPACK_LIBRARIES
is set via find_package(LAPACK)
and reads:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/System/Library/Frameworks/Accelerate.framework -lm -ldl
Since MR !7121 (merged) this now adds following flag to the compilation of each Fortran file:
-F/Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/System/Library/Frameworks
This flag is not supported with gfortran resulting in a warning emitted for each compiled file:
f951: Warning: command-line option '-F/Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/System/Library/Frameworks' is valid for C/C++/ObjC/ObjC++ but not for Fortran
I think it is very unlikely that Fortran source code could make use of any header includes from any available Framework.