summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorTarget.cxx
diff options
context:
space:
mode:
authorRobert Maynard <rmaynard@nvidia.com>2021-08-17 16:28:23 (GMT)
committerRobert Maynard <rmaynard@nvidia.com>2021-11-01 18:57:58 (GMT)
commit14d8a2768d8b8c2ba0f341b4bd59a875aaf6c2f4 (patch)
tree2074643d278024f89622b959a7795ee57438c222 /Source/cmGeneratorTarget.cxx
parente1acb03cd9b53fe81dd9e1696ac293ae5ba468cc (diff)
downloadCMake-14d8a2768d8b8c2ba0f341b4bd59a875aaf6c2f4.zip
CMake-14d8a2768d8b8c2ba0f341b4bd59a875aaf6c2f4.tar.gz
CMake-14d8a2768d8b8c2ba0f341b4bd59a875aaf6c2f4.tar.bz2
CUDA: Support nvcc 11.5 new -arch=all|all-major flags
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r--Source/cmGeneratorTarget.cxx19
1 files changed, 16 insertions, 3 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index fc02a47..8cc524a 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -3317,6 +3317,22 @@ void cmGeneratorTarget::AddCUDAArchitectureFlags(std::string& flags) const
return;
}
+ std::string const& compiler =
+ this->Makefile->GetSafeDefinition("CMAKE_CUDA_COMPILER_ID");
+
+ // Check for special modes: `all`, `all-major`.
+ if (property == "all") {
+ if (compiler == "NVIDIA") {
+ flags += " -arch=all";
+ return;
+ }
+ } else if (property == "all-major") {
+ if (compiler == "NVIDIA") {
+ flags += " -arch=all-major";
+ return;
+ }
+ }
+
struct CudaArchitecture
{
std::string name;
@@ -3358,9 +3374,6 @@ void cmGeneratorTarget::AddCUDAArchitectureFlags(std::string& flags) const
}
}
- std::string const& compiler =
- this->Makefile->GetSafeDefinition("CMAKE_CUDA_COMPILER_ID");
-
if (compiler == "NVIDIA") {
for (CudaArchitecture& architecture : architectures) {
flags +=