c++visual-studiocmakeintel-oneapi

Issues when building C++ using CMake with Intel oneApi


I my library I use boost's float128 wrapper therefore changing the compiler is not an option.

Following Intel's developer guide I added find_package(IntelDPCPP REQUIRED) to my CMakeLists.txt and ran cmake -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icx -GNinja on the VS 2022 terminal. I get the following error message

 Found package configuration file:

    C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/IntelDPCPP/IntelDPCPPConfig.cmake

  but it set IntelDPCPP_FOUND to FALSE so package "IntelDPCPP" is considered
  to be NOT FOUND.  Reason given by package:

  Unsupported compiler family and compiler icx!!

Anyone with a similar issue that can help out?

EDIT: as suggested by @Botje here the output information relevant to this case

IntelDPCPPConfig.cmake(84): string(COMPARE EQUAL ${CMAKE_CXX_COMPILER} nocmplr )
IntelDPCPPConfig.cmake(85): if(nocmplr)
IntelDPCPPConfig.cmake(93): if(NOT x${CMAKE_CXX_COMPILER_ID} STREQUAL xClang AND NOT x${CMAKE_CXX_COMPILER_ID} STREQUAL xIntelLLVM )
IntelDPCPPConfig.cmake(95): set(IntelDPCPP_FOUND False )

Solution

  • This is a known issue, it will be fixed in the OneAPI 2023.1 release.
    You can try reversing the order of find_package and project or removing find_package(IntelDPCPP REQUIRED) in CMakeLists.txt. Because CMake identifies and sets up all the compiler-related variables when the project() is called.
    Also, you can set the compiler option for the DPC++ compiler in CMakeLists.txt using the below command.

    set(CMAKE_CXX_COMPILER dpcpp)