CMake uses deprecated flag `-nofor_main` for Intel Fortran
In testing out Intel OneAPI 2021.1.1 with a code of mine, I saw the build spitting out:
ifort: command line warning #10434: option '-nofor_main' use with underscore is deprecated; use '-nofor-main' instead
After confirming it wasn't coming from our CMake macros, flags, etc., for Intel Fortran, I believe this is from Modules/Platform/Linux-Intel-Fortran.cmake
string(APPEND CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS " -nofor_main")
We do make TYPE SHARED
libraries so this makes sense why it could pop up.
I went back in time on an old cluster that I still have access to and that has old Intels and it looks like -nofor-main
(with dash) was supported in Intel Fortran 10 (Intel Fortran 9 had -nofor_main
in its manpage).
As I believe no one in their right mind should still be using Intel 9 (heck, Intel 17 should be avoided), it's probably safe to just change the flag by fiat, but if you want to still allow it, I think Intel 10 might be a good place to split the CMake.