summaryrefslogtreecommitdiff
path: root/Source/cmGeneratorTarget.cxx
diff options
context:
space:
mode:
authorRaul Tambre <raul@tambre.ee>2020-10-25 10:23:10 +0200
committerBrad King <brad.king@kitware.com>2020-10-27 07:29:01 -0400
commitdd77dec18d66a2e20480d9bf2ab06231765720a4 (patch)
tree8eb56d1f89b0d0729a5f7e5b508c61a52a3d4752 /Source/cmGeneratorTarget.cxx
parente9109dec360043d700ac9cb206b116e6f934a5ec (diff)
downloadcmake-dd77dec18d66a2e20480d9bf2ab06231765720a4.tar.gz
VS: Don't compute CUDA options unless necessary
In the following scenario (with 3.18 policies): 1. A CXX target is created. 2. CUDA language is enabled. CMake 3.18 introduced CMP0104, which requires CUDA_ARCHITECTURES to be set. Because the CXX target was created before CUDA was enabled it wouldn't have it set. The Visual Studio generator would however end up computing CUDA compile options for the CXX target, which would result in a fatal error due to the policy violation. There doesn't seem to be a reason to do this for targets that don't actually use the CUDA language, so we can skip and generate the CXX target just fine. Fixes: #21341
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r--Source/cmGeneratorTarget.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index ab6a26c974..b7bf4a6f7e 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -6914,6 +6914,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.