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
This commit is contained in:
Brad King
2021-11-02 12:54:57 +00:00
committed by Kitware Robot
7 changed files with 117 additions and 11 deletions

View File

@@ -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 +=