summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-11-02 12:54:57 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-11-02 12:55:13 (GMT)
commit4e84a4763d702590fb06d62540e35a614dcd5133 (patch)
tree7e296b09c62be920fb89e93997743463842e1250 /Source
parentd273175157efcdcd5d114ee6e79e61e9bb7a26b6 (diff)
parent14d8a2768d8b8c2ba0f341b4bd59a875aaf6c2f4 (diff)
downloadCMake-4e84a4763d702590fb06d62540e35a614dcd5133.zip
CMake-4e84a4763d702590fb06d62540e35a614dcd5133.tar.gz
CMake-4e84a4763d702590fb06d62540e35a614dcd5133.tar.bz2
Merge topic 'support_nvcc_native_flag'
14d8a2768d CUDA: Support nvcc 11.5 new -arch=all|all-major flags Acked-by: Kitware Robot <kwrobot@kitware.com> Reviewed-by: Raul Tambre <raul@tambre.ee> Merge-request: !6652
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGeneratorTarget.cxx19
1 files changed, 16 insertions, 3 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 59c3e7a..2fedbd1 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -3465,6 +3465,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;
@@ -3506,9 +3522,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 +=