diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2023-05-15 18:34:48 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-05-18 12:32:07 (GMT) |
commit | 56f7d6f827290dd7d4d5c6edf0fe12568d4a819e (patch) | |
tree | 800c5235e8aba10d1fbd401c2fabc391f633bc0c /Source/cmCxxModuleMapper.cxx | |
parent | 8207a3a266d85e64532a2a69ccea344fd645fe53 (diff) | |
download | CMake-56f7d6f827290dd7d4d5c6edf0fe12568d4a819e.zip CMake-56f7d6f827290dd7d4d5c6edf0fe12568d4a819e.tar.gz CMake-56f7d6f827290dd7d4d5c6edf0fe12568d4a819e.tar.bz2 |
cmCxxModuleMapper: add a structure to represent BMI locations
This structure allows representing whether a module is private in order
to give a more useful error message when its usage is attempted from
another target.
Diffstat (limited to 'Source/cmCxxModuleMapper.cxx')
-rw-r--r-- | Source/cmCxxModuleMapper.cxx | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/Source/cmCxxModuleMapper.cxx b/Source/cmCxxModuleMapper.cxx index 59bf4c7..e320f54 100644 --- a/Source/cmCxxModuleMapper.cxx +++ b/Source/cmCxxModuleMapper.cxx @@ -17,6 +17,50 @@ #include "cmStringAlgorithms.h" #include "cmSystemTools.h" +CxxBmiLocation::CxxBmiLocation() = default; + +CxxBmiLocation::CxxBmiLocation(std::string path) + : BmiLocation(std::move(path)) +{ +} + +CxxBmiLocation CxxBmiLocation::Unknown() +{ + return {}; +} + +CxxBmiLocation CxxBmiLocation::Private() +{ + return { std::string{} }; +} + +CxxBmiLocation CxxBmiLocation::Known(std::string path) +{ + return { std::move(path) }; +} + +bool CxxBmiLocation::IsKnown() const +{ + return this->BmiLocation.has_value(); +} + +bool CxxBmiLocation::IsPrivate() const +{ + if (auto const& loc = this->BmiLocation) { + return loc->empty(); + } + return false; +} + +std::string const& CxxBmiLocation::Location() const +{ + if (auto const& loc = this->BmiLocation) { + return *loc; + } + static std::string empty; + return empty; +} + cm::optional<std::string> CxxModuleLocations::BmiGeneratorPathForModule( std::string const& logical_name) const { |