summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-07-22 14:45:33 (GMT)
committerBrad King <brad.king@kitware.com>2020-07-23 17:31:45 (GMT)
commit95b5df8646fa2b02c5eba175570f83fc6e2ece55 (patch)
treeb1f0d92af3ef25b4e1beee7906b9bd16b1798ff0
parent2f0790df5046bfc99383317eb7d24cd4030200be (diff)
downloadCMake-95b5df8646fa2b02c5eba175570f83fc6e2ece55.zip
CMake-95b5df8646fa2b02c5eba175570f83fc6e2ece55.tar.gz
CMake-95b5df8646fa2b02c5eba175570f83fc6e2ece55.tar.bz2
cmGeneratorTarget: Skip computing languages for custom targets
Targets created by `add_custom_target` do not compile any sources and therefore have no languages.
-rw-r--r--Source/cmGeneratorTarget.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index beafdea..554a954 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -7013,6 +7013,11 @@ std::string cmGeneratorTarget::GetDeprecation() const
void cmGeneratorTarget::GetLanguages(std::set<std::string>& languages,
const std::string& config) const
{
+ // Targets that do not compile anything have no languages.
+ if (!this->CanCompileSources()) {
+ return;
+ }
+
std::vector<cmSourceFile*> sourceFiles;
this->GetSourceFiles(sourceFiles, config);
for (cmSourceFile* src : sourceFiles) {