VS: Avoid unnecessary CUDA device linking for OBJECT libraries

Without `CudaLink` fields, MSBuild tries to perform a device link step
for object libraries with CUDA_SEPARABLE_COMPILATION on them even when
not needed.  This commonly was encountered when generating PTX or
OPTIX-IR output.
This commit is contained in:
Robert Maynard
2023-09-11 15:54:53 -04:00
committed by Brad King
parent 9aa25ed804
commit 6ebff6ebf8
3 changed files with 6 additions and 1 deletions
+4 -1
View File
@@ -3855,7 +3855,10 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaLinkOptions(
void cmVisualStudio10TargetGenerator::WriteCudaLinkOptions(
Elem& e1, std::string const& configName)
{
if (this->GeneratorTarget->GetType() > cmStateEnums::MODULE_LIBRARY) {
// We need to write link options for OBJECT libraries so that
// we override the default device link behavior ( enabled ) when
// building object libraries with ptx/optix-ir/etc
if (this->GeneratorTarget->GetType() > cmStateEnums::OBJECT_LIBRARY) {
return;
}