use cmake with intel oneAPI base toolkit


I try since some weeks to compile a simple C++ program with the Intel oneAPI dpcpp Compiler and cmake:

using namespace std;

int main()


cout << “Hello CMake.” << endl;

return 0;


What I did is this:

  • Install a new Windows 11 with all updates
  • Install latest VS2022 community Edition with c++ and cmake support
  • Install latest Intel oneAPI base toolkit for Windows with all Options

I creates the cmake sample c++ commandline application with: ‘File->New->Project…’. Then pick ‘CMake Project’:

I modified the CMakePreset.json to Point to the dpcpp Compiler (Project attached to this mail) as described on this page: Using oneAPI Compilers with CMake* in Microsoft Visual Studio* (

“cacheVariables”: {



and change the Project CMakeLists.txt to include: find_package(IntelDPCPP REQUIRED).

This seems not to work within VS2022 (unfortunately): Then I tried to get it work from the Intel oneAPI commandline: „C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Intel oneAPI 2022\ Intel oneAPI command prompt for Intel 64 for Visual Studio 2022“

Running ‚cmake‘ from there I get Errors like this:

CMake Error at CMakeLists.txt:5 (find_package):

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 !!

– Configuring incomplete, errors occurred!

Since I run out of ideas I ask Intel and Microsoft for help, but they also seem to have no idea how this can be done.

CMake using CMakePreset and select other compiler - Visual Studio Feedback

Solved: switch from VS2022 toolset to intel dpc++ (CMAKE) - Intel Communities

Use DCP for simple cake sample - Intel Communities

I was under the Impression that Intel oneAPI is support by cmake? Do you have and idea how I can use this compiler (in the end I need the intel dpcpp-cl.exe to allow a cl compatible commandline options) with cmake?

Thanks a lot,

Daniel Droste (3.32 KB)

The Visual Studio generator doesn’t use CMAKE_CXX_COMPILER at all. You select toolchains using the -T argument instead. I don’t know what string the OneAPI toolchain uses though.

Hi Ben,

Thanks a lot for your fast reply. What is the best option for me to get this working – or do you think that this is too complex to get it working?

Well, it can’t be fixed from CMake code. The -T flag when configuring is the Right Way™. I just don’t know what the parameter is that needs to be specified for Intel’s toolchain.

According to this it’s setting the toolset and the compiler name(s).