Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
The Intel sign-in experience has changed to support enhanced security controls. If you sign in, click here for more information.
27766 Discussions

Visual Studio and CMake compiler identification fails

abrunner
Beginner
413 Views

Hello,

 

I am using Visual Studio 2022, version 17.2.5 to build a CMake project that creates a Fortran library as a target. The first two lines of my CMakeLists.txt are:

 

 

cmake_minimum_required(VERSION 3.0)
enable_language(Fortran)

 

 

When using Visual Studio to build the project, it fails at the second line with the following message:

 

 

    1> [CMake] -- Check for working Fortran compiler: C:/Program Files (x86)/Intel/oneAPI/compiler/2022.1.0/windows/bin/intel64/ifort.exe
    1> [CMake] CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
    1> [CMake] Missing variable is:
    1> [CMake] CMAKE_Fortran_PREPROCESS_SOURCE
    1> [CMake] CMake Error at C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.22/Modules/CMakeTestFortranCompiler.cmake:49 (try_compile):
    1> [CMake]   Failed to generate test project build system.

 

 

I have CMake 3.22, and I am using Ninja 1.10.2 as a generator. I have installed the Intel Fortran Compiler and I have ticked the option to add support for VS2022.

 

Does anyone know what is the cause of this problem and can help me ?

 

Thanks a lot ! 

0 Kudos
3 Replies
Barbara_P_Intel
Moderator
384 Views

The first thing I noticed is that you are using Visual Studio 2022, version 17.2.5. The interface to Intel Fortran broke when MS released v 17.2.  MS changed the COM API with that release. See this thread for more information and several workarounds.

We expect to have a fix for this problem in the next oneAPI release.

 

JohnNichols
Valued Contributor II
358 Views

Any ideas on the release time frame for the next oneAPI?

Barbara_P_Intel
Moderator
335 Views
Reply