cmLocalGhsMultiGenerator.cxx 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. std::string cmLocalGhsMultiGenerator::GetTargetDirectory(
  18. cmGeneratorTarget const* target) const
  19. {
  20. std::string dir;
  21. dir += target->GetName();
  22. dir += ".dir";
  23. return dir;
  24. }
  25. void cmLocalGhsMultiGenerator::GenerateTargetsDepthFirst(
  26. cmGeneratorTarget* target, std::vector<cmGeneratorTarget*>& remaining)
  27. {
  28. if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
  29. return;
  30. }
  31. // Find this target in the list of remaining targets.
  32. auto it = std::find(remaining.begin(), remaining.end(), target);
  33. if (it == remaining.end()) {
  34. // This target was already handled.
  35. return;
  36. }
  37. // Remove this target from the list of remaining targets because
  38. // we are handling it now.
  39. *it = nullptr;
  40. cmGhsMultiTargetGenerator tg(target);
  41. tg.Generate();
  42. }
  43. void cmLocalGhsMultiGenerator::Generate()
  44. {
  45. std::vector<cmGeneratorTarget*> remaining = this->GetGeneratorTargets();
  46. for (auto& t : remaining) {
  47. if (t) {
  48. GenerateTargetsDepthFirst(t, remaining);
  49. }
  50. }
  51. }