Intel 2022 Compiler with Visual Studio 2022
Description:
Whenever building Visual Studio 2022 projects with set(CMAKE_CXX_COMPILER "icx")
and set(CMAKE_GENERATOR_TOOLSET "Intel C++ Compiler 2022")
, I get the following errors:
The CMAKE_CXX_COMPILER: icx is not a full path and was not found in the PATH
, and No CMAKE_C_COMPILER could be found
.
Previously, with oneAPI versions 2021.1.0 - 2021.4.0, this method did work and the CMAKE_CXX_COMPILER
variable was set to the proper path for the platform toolset to be set properly in Visual Studio.
I have attached a .cpp file, and a CMakeLists.txt that produces these results.
CMakeLists.txt
#Set the minimum required version of CMake.
cmake_minimum_required(VERSION 3.22.1)
option(INTEL_COMPILER "Do you want to used the Intel C++ Compiler 2022?" ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
if(INTEL_COMPILER)
if(WIN32)
if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
set(CMAKE_GENERATOR_TOOLSET "Intel C++ Compiler 2022")
set(CMAKE_CXX_COMPILER "icx")
endif()
add_compile_options(/fp:precise)
else()
set(CMAKE_C_COMPILER "icx")
set(CMAKE_CXX_COMPILER "icpx")
add_compile_options(-fp-model=precise)
endif()
endif()
project(ICXTest)
add_executable(${PROJECT_NAME} "main.cpp")
What I Tested:
If you define CMAKE_CXX_COMPILER
as the path to icx.exe
, the project gets built properly.
Additionally, whenever using CMake on Linux with set(CMAKE_CXX_COMPILER "icpx")
and set(CMAKE_C_COMPILER "icx")
the code does get built properly.
Ideas:
- Does this have something to do with
id_PostBuildEvent_Command
inModules/CMakeDetermineCompilerID.cmake
? - Does this have something to do with
Modules/CompilerId/VS-10.vcxproj.in
? - The Intel oneAPI release notes mention some binaries not being added to path, could this be related?