CMAKE_CUDA_HOST_COMPILER.rst 1.1 KB

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