Setting default `-ccbin` or suppressing `incompatible redefinition for -ccbin` warnings

Hello! I’d like to construct an environment where nvcc uses a specific -ccbin by default, but the users could still override it. I know I can set CMAKE_CUDA_HOST_COMPILER or CUDAHOSTCXX for cmake projects. Otherwise I considered setting NVCC_PREPEND_FLAGS+=" --compiler-bindir=${COMPATIBLE_GCC_ABS_PATH}" which achieves the desired result except that it results in warnings (and sometimes errors) such as:

nvcc warning : incompatible redefinition for option 'compiler-bindir', the last value of this option was used

Is there a way to suppress this particular warning or a better way to set the default -ccbin?

Thanks

1 Like