summaryrefslogtreecommitdiff
path: root/Source/cmGeneratorTarget.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-02-28 13:23:14 -0500
committerBrad King <brad.king@kitware.com>2022-02-28 21:30:23 -0500
commitfe64c49e72ec025965bc9fe1a733859c025f68b1 (patch)
tree7fe823ffe65eb5370c807a3e0e5010f05d72f83f /Source/cmGeneratorTarget.cxx
parent07a7772968a17e804fc7c450a0a3a00a7203410d (diff)
downloadcmake-fe64c49e72ec025965bc9fe1a733859c025f68b1.tar.gz
CUDA: Simplify CMAKE_CUDA_ARCHITECTURES special value logic
Refactor the logic checking `CMAKE_CUDA_ARCHITECTURES` special values. Switch on the value first, and then make other decisions for each case. This makes room for other special values to be added later.
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r--Source/cmGeneratorTarget.cxx26
1 files changed, 13 insertions, 13 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index afcac5cbcb..63cf2ec0ea 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -3447,22 +3447,22 @@ void cmGeneratorTarget::AddCUDAArchitectureFlags(std::string& flags) const
this->Makefile->GetSafeDefinition("CMAKE_CUDA_COMPILER_ID");
// Check for special modes: `all`, `all-major`.
- if (compiler == "NVIDIA" &&
- cmSystemTools::VersionCompare(
- cmSystemTools::OP_GREATER_EQUAL,
- this->Makefile->GetDefinition("CMAKE_CUDA_COMPILER_VERSION"),
- "11.5")) {
- if (property == "all" || property == "all-major") {
+ if (property == "all" || property == "all-major") {
+ if (compiler == "NVIDIA" &&
+ cmSystemTools::VersionCompare(
+ cmSystemTools::OP_GREATER_EQUAL,
+ this->Makefile->GetDefinition("CMAKE_CUDA_COMPILER_VERSION"),
+ "11.5")) {
flags = cmStrCat(flags, " -arch=", property);
return;
}
- }
-
- if (property == "all") {
- property = *this->Makefile->GetDefinition("CMAKE_CUDA_ARCHITECTURES_ALL");
- } else if (property == "all-major") {
- property =
- *this->Makefile->GetDefinition("CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR");
+ if (property == "all") {
+ property =
+ *this->Makefile->GetDefinition("CMAKE_CUDA_ARCHITECTURES_ALL");
+ } else if (property == "all-major") {
+ property =
+ *this->Makefile->GetDefinition("CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR");
+ }
}
struct CudaArchitecture