diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 8 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.h | 2 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 6 |
3 files changed, 14 insertions, 2 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index fcfcc53..01d9bec 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -7245,6 +7245,14 @@ void cmGeneratorTarget::GetLanguages(std::set<std::string>& languages, } } +bool cmGeneratorTarget::IsLanguageUsed(std::string const& language, + std::string const& config) const +{ + std::set<std::string> languages; + this->GetLanguages(languages, config); + return languages.count(language); +} + bool cmGeneratorTarget::IsCSharpOnly() const { // Only certain target types may compile CSharp. diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index e5fa892..2517b72 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -417,6 +417,8 @@ public: // until we have per-target object file properties. void GetLanguages(std::set<std::string>& languages, std::string const& config) const; + bool IsLanguageUsed(std::string const& language, + std::string const& config) const; bool IsCSharpOnly() const; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 0d31c5e..9f6973e 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -3106,7 +3106,8 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions() return true; } for (std::string const& c : this->Configurations) { - if (!this->ComputeCudaOptions(c)) { + if (this->GeneratorTarget->IsLanguageUsed("CUDA", c) && + !this->ComputeCudaOptions(c)) { return false; } } @@ -3246,7 +3247,8 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions( void cmVisualStudio10TargetGenerator::WriteCudaOptions( Elem& e1, std::string const& configName) { - if (!this->MSTools || !this->GlobalGenerator->IsCudaEnabled()) { + if (!this->MSTools || !this->GlobalGenerator->IsCudaEnabled() || + !this->GeneratorTarget->IsLanguageUsed("CUDA", configName)) { return; } Elem e2(e1, "CudaCompile"); |