diff --git a/Source/cmStatePrivate.h b/Source/cmStatePrivate.h index c693d34168..afcf1fca95 100644 --- a/Source/cmStatePrivate.h +++ b/Source/cmStatePrivate.h @@ -5,6 +5,7 @@ #include "cmConfigure.h" // IWYU pragma: keep +#include #include #include #include @@ -82,6 +83,8 @@ struct cmStateDetail::BuildsystemDirectoryStateType std::vector NormalTargetNames; std::vector ImportedTargetNames; + std::set Projects; + std::string ProjectName; cmPropertyMap Properties; diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx index 3e3fbbbe04..3b35c4adb8 100644 --- a/Source/cmStateSnapshot.cxx +++ b/Source/cmStateSnapshot.cxx @@ -5,10 +5,12 @@ #include #include +#include #include #include #include +#include #include "cmDefinitions.h" #include "cmLinkedTree.h" @@ -413,6 +415,7 @@ cmStateDirectory cmStateSnapshot::GetDirectory() const void cmStateSnapshot::SetProjectName(std::string const& name) { this->Position->BuildSystemDirectory->ProjectName = name; + this->Position->BuildSystemDirectory->Projects.insert(name); } std::string cmStateSnapshot::GetProjectName() const @@ -420,6 +423,11 @@ std::string cmStateSnapshot::GetProjectName() const return this->Position->BuildSystemDirectory->ProjectName; } +bool cmStateSnapshot::CheckProjectName(std::string const& name) const +{ + return cm::contains(this->Position->BuildSystemDirectory->Projects, name); +} + cmPackageState& cmStateSnapshot::GetPackageState( std::string const& packagePath) { diff --git a/Source/cmStateSnapshot.h b/Source/cmStateSnapshot.h index edc7e29399..07071b1239 100644 --- a/Source/cmStateSnapshot.h +++ b/Source/cmStateSnapshot.h @@ -57,6 +57,7 @@ public: void SetProjectName(std::string const& name); std::string GetProjectName() const; + bool CheckProjectName(std::string const& name) const; cmPackageState& GetPackageState(std::string const& packagePath);