FindOpenACC — CMake 3.25.1 Documentation

# FindOpenACC

New in version 3.10.

Detect OpenACC support by the compiler.

This module can be used to detect OpenACC support in a compiler. If the compiler supports OpenACC, the flags required to compile with OpenACC support are returned in variables for the different languages. Currently, only NVHPC, PGI, GNU and Cray compilers are supported.

## Imported Targets

New in version 3.16.

The module provides `IMPORTED` targets:

`OpenACC::OpenACC_<lang>`

  Target for using OpenACC from `<lang>`.

## Variables

The module defines the following variables:

`OpenACC_FOUND`

  New in version 3.25.

  Variable indicating that OpenACC flags for at least one languages have been found.

This module will set the following variables per language in your project, where `<lang>` is one of C, CXX, or Fortran:

`OpenACC_<lang>_FOUND`

  Variable indicating if OpenACC support for `<lang>` was detected.

`OpenACC_<lang>_FLAGS`

  OpenACC compiler flags for `<lang>`, separated by spaces.

`OpenACC_<lang>_OPTIONS`

  New in version 3.16.

  OpenACC compiler flags for `<lang>`, as a list. Suitable for usage with target_compile_options or target_link_options.

The module will also try to provide the OpenACC version variables:

`OpenACC_<lang>_SPEC_DATE`

  Date of the OpenACC specification implemented by the `<lang>` compiler.

`OpenACC_<lang>_VERSION_MAJOR`

  Major version of OpenACC implemented by the `<lang>` compiler.

`OpenACC_<lang>_VERSION_MINOR`

  Minor version of OpenACC implemented by the `<lang>` compiler.

`OpenACC_<lang>_VERSION`

  OpenACC version implemented by the `<lang>` compiler.

The specification date is formatted as given in the OpenACC standard: `yyyymm` where `yyyy` and `mm` represents the year and month of the OpenACC specification implemented by the `<lang>` compiler.

## Input Variables

`OpenACC_ACCEL_TARGET=<target>` If set, will the correct target accelerator flag set to the <target> will be returned with OpenACC_<lang>_FLAGS.