diff options
author | Brad King <brad.king@kitware.com> | 2023-09-18 18:39:17 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-09-19 15:31:23 (GMT) |
commit | 711de9aef6d900ffd52d8b540161945fa405c684 (patch) | |
tree | 7692c00ad2d597b1175ae9092edc31d88bf69633 | |
parent | 9e641b73c137c2073884e5049c79acb982fda031 (diff) | |
download | CMake-711de9aef6d900ffd52d8b540161945fa405c684.zip CMake-711de9aef6d900ffd52d8b540161945fa405c684.tar.gz CMake-711de9aef6d900ffd52d8b540161945fa405c684.tar.bz2 |
cmGeneratorTarget: Clarify local variable names for device architectures
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 764618e..0eb3851 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -3390,9 +3390,9 @@ void cmGeneratorTarget::AddCUDAArchitectureFlags(cmBuildStep compileOrLink, const std::string& config, std::string& flags) const { - std::string property = this->GetSafeProperty("CUDA_ARCHITECTURES"); + std::string arch = this->GetSafeProperty("CUDA_ARCHITECTURES"); - if (property.empty()) { + if (arch.empty()) { switch (this->GetPolicyStatusCMP0104()) { case cmPolicies::WARN: if (!this->LocalGenerator->GetCMakeInstance()->GetIsInTryCompile()) { @@ -3414,7 +3414,7 @@ void cmGeneratorTarget::AddCUDAArchitectureFlags(cmBuildStep compileOrLink, } // If CUDA_ARCHITECTURES is false we don't add any architectures. - if (cmIsOff(property)) { + if (cmIsOff(arch)) { return; } @@ -3423,23 +3423,22 @@ void cmGeneratorTarget::AddCUDAArchitectureFlags(cmBuildStep compileOrLink, const bool ipoEnabled = this->IsIPOEnabled("CUDA", config); // Check for special modes: `all`, `all-major`. - if (property == "all" || property == "all-major") { + if (arch == "all" || arch == "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); + flags = cmStrCat(flags, " -arch=", arch); return; } - if (property == "all") { - property = - *this->Makefile->GetDefinition("CMAKE_CUDA_ARCHITECTURES_ALL"); - } else if (property == "all-major") { - property = + if (arch == "all") { + arch = *this->Makefile->GetDefinition("CMAKE_CUDA_ARCHITECTURES_ALL"); + } else if (arch == "all-major") { + arch = *this->Makefile->GetDefinition("CMAKE_CUDA_ARCHITECTURES_ALL_MAJOR"); } - } else if (property == "native") { + } else if (arch == "native") { cmValue native = this->Makefile->GetDefinition("CMAKE_CUDA_ARCHITECTURES_NATIVE"); if (native.IsEmpty()) { @@ -3452,10 +3451,10 @@ void cmGeneratorTarget::AddCUDAArchitectureFlags(cmBuildStep compileOrLink, cmSystemTools::OP_GREATER_EQUAL, this->Makefile->GetDefinition("CMAKE_CUDA_COMPILER_VERSION"), "11.6")) { - flags = cmStrCat(flags, " -arch=", property); + flags = cmStrCat(flags, " -arch=", arch); return; } - property = *native; + arch = *native; } struct CudaArchitecture @@ -3467,7 +3466,7 @@ void cmGeneratorTarget::AddCUDAArchitectureFlags(cmBuildStep compileOrLink, std::vector<CudaArchitecture> architectures; { - cmList options(property); + cmList options(arch); for (auto& option : options) { CudaArchitecture architecture; @@ -3549,10 +3548,10 @@ void cmGeneratorTarget::AddCUDAArchitectureFlags(cmBuildStep compileOrLink, void cmGeneratorTarget::AddISPCTargetFlags(std::string& flags) const { - const std::string& property = this->GetSafeProperty("ISPC_INSTRUCTION_SETS"); + const std::string& arch = this->GetSafeProperty("ISPC_INSTRUCTION_SETS"); // If ISPC_TARGET is false we don't add any architectures. - if (cmIsOff(property)) { + if (cmIsOff(arch)) { return; } @@ -3560,7 +3559,7 @@ void cmGeneratorTarget::AddISPCTargetFlags(std::string& flags) const this->Makefile->GetSafeDefinition("CMAKE_ISPC_COMPILER_ID"); if (compiler == "Intel") { - cmList targets(property); + cmList targets(arch); if (!targets.empty()) { flags += cmStrCat(" --target=", cmWrap("", targets, "", ",")); } @@ -3569,20 +3568,20 @@ void cmGeneratorTarget::AddISPCTargetFlags(std::string& flags) const void cmGeneratorTarget::AddHIPArchitectureFlags(std::string& flags) const { - const std::string& property = this->GetSafeProperty("HIP_ARCHITECTURES"); + const std::string& arch = this->GetSafeProperty("HIP_ARCHITECTURES"); - if (property.empty()) { + if (arch.empty()) { this->Makefile->IssueMessage(MessageType::FATAL_ERROR, "HIP_ARCHITECTURES is empty for target \"" + this->GetName() + "\"."); } // If HIP_ARCHITECTURES is false we don't add any architectures. - if (cmIsOff(property)) { + if (cmIsOff(arch)) { return; } - cmList options(property); + cmList options(arch); for (std::string& option : options) { flags += " --offload-arch=" + option; |