1CMAKE_CUDA_ARCHITECTURES
2------------------------
3
4.. versionadded:: 3.18
5
6Default value for :prop_tgt:`CUDA_ARCHITECTURES` property of targets.
7
8Initialized by the :envvar:`CUDAARCHS` environment variable if set.
9Otherwise as follows depending on :variable:`CMAKE_CUDA_COMPILER_ID <CMAKE_<LANG>_COMPILER_ID>`:
10
11- For ``Clang``: the oldest architecture that works.
12
13- For ``NVIDIA``: the default architecture chosen by the compiler.
14  See policy :policy:`CMP0104`.
15
16Users are encouraged to override this, as the default varies across compilers
17and compiler versions.
18
19This variable is used to initialize the :prop_tgt:`CUDA_ARCHITECTURES` property
20on all targets. See the target property for additional information.
21
22Examples
23^^^^^^^^
24
25.. code-block:: cmake
26
27  cmake_minimum_required(VERSION)
28
29  if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
30    set(CMAKE_CUDA_ARCHITECTURES 75)
31  endif()
32
33  project(example LANGUAGES CUDA)
34
35``CMAKE_CUDA_ARCHITECTURES`` will default to ``75`` unless overridden by the user.
36