Development Reference Guides

Contents

Use CMake with the
Intel® oneAPI
DPC++/C++
Compiler

The following content is OS specific.

Linux*

Use of CMake with the
Intel® oneAPI
DPC++/C++
Compiler
on Linux is supported. When you are using CMake, the compiler is enabled using the
icx
(variant) binary. You may need to set your
CC/CXX
or
CMAKE_C_COMPILER /CMAKE_CXX_COMPILER
string to
icx/icpx
. For example:
$ cmake -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx …
-OR-
$ export CC=icx; export CXX=icpx; cmake …

Windows*

Use of CMake with the Intel® oneAPI DPC++/C++ Compiler on Windows is supported. When you are using CMake, the compiler is enabled using the
icx
(variant) binary. You may need to set your
CC/CXX
or
CMAKE_C_COMPILER /CMAKE_CXX_COMPILER
string to
icx
. The supported generator in the Windows environment is Ninja*.
$ cmake -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icx -GNinja …
-OR-
$ CC=icx CXX=icx cmake -GNinja …
If your Microsoft Visual Studio default CMake version is older than 3.21, you need to install CMake 3.21 (or above) and update Microsoft Visual Studio with the new CMake executable. Edit the
CMakeSettings.json
file for this update.

Support

Use the following steps to enable the compiler for your project:
  1. Add the following snippet to your project’s
    CMakeLists.txt
    :
    cmake_minimum_required(VERSION 3.21.0)
    The minimum required version for using CMake with the Intel® oneAPI DPC++/C++ Compiler is 3.21.
  2. Add the following snippet to your project’s
    CMakeLists.txt
    :
    find_package(IntelDPCPP REQUIRED)
    This snippet enables the
    dpcpp
    compiler. The DPC++ configuration package (
    IntelDPCPPConfig.cmake
    ) is shipped with the Intel® oneAPI DPC++/C++ Compiler. The package directory is found in the parent directory of
    icx
    bin directory. Example:
    /deploy/linux_prod/IntelDPCPP/IntelDPCPPConfig.cmake
    .
  3. Select the appropriate compilers for C and C++; see the Linux and Windows sections above for specific settings.
  4. Run CMake and build your applications as normal.
  5. The DCP++ configuration package exposes other variables that may be required. Refer to the package for more information.

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.