diff options
| author | Kyle Edwards <kyle.edwards@kitware.com> | 2020-08-13 18:16:18 (GMT) |
|---|---|---|
| committer | Kitware Robot <kwrobot@kitware.com> | 2020-08-13 18:16:25 (GMT) |
| commit | 8b5aa9051b0df7bead47deb25d8cfa33679f747d (patch) | |
| tree | 39d8bee86aec32930c93ccfc725414261fcc84d8 /Source/cmGeneratorTarget.cxx | |
| parent | 5748e76639822bf330986b0b77da6fd70f3de301 (diff) | |
| parent | 2e42651dff43c4e962f03fc24281cbf446880ded (diff) | |
| download | CMake-8b5aa9051b0df7bead47deb25d8cfa33679f747d.zip CMake-8b5aa9051b0df7bead47deb25d8cfa33679f747d.tar.gz CMake-8b5aa9051b0df7bead47deb25d8cfa33679f747d.tar.bz2 | |
Merge topic 'optimize-static-library-deps'
2e42651dff Add option to optimize link dependencies for static libraries
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5103
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
| -rw-r--r-- | Source/cmGeneratorTarget.cxx | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 889ad7c..9611e14 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1084,6 +1084,37 @@ std::vector<cmCustomCommand> const& cmGeneratorTarget::GetPostBuildCommands() return this->Target->GetPostBuildCommands(); } +void cmGeneratorTarget::AppendCustomCommandSideEffects( + std::set<cmGeneratorTarget const*>& sideEffects) const +{ + if (!this->GetPreBuildCommands().empty() || + !this->GetPreLinkCommands().empty() || + !this->GetPostBuildCommands().empty()) { + sideEffects.insert(this); + } else { + for (auto const& source : this->GetAllConfigSources()) { + if (source.Source->GetCustomCommand() != nullptr) { + sideEffects.insert(this); + break; + } + } + } +} + +void cmGeneratorTarget::AppendLanguageSideEffects( + std::map<std::string, std::set<cmGeneratorTarget const*>>& sideEffects) const +{ + static const std::set<cm::string_view> LANGS_WITH_NO_SIDE_EFFECTS = { + "C"_s, "CXX"_s, "OBJC"_s, "OBJCXX"_s, "ASM"_s, "CUDA"_s, + }; + + for (auto const& lang : this->GetAllConfigCompileLanguages()) { + if (!LANGS_WITH_NO_SIDE_EFFECTS.count(lang)) { + sideEffects[lang].insert(this); + } + } +} + bool cmGeneratorTarget::IsInBuildSystem() const { if (this->IsImported()) { |
