How to set up compilation with Intel Fortran compiler on Windows correctly?

Both (1) and (3) are expected to work.

I’m not able to reproduce this failure:

>cmake --version
cmake version 3.16.3
...

>type ..\CMakeLists.txt
cmake_minimum_required(VERSION 3.15)
project(TryFortran Fortran)

>cmake .. -G "Visual Studio 15 2017 Win64"
...
-- The Fortran compiler identification is Intel 19.0.5.20190815
...
-- Check for working Fortran compiler: C:/Program Files (x86)/Intel/SWTools/compilers_and_libraries_2019/windows/bin/intel64/ifort.exe  -- works

Be sure to check the CMakeFiles/CMakeError.log mentioned in CMake’s output.

Also, be sure you have Intel 2019 update 5 or above. Otherwise a bug in the Intel Compiler Visual Studio Integration prevents it from working. See CMake Issue 19691 for details of that problem.