cmLocalGhsMultiGenerator.cxx 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #include "cmLocalGhsMultiGenerator.h"
  4. #include "cmGeneratedFileStream.h"
  5. #include "cmGeneratorTarget.h"
  6. #include "cmGhsMultiTargetGenerator.h"
  7. #include "cmGlobalGhsMultiGenerator.h"
  8. #include "cmMakefile.h"
  9. cmLocalGhsMultiGenerator::cmLocalGhsMultiGenerator(cmGlobalGenerator* gg,
  10. cmMakefile* mf)
  11. : cmLocalGenerator(gg, mf)
  12. {
  13. }
  14. cmLocalGhsMultiGenerator::~cmLocalGhsMultiGenerator()
  15. {
  16. }
  17. void cmLocalGhsMultiGenerator::GenerateTargetsDepthFirst(
  18. cmGeneratorTarget* target, std::vector<cmGeneratorTarget*>& remaining)
  19. {
  20. if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
  21. return;
  22. }
  23. // Find this target in the list of remaining targets.
  24. auto it = std::find(remaining.begin(), remaining.end(), target);
  25. if (it == remaining.end()) {
  26. // This target was already handled.
  27. return;
  28. }
  29. // Remove this target from the list of remaining targets because
  30. // we are handling it now.
  31. *it = nullptr;
  32. cmGhsMultiTargetGenerator tg(target);
  33. tg.Generate();
  34. }
  35. void cmLocalGhsMultiGenerator::Generate()
  36. {
  37. std::vector<cmGeneratorTarget*> remaining = this->GetGeneratorTargets();
  38. for (auto& t : remaining) {
  39. if (t) {
  40. GenerateTargetsDepthFirst(t, remaining);
  41. }
  42. }
  43. }