mirror of
https://github.com/Kitware/CMake.git
synced 2025-12-31 10:50:16 -06:00
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.
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
@@ -22,6 +22,23 @@ enum class CxxModuleMapFormat
|
||||
Msvc,
|
||||
};
|
||||
|
||||
struct CxxBmiLocation
|
||||
{
|
||||
static CxxBmiLocation Unknown();
|
||||
static CxxBmiLocation Private();
|
||||
static CxxBmiLocation Known(std::string path);
|
||||
|
||||
bool IsKnown() const;
|
||||
bool IsPrivate() const;
|
||||
std::string const& Location() const;
|
||||
|
||||
private:
|
||||
CxxBmiLocation();
|
||||
CxxBmiLocation(std::string path);
|
||||
|
||||
cm::optional<std::string> BmiLocation;
|
||||
};
|
||||
|
||||
struct CxxModuleLocations
|
||||
{
|
||||
// The path from which all relative paths should be computed. If
|
||||
|
||||
Reference in New Issue
Block a user