Skip to content

CUDA: Add abstraction to pass flags to host compiler

We can set the (default) compilation flags for a language using the CMAKE_<LANG>_FLAGS variable, or set an individual target's compilation options with target_compile_options().

However, with languages involving "compiler driving", in which some of the code is handed off to a secondary compiler - we don't have such a mechanism for setting compilation flags for the secondary compiler. We can choose that compiler, using CMAKE_<LANG>_HOST_COMPILER, but that's it.

CMake should implement parallels of the existing command, and variable, as follows:

  • target_host_compile_options() - the equivalent of target_compile_options(); for example, with CUDA and NVCC, will result in the NVCC command-line getting an extra --compiler-options "option1,option2,etc, etc".
  • CMAKE_<LANG>_HOST_COMPILER - which, when non-empty, will behave as the above but for all targets, and will have its contents placed in the --compiler-options before the target-specific ones (or should it be after them?)

See also this StackOverflow discussion.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information