# use cmake with intel oneAPI base toolkit

**URL:** https://discourse.cmake.org/t/use-cmake-with-intel-oneapi-base-toolkit/5562
**Category:** Usage
**Created:** [April 28, 2022, 8:40am UTC](https://discourse.cmake.org/t/use-cmake-with-intel-oneapi-base-toolkit/5562 "2022-04-28T08:40:52Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Daniel\_Droste](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/d/a4c791/32.png) [@Daniel\_Droste](https://discourse.cmake.org/u/Daniel_Droste)
#### Post date: [April 28, 2022, 8:40am UTC](https://discourse.cmake.org/t/use-cmake-with-intel-oneapi-base-toolkit/5562/1 "2022-04-28T08:40:52Z")

</div>

Hi,

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’:

![](https://discourse.cmake.org/uploads/default/original/2X/d/d4b93baea392fac60ba15068ec0234c831abb3ef.png)

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\* (intel.com)](https://www.intel.com/content/www/us/en/developer/articles/technical/using-oneapi-compilers-with-cmake-in-visual-studio.html)

“cacheVariables”: {

“CMAKE\_CXX\_COMPILER”: “dpcpp”

},

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](https://developercommunity.visualstudio.com/t/CMake-using-CMakePreset-and-select-other/10022001#T-ND10025332)

[Solved: switch from VS2022 toolset to intel dpc++ (CMAKE) - Intel Communities](https://community.intel.com/t5/Migrating-to-SYCL/switch-from-VS2022-toolset-to-intel-dpc-CMAKE/td-p/1351498)

[Use DCP for simple cake sample - Intel Communities](https://community.intel.com/t5/Migrating-to-SYCL/Use-DCP-for-simple-cake-sample/td-p/1378367)

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

[CMakeProject1.zip](https://discourse.cmake.org/uploads/short-url/mRUxhujV5EC4dZEhSL1Pip8HXo3.zip) (3.32 KB)

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [April 28, 2022, 10:58am UTC](https://discourse.cmake.org/t/use-cmake-with-intel-oneapi-base-toolkit/5562/2 "2022-04-28T10:58:47Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Daniel\_Droste](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/d/a4c791/32.png) [@Daniel\_Droste](https://discourse.cmake.org/u/Daniel_Droste)
#### Post date: [April 28, 2022, 11:03am UTC](https://discourse.cmake.org/t/use-cmake-with-intel-oneapi-base-toolkit/5562/3 "2022-04-28T11:03:25Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [April 28, 2022, 11:55am UTC](https://discourse.cmake.org/t/use-cmake-with-intel-oneapi-base-toolkit/5562/4 "2022-04-28T11:55:26Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![vre](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/v/f04885/32.png) [@vre](https://discourse.cmake.org/u/vre)
#### Post date: [April 28, 2022, 12:00pm UTC](https://discourse.cmake.org/t/use-cmake-with-intel-oneapi-base-toolkit/5562/5 "2022-04-28T12:00:33Z")

</div>

According to [this](https://www.intel.com/content/www/us/en/developer/articles/technical/using-oneapi-compilers-with-cmake-in-visual-studio.html) it’s setting the toolset and the compiler name(s).
