diff options
author | Brad King <brad.king@kitware.com> | 2022-02-28 18:23:14 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-03-01 02:30:23 (GMT) |
commit | fe64c49e72ec025965bc9fe1a733859c025f68b1 (patch) | |
tree | 7fe823ffe65eb5370c807a3e0e5010f05d72f83f /Source/cmGeneratorTarget.cxx | |
parent | 07a7772968a17e804fc7c450a0a3a00a7203410d (diff) | |
download | CMake-fe64c49e72ec025965bc9fe1a733859c025f68b1.zip CMake-fe64c49e72ec025965bc9fe1a733859c025f68b1.tar.gz CMake-fe64c49e72ec025965bc9fe1a733859c025f68b1.tar.bz2 |
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.cxx | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index afcac5c..63cf2ec 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 |