Incorporating Intel OneAPI into a mixed language cmake project

I am trying to upgrade a mixed language (C, CXX, Fortran) cmake project originally developed for Visual Studio 2010 with Intel 2011 using cmake 2.8.12, which has worked for a long time! Fast forward ten years. Without uninstalling those old tools yet, I installed VS 17 2022 community and Intel OneAPI, copied the cmake 4.1.1 files into a new Program Files (x86) directory and tweaked the environment variables to work with 4.1.1. So far I have been unable to convince cmake to recognize the new Fortran compiler. I have tried using things like: project(), enable_language(), and command-line flags. This is a snippet of what is returned:

– The Fortran compiler identification is IntelLLVM 2025.2.0 with MSVC-like command-line
CMake Error at CMakeLists.txt:31 (enable_language):
No CMAKE_Fortran_COMPILER could be found.

The C and CXX checks are fine. Can anyone suggest a solution or next steps? I can provide specific examples of command-line args and Cmakelists.txt if that helps.

**

Partly Solved

It only took 4 days to get this far. I’m not adept in the Cmake world, so perhaps others can improve on or generalize this part of the solution. Here is what works in my case. I’ve explored different sequences of the commands below, and Cmake 4.1.1 is sensitive to that. Without repeating all the orderings and permutations that do NOT work, here is what works in my project, a Fortran/C/C++ solution with around 650 source and include files.

#==========
# forward slashes mandatory
set (CMAKE_Fortran_COMPILER “C:/Program Files (x86)/Intel/oneAPI/2025.2/bin”)
set (CMAKE_Fortran_Format FIXED)
set (CMAKE_VERBOSE_MAKEFILE ON)
#set(CMAKE_Fortran_FLAGS “TBA”) #dev still going on here

project(FVS)
enable_language(Fortran CXX)
#==========

The key thing to get this far was to name the path to the Intel compiler directory, using unix-style slashes. A couple of other command orderings seem to work, but the one shown above creates a SLN file without any warnings.

I purposely did not change any Environment variables: an option that may also work and which could avoid the specificity of putting the full pathname in CmakeLists.txt. In my case I wanted to avoid changing the Environment because I want to maintain my old build-chain for the moment, until the new build chain is shaken down.

Not Yet Solved

The SLN file works in part. Files with C and C++ source code compile without complaint. But those with Fortran source code produce this error:

#=================
Compiling with Intel® Fortran Compiler 2025.2.1 [Intel(R) 64]…
Creating temporary file “RSP1.rsp” with contents
[
/nologo /debug:full /Od /fpp
/I"C:\open-fvs-essadev\ESSAdev\bin\FVSbc_CmakeDir"

<many include files skipped here>

/DANSI /DWINDOWS /D_WINDLL /DCMAKE_INTDIR="Debug" /module:“.\Debug” /object:“FVSbc.dir\Debug\” /libs:dll /threads /dbglibs /c -Zi /extfor:f /Qlocation,link,“C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\bin\HostX64\x64” /Qm64 “C:\open-fvs-essadev\ESSAdev\base\main.f”
]
Creating command line “ifx @“C:\open-fvs-essadev\ESSAdev\bin\FVSbc_CmakeDir\FVSbc.dir\Debug\RSP1.rsp””
ifx: command line warning #10161: unrecognized source type ‘Files\Microsoft’; object file assumed
ifx: command line warning #10161: unrecognized source type ‘Visual’; object file assumed
fpp: fatal: can’t fopen file: Studio\2022\Community\VC\Tools\MSVC\14.44.35207\bin\HostX64\x64 /Qm64 C:\open-fvs-essadev\ESSAdev\base\main.f
#=================

The ifx and fpp errors appear to be caused by a lack of double-quotes, causing the command-line in the RSP file to be flawed and misunderstood.

Suggestions or ideas on how to solve this are welcome.