Development Reference Guides

Contents

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

Linux

Using CMake with the 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 …

Windows

Using CMake with the 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. For example:
cmake -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icx -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 snippets to your project’s
    CMakeLists.txt
    :
    cmake_minimum_required(VERSION 3.21.0)
    And:
    find_package(IntelDPCPP REQUIRED)
    The second snippet enables the
    dpcpp
    compiler. The heterogeneous compilation configuration package (
    IntelDPCPPConfig.cmake
    ) is shipped with the compiler. The package directory is found in the parent directory of the
    icx
    bin directory.
  2. Select the appropriate compilers for C or C++. See the Linux and Windows sections above for specific settings.
  3. Run CMake and build your applications as normal.
  4. The heterogeneous compilation 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.