From 324988a6b101f29d148badc32b44964aedae1163 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 2 Oct 2019 13:57:12 -0400 Subject: cmGeneratorTarget: Add GetAllConfigCompileLanguages method Return all languages needed to compile sources in the target in any configuration. --- Source/cmGeneratorTarget.cxx | 13 +++++++++++++ Source/cmGeneratorTarget.h | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 949d9d9..0cc70c7 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1670,6 +1670,19 @@ void cmGeneratorTarget::ComputeAllConfigSources() const } } +std::set cmGeneratorTarget::GetAllConfigCompileLanguages() const +{ + std::set languages; + std::vector const& sources = this->GetAllConfigSources(); + for (AllConfigSource const& si : sources) { + std::string const& lang = si.Source->GetOrDetermineLanguage(); + if (!lang.empty()) { + languages.emplace(lang); + } + } + return languages; +} + std::string cmGeneratorTarget::GetCompilePDBName( const std::string& config) const { diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index c2811b2..4623513 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -132,6 +132,10 @@ public: per-source configurations assigned. */ std::vector const& GetAllConfigSources() const; + /** Get all languages used to compile sources in any configuration. + This excludes the languages of objects from object libraries. */ + std::set GetAllConfigCompileLanguages() const; + void GetObjectSources(std::vector&, const std::string& config) const; const std::string& GetObjectName(cmSourceFile const* file); -- cgit v0.12