1CMAKE_CUDA_HOST_COMPILER 2------------------------ 3 4.. versionadded:: 3.10 5 6When :variable:`CMAKE_CUDA_COMPILER_ID <CMAKE_<LANG>_COMPILER_ID>` is 7``NVIDIA``, ``CMAKE_CUDA_HOST_COMPILER`` selects the compiler executable to use 8when compiling host code for ``CUDA`` language files. 9This maps to the ``nvcc -ccbin`` option. 10 11The ``CMAKE_CUDA_HOST_COMPILER`` variable may be set explicitly before CUDA is 12first enabled by a :command:`project` or :command:`enable_language` command. 13This can be done via ``-DCMAKE_CUDA_HOST_COMPILER=...`` on the command line 14or in a :ref:`toolchain file <Cross Compiling Toolchain>`. Or, one may set 15the :envvar:`CUDAHOSTCXX` environment variable to provide a default value. 16 17Once the CUDA language is enabled, the ``CMAKE_CUDA_HOST_COMPILER`` variable 18is read-only and changes to it are undefined behavior. 19 20.. note:: 21 22 Since ``CMAKE_CUDA_HOST_COMPILER`` is meaningful only when the 23 :variable:`CMAKE_CUDA_COMPILER_ID <CMAKE_<LANG>_COMPILER_ID>` is ``NVIDIA``, 24 it does not make sense to set ``CMAKE_CUDA_HOST_COMPILER`` without also 25 setting ``CMAKE_CUDA_COMPILER`` to NVCC. 26 27.. note:: 28 29 Ignored when using :ref:`Visual Studio Generators`. 30