MS Visual Studio Generator : Selecting Intel Compiler Toolchain from the Command line breaks FortranCInterface
The attached sample project builds perfectly with serveral environments / generators (e.g. Linux/GNU/make, Linux/Intel/Make, Windows/intel/nmake, Windows/MSVC/nmake, Windows/MSVC/VS). All these variants can be selected via cmake command line parameters (see go and go.bat scripts).
However, the one thing that does not work is selecting the Intel C/C++ Compilers as toolchain via the -T command line option to cmake. (cmake .. -T "Intel C++ Compiler XE 14.0"). Strangely, if I enforce it in the CMakeLists.txt file instead of passing it as a command line argument (set CMAKE_GENERATOR_TOOLSET "Intel ..." CACHE STRING "Platform Toolset" FORCE), it works fine.
The error message I get looks as if cmake somehow decides to use the Intel C Compiler icl.exe as Fortran Compiler:
-- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done Fortran Compiler: C:/Program Files (x86)/Intel/Composer XE 2013 SP1/bin/ia32/icl.exe Fortran Compiler: Intel C Compiler: C:/Program Files (x86)/Intel/Composer XE 2013 SP1/bin/ia32/icl.exe C++ Compiler: C:/Program Files (x86)/Intel/Composer XE 2013 SP1/bin/ia32/icl.exe -- Detecting Fortran/C Interface -- Detecting Fortran/C Interface - Failed to compile CMake Error at CMakeLists.txt:54 (message): No Fortran/C-Interface could be detected
The problem occurs on my machine with the following tool versions:
- cmake 3.3.2 & 3.5.0-rc2
- Visual Studio 2012 & 2015
- Intel Compilers 14 & 17
- Windows 7