Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • CMake CMake
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,802
    • Issues 3,802
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 16
    • Merge requests 16
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMake
  • CMakeCMake
  • Issues
  • #23097

Closed
Open
Created Jan 11, 2022 by Arsha Mamoozadeh@Arsha72128

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.

main.cpp

CMakeLists.txt

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 in Modules/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?
Edited Jan 12, 2022 by Brad King
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking