summaryrefslogtreecommitdiffstats
path: root/Source/cmVisualStudio10TargetGenerator.cxx
diff options
context:
space:
mode:
authorRobert Maynard <rmaynard@nvidia.com>2023-09-11 19:54:53 (GMT)
committerBrad King <brad.king@kitware.com>2023-09-11 20:49:35 (GMT)
commit6ebff6ebf8850a9372786bf56af8ee79dca6860d (patch)
tree26543b95df25cf5ab4ed704fcb6440fc7a12ef9a /Source/cmVisualStudio10TargetGenerator.cxx
parent9aa25ed8048226d82f7ceea8d99841a2fea9ffe3 (diff)
downloadCMake-6ebff6ebf8850a9372786bf56af8ee79dca6860d.zip
CMake-6ebff6ebf8850a9372786bf56af8ee79dca6860d.tar.gz
CMake-6ebff6ebf8850a9372786bf56af8ee79dca6860d.tar.bz2
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.
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index b3699ae..b011615 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -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;
}