/src/CMake/Source/cmObjectLocation.h
Line | Count | Source |
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 | | |
5 | | #include "cmConfigure.h" // IWYU pragma: keep |
6 | | |
7 | | #include <map> |
8 | | #include <string> |
9 | | #include <utility> |
10 | | |
11 | | #include <cm/optional> |
12 | | #include <cm/string_view> |
13 | | |
14 | | struct cmObjectLocation |
15 | | { |
16 | | public: |
17 | 0 | cmObjectLocation() = default; |
18 | | cmObjectLocation(std::string path) |
19 | 0 | : Path(std::move(path)) |
20 | 0 | { |
21 | 0 | } |
22 | | |
23 | | void Update(std::string path); |
24 | | |
25 | | // Get the path to the object under the common directory for the target's |
26 | | // objects. |
27 | | std::string const& GetPath() const; |
28 | | // Get the directory of the object file under the common directory. |
29 | | cm::string_view GetDirectory() const; |
30 | | // Get the name of the object file. |
31 | | cm::string_view GetName() const; |
32 | | |
33 | | private: |
34 | | std::string Path; |
35 | | }; |
36 | | |
37 | | struct cmObjectLocations |
38 | | { |
39 | 0 | cmObjectLocations() = default; |
40 | | |
41 | | cm::optional<cmObjectLocation> ShortLoc; |
42 | | cmObjectLocation LongLoc; |
43 | | std::map<std::string, cmObjectLocation> InstallLongLoc; |
44 | | |
45 | | enum class UseShortPath |
46 | | { |
47 | | Yes, |
48 | | No, |
49 | | }; |
50 | | cmObjectLocation const& GetLocation(UseShortPath use) const; |
51 | | std::string const& GetPath(UseShortPath use) const; |
52 | | |
53 | | cmObjectLocation const& GetInstallLocation(UseShortPath use, |
54 | | std::string const& config) const; |
55 | | std::string const& GetInstallPath(UseShortPath use, |
56 | | std::string const& config) const; |
57 | | }; |