summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-10-27 12:20:48 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-10-27 12:20:54 (GMT)
commit8d6a0b9364581fbb95746c93cac4ec3c213f534b (patch)
tree062ecacc9474b272fafe3efeb5069730ca6e0d58 /Source
parent698851cdb7e49c2705898a71b2eaf96ca70b9ad5 (diff)
parentdd77dec18d66a2e20480d9bf2ab06231765720a4 (diff)
downloadCMake-8d6a0b9364581fbb95746c93cac4ec3c213f534b.zip
CMake-8d6a0b9364581fbb95746c93cac4ec3c213f534b.tar.gz
CMake-8d6a0b9364581fbb95746c93cac4ec3c213f534b.tar.bz2
Merge topic 'cuda_vs_skip_computation' into release-3.19
dd77dec18d VS: Don't compute CUDA options unless necessary e9109dec36 Merge branch 'ninja-multi-per-config-sources' into release-3.18 7c0de4175b Merge branch 'cmake-E-cat-binary' into release-3.18 Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5422
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGeneratorTarget.cxx8
-rw-r--r--Source/cmGeneratorTarget.h2
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx6
3 files changed, 14 insertions, 2 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 3560739..e735897 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -7240,6 +7240,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 0becee2..a482ed6 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -3078,7 +3078,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;
}
}
@@ -3218,7 +3219,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");