diff options
author | Brad King <brad.king@kitware.com> | 2020-06-15 13:24:31 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-06-15 13:24:37 (GMT) |
commit | a3881d6313776aaf4c1d92b68c5064c9ac5cdcd3 (patch) | |
tree | adb21432320e821b6afc262d818ed4bc0b19c7fa /Source | |
parent | 9fb67f690be915a13cd70b5af71f640660f0b2ab (diff) | |
parent | 877a92e968bfa24d86f4b9685b5c27d4c9e6c1be (diff) | |
download | CMake-a3881d6313776aaf4c1d92b68c5064c9ac5cdcd3.zip CMake-a3881d6313776aaf4c1d92b68c5064c9ac5cdcd3.tar.gz CMake-a3881d6313776aaf4c1d92b68c5064c9ac5cdcd3.tar.bz2 |
Merge topic 'cuda_architectures_disable' into release-3.18
877a92e968 CUDA: Add support for disabling CUDA_ARCHITECTURES
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4886
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 51 |
1 files changed, 29 insertions, 22 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 250910a..54d34ba 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -3044,6 +3044,34 @@ void cmGeneratorTarget::GetAppleArchs(const std::string& config, void cmGeneratorTarget::AddCUDAArchitectureFlags(std::string& flags) const { + const std::string& property = this->GetSafeProperty("CUDA_ARCHITECTURES"); + + if (property.empty()) { + switch (this->GetPolicyStatusCMP0104()) { + case cmPolicies::WARN: + if (!this->LocalGenerator->GetCMakeInstance()->GetIsInTryCompile()) { + this->Makefile->IssueMessage( + MessageType::AUTHOR_WARNING, + cmPolicies::GetPolicyWarning(cmPolicies::CMP0104) + + "\nCUDA_ARCHITECTURES is empty for target \"" + this->GetName() + + "\"."); + } + CM_FALLTHROUGH; + case cmPolicies::OLD: + break; + default: + this->Makefile->IssueMessage( + MessageType::FATAL_ERROR, + "CUDA_ARCHITECTURES is empty for target \"" + this->GetName() + + "\"."); + } + } + + // If CUDA_ARCHITECTURES is false we don't add any architectures. + if (cmIsOff(property)) { + return; + } + struct CudaArchitecture { std::string name; @@ -3054,28 +3082,7 @@ void cmGeneratorTarget::AddCUDAArchitectureFlags(std::string& flags) const { std::vector<std::string> options; - cmExpandList(this->GetSafeProperty("CUDA_ARCHITECTURES"), options); - - if (options.empty()) { - switch (this->GetPolicyStatusCMP0104()) { - case cmPolicies::WARN: - if (!this->LocalGenerator->GetCMakeInstance()->GetIsInTryCompile()) { - this->Makefile->IssueMessage( - MessageType::AUTHOR_WARNING, - cmPolicies::GetPolicyWarning(cmPolicies::CMP0104) + - "\nCUDA_ARCHITECTURES is empty for target \"" + - this->GetName() + "\"."); - } - CM_FALLTHROUGH; - case cmPolicies::OLD: - break; - default: - this->Makefile->IssueMessage( - MessageType::FATAL_ERROR, - "CUDA_ARCHITECTURES is empty for target \"" + this->GetName() + - "\"."); - } - } + cmExpandList(property, options); for (std::string& option : options) { CudaArchitecture architecture; |