cmObjectLocation.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file LICENSE.rst or https://cmake.org/licensing for details. */
  3. #pragma once
  4. #include "cmConfigure.h" // IWYU pragma: keep
  5. #include <string>
  6. #include <utility>
  7. #include <cm/optional>
  8. #include <cm/string_view>
  9. struct cmObjectLocation
  10. {
  11. public:
  12. cmObjectLocation() = default;
  13. cmObjectLocation(std::string path)
  14. : Path(std::move(path))
  15. {
  16. }
  17. void Update(std::string path);
  18. // Get the path to the object under the common directory for the target's
  19. // objects.
  20. std::string const& GetPath() const;
  21. // Get the directory of the object file under the common directory.
  22. cm::string_view GetDirectory() const;
  23. // Get the name of the object file.
  24. cm::string_view GetName() const;
  25. private:
  26. std::string Path;
  27. };
  28. struct cmObjectLocations
  29. {
  30. cmObjectLocations() = default;
  31. cm::optional<cmObjectLocation> ShortLoc;
  32. cmObjectLocation LongLoc;
  33. enum class UseShortPath
  34. {
  35. Yes,
  36. No,
  37. };
  38. cmObjectLocation const& GetLocation(UseShortPath use) const;
  39. std::string const& GetPath(UseShortPath use) const;
  40. };