From 51f89932c0adccdc28bc3cb6ccf0248a16d897a2 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 18 Oct 2016 21:28:44 +0200 Subject: cmCommandArgumentParserHelper: Remove unused header --- Source/cmCommandArgumentParserHelper.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index 2d66344..3df7689 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -6,7 +6,6 @@ #include "cmCommandArgumentLexer.h" #include "cmMakefile.h" -#include "cmState.h" #include "cmSystemTools.h" #include "cmake.h" -- cgit v0.12 From 163991dd83cac6afa0f6dfeec41d885e8b880fc8 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 18 Oct 2016 21:28:45 +0200 Subject: cmServerProtocol: Remove unused header --- Source/cmServerProtocol.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index e0fcb75..a9a3ce2 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -2,7 +2,6 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmServerProtocol.h" -#include "cmCacheManager.h" #include "cmExternalMakefileProjectGenerator.h" #include "cmFileMonitor.h" #include "cmGeneratorTarget.h" -- cgit v0.12 From 1205f75e3bd9e5ff7051459cac4594ea7c3a9bf9 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 18 Oct 2016 21:28:45 +0200 Subject: cmState: Move nested struct into separate top-level namespace Add a friend declaration to give the struct access to cmState::PositionType. This will be removed when that type is also extracted. --- Source/cmState.cxx | 10 +++++----- Source/cmState.h | 15 +++++++++++---- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 0e73879..86d238a 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -35,7 +35,7 @@ struct cmState::SnapshotDataType cmState::SnapshotType SnapshotType; bool Keep; cmLinkedTree::iterator ExecutionListFile; - cmLinkedTree::iterator + cmLinkedTree::iterator BuildSystemDirectory; cmLinkedTree::iterator Vars; cmLinkedTree::iterator Root; @@ -66,7 +66,7 @@ struct cmState::PolicyStackEntry : public cmPolicies::PolicyMap bool Weak; }; -struct cmState::BuildsystemDirectoryStateType +struct cmStateDetail::BuildsystemDirectoryStateType { cmState::PositionType DirectoryEnd; @@ -313,7 +313,7 @@ cmState::Snapshot cmState::Reset() this->ExecutionListFiles.Truncate(); { - cmLinkedTree::iterator it = + cmLinkedTree::iterator it = this->BuildsystemDirectory.Truncate(); it->IncludeDirectories.clear(); it->IncludeDirectoryBacktraces.clear(); @@ -1119,7 +1119,7 @@ cmPolicies::PolicyStatus cmState::Snapshot::GetPolicy( return status; } - cmLinkedTree::iterator dir = + cmLinkedTree::iterator dir = this->Position->BuildSystemDirectory; while (true) { @@ -1366,7 +1366,7 @@ void cmState::Snapshot::InitializeFromParent_ForSubdirsCommand() } cmState::Directory::Directory( - cmLinkedTree::iterator iter, + cmLinkedTree::iterator iter, const cmState::Snapshot& snapshot) : DirectoryState(iter) , Snapshot_(snapshot) diff --git a/Source/cmState.h b/Source/cmState.h index feed1c7..24db08c 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -23,13 +23,17 @@ class cmCommand; class cmListFileBacktrace; class cmPropertyDefinition; +namespace cmStateDetail { +struct BuildsystemDirectoryStateType; +} + class cmState { struct SnapshotDataType; struct PolicyStackEntry; - struct BuildsystemDirectoryStateType; typedef cmLinkedTree::iterator PositionType; friend class Snapshot; + friend struct cmStateDetail::BuildsystemDirectoryStateType; public: cmState(); @@ -117,7 +121,8 @@ public: class Directory { - Directory(cmLinkedTree::iterator iter, + Directory(cmLinkedTree< + cmStateDetail::BuildsystemDirectoryStateType>::iterator iter, Snapshot const& snapshot); public: @@ -173,7 +178,8 @@ public: void ComputeRelativePathTopBinary(); private: - cmLinkedTree::iterator DirectoryState; + cmLinkedTree::iterator + DirectoryState; Snapshot Snapshot_; friend class Snapshot; }; @@ -329,7 +335,8 @@ private: cmPropertyMap GlobalProperties; cmCacheManager* CacheManager; - cmLinkedTree BuildsystemDirectory; + cmLinkedTree + BuildsystemDirectory; cmLinkedTree ExecutionListFiles; -- cgit v0.12 From cb40af5d6fa65dae9421280c05934eafc8a66165 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 18 Oct 2016 21:28:45 +0200 Subject: cmState: Move SnapshotDataType to separate namespace --- Source/cmState.cxx | 2 +- Source/cmState.h | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 86d238a..c3e061b 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -25,7 +25,7 @@ static std::string const kBUILDSYSTEM_TARGETS = "BUILDSYSTEM_TARGETS"; static std::string const kSOURCE_DIR = "SOURCE_DIR"; static std::string const kSUBDIRECTORIES = "SUBDIRECTORIES"; -struct cmState::SnapshotDataType +struct cmStateDetail::SnapshotDataType { cmState::PositionType ScopeParent; cmState::PositionType DirectoryParent; diff --git a/Source/cmState.h b/Source/cmState.h index 24db08c..d733469 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -25,15 +25,16 @@ class cmPropertyDefinition; namespace cmStateDetail { struct BuildsystemDirectoryStateType; +struct SnapshotDataType; } class cmState { - struct SnapshotDataType; struct PolicyStackEntry; - typedef cmLinkedTree::iterator PositionType; + typedef cmLinkedTree::iterator PositionType; friend class Snapshot; friend struct cmStateDetail::BuildsystemDirectoryStateType; + friend struct cmStateDetail::SnapshotDataType; public: cmState(); @@ -341,7 +342,7 @@ private: cmLinkedTree ExecutionListFiles; cmLinkedTree PolicyStack; - cmLinkedTree SnapshotData; + cmLinkedTree SnapshotData; cmLinkedTree VarTree; std::string SourceDirectory; -- cgit v0.12 From 2dc409964858c96125948082a2c488bd573b8269 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 18 Oct 2016 21:28:45 +0200 Subject: cmState: Move PolicyStackEntry to separate namespace --- Source/cmState.cxx | 19 ++++++++++--------- Source/cmState.h | 4 ++-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Source/cmState.cxx b/Source/cmState.cxx index c3e061b..080700e 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -29,9 +29,9 @@ struct cmStateDetail::SnapshotDataType { cmState::PositionType ScopeParent; cmState::PositionType DirectoryParent; - cmLinkedTree::iterator Policies; - cmLinkedTree::iterator PolicyRoot; - cmLinkedTree::iterator PolicyScope; + cmLinkedTree::iterator Policies; + cmLinkedTree::iterator PolicyRoot; + cmLinkedTree::iterator PolicyScope; cmState::SnapshotType SnapshotType; bool Keep; cmLinkedTree::iterator ExecutionListFile; @@ -45,7 +45,7 @@ struct cmStateDetail::SnapshotDataType std::vector::size_type CompileOptionsPosition; }; -struct cmState::PolicyStackEntry : public cmPolicies::PolicyMap +struct cmStateDetail::PolicyStackEntry : public cmPolicies::PolicyMap { typedef cmPolicies::PolicyMap derived; PolicyStackEntry(bool w = false) @@ -1078,8 +1078,8 @@ cmState::Snapshot cmState::Snapshot::GetCallStackBottom() const void cmState::Snapshot::PushPolicy(cmPolicies::PolicyMap entry, bool weak) { PositionType pos = this->Position; - pos->Policies = this->State->PolicyStack.Push(pos->Policies, - PolicyStackEntry(entry, weak)); + pos->Policies = this->State->PolicyStack.Push( + pos->Policies, cmStateDetail::PolicyStackEntry(entry, weak)); } bool cmState::Snapshot::PopPolicy() @@ -1102,7 +1102,8 @@ void cmState::Snapshot::SetPolicy(cmPolicies::PolicyID id, { // Update the policy stack from the top to the top-most strong entry. bool previous_was_weak = true; - for (cmLinkedTree::iterator psi = this->Position->Policies; + for (cmLinkedTree::iterator psi = + this->Position->Policies; previous_was_weak && psi != this->Position->PolicyRoot; ++psi) { psi->Set(id, status); previous_was_weak = psi->Weak; @@ -1124,9 +1125,9 @@ cmPolicies::PolicyStatus cmState::Snapshot::GetPolicy( while (true) { assert(dir.IsValid()); - cmLinkedTree::iterator leaf = + cmLinkedTree::iterator leaf = dir->DirectoryEnd->Policies; - cmLinkedTree::iterator root = + cmLinkedTree::iterator root = dir->DirectoryEnd->PolicyRoot; for (; leaf != root; ++leaf) { if (leaf->IsDefined(id)) { diff --git a/Source/cmState.h b/Source/cmState.h index d733469..34f9fd0 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -26,11 +26,11 @@ class cmPropertyDefinition; namespace cmStateDetail { struct BuildsystemDirectoryStateType; struct SnapshotDataType; +struct PolicyStackEntry; } class cmState { - struct PolicyStackEntry; typedef cmLinkedTree::iterator PositionType; friend class Snapshot; friend struct cmStateDetail::BuildsystemDirectoryStateType; @@ -341,7 +341,7 @@ private: cmLinkedTree ExecutionListFiles; - cmLinkedTree PolicyStack; + cmLinkedTree PolicyStack; cmLinkedTree SnapshotData; cmLinkedTree VarTree; -- cgit v0.12 From 5bc964eddbee7936f05ab758c7ac417fffbe4a3e Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 18 Oct 2016 21:28:46 +0200 Subject: cmState: Move PositionType to separate namespace Remove friend declarations supporting it being a nested type. --- Source/cmState.cxx | 49 ++++++++++++++++++++++++++----------------------- Source/cmState.h | 9 +++------ 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 080700e..6ba6d26 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -27,8 +27,8 @@ static std::string const kSUBDIRECTORIES = "SUBDIRECTORIES"; struct cmStateDetail::SnapshotDataType { - cmState::PositionType ScopeParent; - cmState::PositionType DirectoryParent; + cmStateDetail::PositionType ScopeParent; + cmStateDetail::PositionType DirectoryParent; cmLinkedTree::iterator Policies; cmLinkedTree::iterator PolicyRoot; cmLinkedTree::iterator PolicyScope; @@ -68,7 +68,7 @@ struct cmStateDetail::PolicyStackEntry : public cmPolicies::PolicyMap struct cmStateDetail::BuildsystemDirectoryStateType { - cmState::PositionType DirectoryEnd; + cmStateDetail::PositionType DirectoryEnd; std::string Location; std::string OutputLocation; @@ -309,7 +309,7 @@ cmState::Snapshot cmState::Reset() this->GlobalProperties.clear(); this->PropertyDefinitions.clear(); - PositionType pos = this->SnapshotData.Truncate(); + cmStateDetail::PositionType pos = this->SnapshotData.Truncate(); this->ExecutionListFiles.Truncate(); { @@ -744,7 +744,8 @@ void cmState::Directory::ComputeRelativePathTopBinary() cmState::Snapshot cmState::CreateBaseSnapshot() { - PositionType pos = this->SnapshotData.Push(this->SnapshotData.Root()); + cmStateDetail::PositionType pos = + this->SnapshotData.Push(this->SnapshotData.Root()); pos->DirectoryParent = this->SnapshotData.Root(); pos->ScopeParent = this->SnapshotData.Root(); pos->SnapshotType = BaseType; @@ -773,7 +774,8 @@ cmState::Snapshot cmState::CreateBuildsystemDirectorySnapshot( Snapshot originSnapshot) { assert(originSnapshot.IsValid()); - PositionType pos = this->SnapshotData.Push(originSnapshot.Position); + cmStateDetail::PositionType pos = + this->SnapshotData.Push(originSnapshot.Position); pos->DirectoryParent = originSnapshot.Position; pos->ScopeParent = originSnapshot.Position; pos->SnapshotType = BuildsystemDirectoryType; @@ -805,7 +807,7 @@ cmState::Snapshot cmState::CreateBuildsystemDirectorySnapshot( cmState::Snapshot cmState::CreateFunctionCallSnapshot( cmState::Snapshot originSnapshot, std::string const& fileName) { - PositionType pos = + cmStateDetail::PositionType pos = this->SnapshotData.Push(originSnapshot.Position, *originSnapshot.Position); pos->ScopeParent = originSnapshot.Position; pos->SnapshotType = FunctionCallType; @@ -824,7 +826,7 @@ cmState::Snapshot cmState::CreateFunctionCallSnapshot( cmState::Snapshot cmState::CreateMacroCallSnapshot( cmState::Snapshot originSnapshot, std::string const& fileName) { - PositionType pos = + cmStateDetail::PositionType pos = this->SnapshotData.Push(originSnapshot.Position, *originSnapshot.Position); pos->SnapshotType = MacroCallType; pos->Keep = false; @@ -839,7 +841,7 @@ cmState::Snapshot cmState::CreateMacroCallSnapshot( cmState::Snapshot cmState::CreateIncludeFileSnapshot( cmState::Snapshot originSnapshot, const std::string& fileName) { - PositionType pos = + cmStateDetail::PositionType pos = this->SnapshotData.Push(originSnapshot.Position, *originSnapshot.Position); pos->SnapshotType = IncludeFileType; pos->Keep = true; @@ -854,7 +856,7 @@ cmState::Snapshot cmState::CreateIncludeFileSnapshot( cmState::Snapshot cmState::CreateVariableScopeSnapshot( cmState::Snapshot originSnapshot) { - PositionType pos = + cmStateDetail::PositionType pos = this->SnapshotData.Push(originSnapshot.Position, *originSnapshot.Position); pos->ScopeParent = originSnapshot.Position; pos->SnapshotType = VariableScopeType; @@ -872,7 +874,7 @@ cmState::Snapshot cmState::CreateVariableScopeSnapshot( cmState::Snapshot cmState::CreateInlineListFileSnapshot( cmState::Snapshot originSnapshot, const std::string& fileName) { - PositionType pos = + cmStateDetail::PositionType pos = this->SnapshotData.Push(originSnapshot.Position, *originSnapshot.Position); pos->SnapshotType = InlineListFileType; pos->Keep = true; @@ -886,7 +888,7 @@ cmState::Snapshot cmState::CreateInlineListFileSnapshot( cmState::Snapshot cmState::CreatePolicyScopeSnapshot( cmState::Snapshot originSnapshot) { - PositionType pos = + cmStateDetail::PositionType pos = this->SnapshotData.Push(originSnapshot.Position, *originSnapshot.Position); pos->SnapshotType = PolicyScopeType; pos->Keep = false; @@ -897,8 +899,8 @@ cmState::Snapshot cmState::CreatePolicyScopeSnapshot( cmState::Snapshot cmState::Pop(cmState::Snapshot originSnapshot) { - PositionType pos = originSnapshot.Position; - PositionType prevPos = pos; + cmStateDetail::PositionType pos = originSnapshot.Position; + cmStateDetail::PositionType prevPos = pos; ++prevPos; prevPos->IncludeDirectoryPosition = prevPos->BuildSystemDirectory->IncludeDirectories.size(); @@ -934,7 +936,8 @@ std::vector cmState::Snapshot::GetChildren() return this->Position->BuildSystemDirectory->Children; } -cmState::Snapshot::Snapshot(cmState* state, PositionType position) +cmState::Snapshot::Snapshot(cmState* state, + cmStateDetail::PositionType position) : State(state) , Position(position) { @@ -1022,7 +1025,7 @@ cmState::Snapshot cmState::Snapshot::GetBuildsystemDirectoryParent() const if (!this->State || this->Position == this->State->SnapshotData.Root()) { return snapshot; } - PositionType parentPos = this->Position->DirectoryParent; + cmStateDetail::PositionType parentPos = this->Position->DirectoryParent; if (parentPos != this->State->SnapshotData.Root()) { snapshot = Snapshot(this->State, parentPos->BuildSystemDirectory->DirectoryEnd); @@ -1037,7 +1040,7 @@ cmState::Snapshot cmState::Snapshot::GetCallStackParent() const assert(this->Position != this->State->SnapshotData.Root()); Snapshot snapshot; - PositionType parentPos = this->Position; + cmStateDetail::PositionType parentPos = this->Position; while (parentPos->SnapshotType == cmState::PolicyScopeType || parentPos->SnapshotType == cmState::VariableScopeType) { ++parentPos; @@ -1066,7 +1069,7 @@ cmState::Snapshot cmState::Snapshot::GetCallStackBottom() const assert(this->State); assert(this->Position != this->State->SnapshotData.Root()); - PositionType pos = this->Position; + cmStateDetail::PositionType pos = this->Position; while (pos->SnapshotType != cmState::BaseType && pos->SnapshotType != cmState::BuildsystemDirectoryType && pos != this->State->SnapshotData.Root()) { @@ -1077,14 +1080,14 @@ cmState::Snapshot cmState::Snapshot::GetCallStackBottom() const void cmState::Snapshot::PushPolicy(cmPolicies::PolicyMap entry, bool weak) { - PositionType pos = this->Position; + cmStateDetail::PositionType pos = this->Position; pos->Policies = this->State->PolicyStack.Push( pos->Policies, cmStateDetail::PolicyStackEntry(entry, weak)); } bool cmState::Snapshot::PopPolicy() { - PositionType pos = this->Position; + cmStateDetail::PositionType pos = this->Position; if (pos->Policies == pos->PolicyScope) { return false; } @@ -1135,8 +1138,8 @@ cmPolicies::PolicyStatus cmState::Snapshot::GetPolicy( return status; } } - cmState::PositionType e = dir->DirectoryEnd; - cmState::PositionType p = e->DirectoryParent; + cmStateDetail::PositionType e = dir->DirectoryEnd; + cmStateDetail::PositionType p = e->DirectoryParent; if (p == this->State->SnapshotData.Root()) { break; } @@ -1305,7 +1308,7 @@ void cmState::Snapshot::SetDirectoryDefinitions() void cmState::Snapshot::InitializeFromParent() { - PositionType parent = this->Position->DirectoryParent; + cmStateDetail::PositionType parent = this->Position->DirectoryParent; assert(this->Position->Vars.IsValid()); assert(parent->Vars.IsValid()); diff --git a/Source/cmState.h b/Source/cmState.h index 34f9fd0..4fcbb00 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -27,14 +27,11 @@ namespace cmStateDetail { struct BuildsystemDirectoryStateType; struct SnapshotDataType; struct PolicyStackEntry; +typedef cmLinkedTree::iterator PositionType; } class cmState { - typedef cmLinkedTree::iterator PositionType; - friend class Snapshot; - friend struct cmStateDetail::BuildsystemDirectoryStateType; - friend struct cmStateDetail::SnapshotDataType; public: cmState(); @@ -58,7 +55,7 @@ public: { public: Snapshot(cmState* state = CM_NULLPTR); - Snapshot(cmState* state, PositionType position); + Snapshot(cmState* state, cmStateDetail::PositionType position); const char* GetDefinition(std::string const& name) const; bool IsInitialized(std::string const& name) const; @@ -117,7 +114,7 @@ public: void InitializeFromParent(); cmState* State; - cmState::PositionType Position; + cmStateDetail::PositionType Position; }; class Directory -- cgit v0.12 From 0060391dffe824526b1f359db79c66c55e53d0c5 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 18 Oct 2016 21:28:46 +0200 Subject: cmState: Move SnapshotType enum to separate namespace --- Source/cmState.cxx | 36 ++++++++++++++++++------------------ Source/cmState.h | 29 ++++++++++++++++------------- 2 files changed, 34 insertions(+), 31 deletions(-) diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 6ba6d26..ca0295a 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -32,7 +32,7 @@ struct cmStateDetail::SnapshotDataType cmLinkedTree::iterator Policies; cmLinkedTree::iterator PolicyRoot; cmLinkedTree::iterator PolicyScope; - cmState::SnapshotType SnapshotType; + cmStateEnums::SnapshotType SnapshotType; bool Keep; cmLinkedTree::iterator ExecutionListFile; cmLinkedTree::iterator @@ -748,7 +748,7 @@ cmState::Snapshot cmState::CreateBaseSnapshot() this->SnapshotData.Push(this->SnapshotData.Root()); pos->DirectoryParent = this->SnapshotData.Root(); pos->ScopeParent = this->SnapshotData.Root(); - pos->SnapshotType = BaseType; + pos->SnapshotType = cmStateEnums::BaseType; pos->Keep = true; pos->BuildSystemDirectory = this->BuildsystemDirectory.Push(this->BuildsystemDirectory.Root()); @@ -778,7 +778,7 @@ cmState::Snapshot cmState::CreateBuildsystemDirectorySnapshot( this->SnapshotData.Push(originSnapshot.Position); pos->DirectoryParent = originSnapshot.Position; pos->ScopeParent = originSnapshot.Position; - pos->SnapshotType = BuildsystemDirectoryType; + pos->SnapshotType = cmStateEnums::BuildsystemDirectoryType; pos->Keep = true; pos->BuildSystemDirectory = this->BuildsystemDirectory.Push( originSnapshot.Position->BuildSystemDirectory); @@ -810,7 +810,7 @@ cmState::Snapshot cmState::CreateFunctionCallSnapshot( cmStateDetail::PositionType pos = this->SnapshotData.Push(originSnapshot.Position, *originSnapshot.Position); pos->ScopeParent = originSnapshot.Position; - pos->SnapshotType = FunctionCallType; + pos->SnapshotType = cmStateEnums::FunctionCallType; pos->Keep = false; pos->ExecutionListFile = this->ExecutionListFiles.Push( originSnapshot.Position->ExecutionListFile, fileName); @@ -828,7 +828,7 @@ cmState::Snapshot cmState::CreateMacroCallSnapshot( { cmStateDetail::PositionType pos = this->SnapshotData.Push(originSnapshot.Position, *originSnapshot.Position); - pos->SnapshotType = MacroCallType; + pos->SnapshotType = cmStateEnums::MacroCallType; pos->Keep = false; pos->ExecutionListFile = this->ExecutionListFiles.Push( originSnapshot.Position->ExecutionListFile, fileName); @@ -843,7 +843,7 @@ cmState::Snapshot cmState::CreateIncludeFileSnapshot( { cmStateDetail::PositionType pos = this->SnapshotData.Push(originSnapshot.Position, *originSnapshot.Position); - pos->SnapshotType = IncludeFileType; + pos->SnapshotType = cmStateEnums::IncludeFileType; pos->Keep = true; pos->ExecutionListFile = this->ExecutionListFiles.Push( originSnapshot.Position->ExecutionListFile, fileName); @@ -859,7 +859,7 @@ cmState::Snapshot cmState::CreateVariableScopeSnapshot( cmStateDetail::PositionType pos = this->SnapshotData.Push(originSnapshot.Position, *originSnapshot.Position); pos->ScopeParent = originSnapshot.Position; - pos->SnapshotType = VariableScopeType; + pos->SnapshotType = cmStateEnums::VariableScopeType; pos->Keep = false; pos->PolicyScope = originSnapshot.Position->Policies; assert(originSnapshot.Position->Vars.IsValid()); @@ -876,7 +876,7 @@ cmState::Snapshot cmState::CreateInlineListFileSnapshot( { cmStateDetail::PositionType pos = this->SnapshotData.Push(originSnapshot.Position, *originSnapshot.Position); - pos->SnapshotType = InlineListFileType; + pos->SnapshotType = cmStateEnums::InlineListFileType; pos->Keep = true; pos->ExecutionListFile = this->ExecutionListFiles.Push( originSnapshot.Position->ExecutionListFile, fileName); @@ -890,7 +890,7 @@ cmState::Snapshot cmState::CreatePolicyScopeSnapshot( { cmStateDetail::PositionType pos = this->SnapshotData.Push(originSnapshot.Position, *originSnapshot.Position); - pos->SnapshotType = PolicyScopeType; + pos->SnapshotType = cmStateEnums::PolicyScopeType; pos->Keep = false; pos->BuildSystemDirectory->DirectoryEnd = pos; pos->PolicyScope = originSnapshot.Position->Policies; @@ -943,7 +943,7 @@ cmState::Snapshot::Snapshot(cmState* state, { } -cmState::SnapshotType cmState::Snapshot::GetType() const +cmStateEnums::SnapshotType cmState::Snapshot::GetType() const { return this->Position->SnapshotType; } @@ -1041,18 +1041,18 @@ cmState::Snapshot cmState::Snapshot::GetCallStackParent() const Snapshot snapshot; cmStateDetail::PositionType parentPos = this->Position; - while (parentPos->SnapshotType == cmState::PolicyScopeType || - parentPos->SnapshotType == cmState::VariableScopeType) { + while (parentPos->SnapshotType == cmStateEnums::PolicyScopeType || + parentPos->SnapshotType == cmStateEnums::VariableScopeType) { ++parentPos; } - if (parentPos->SnapshotType == cmState::BuildsystemDirectoryType || - parentPos->SnapshotType == cmState::BaseType) { + if (parentPos->SnapshotType == cmStateEnums::BuildsystemDirectoryType || + parentPos->SnapshotType == cmStateEnums::BaseType) { return snapshot; } ++parentPos; - while (parentPos->SnapshotType == cmState::PolicyScopeType || - parentPos->SnapshotType == cmState::VariableScopeType) { + while (parentPos->SnapshotType == cmStateEnums::PolicyScopeType || + parentPos->SnapshotType == cmStateEnums::VariableScopeType) { ++parentPos; } @@ -1070,8 +1070,8 @@ cmState::Snapshot cmState::Snapshot::GetCallStackBottom() const assert(this->Position != this->State->SnapshotData.Root()); cmStateDetail::PositionType pos = this->Position; - while (pos->SnapshotType != cmState::BaseType && - pos->SnapshotType != cmState::BuildsystemDirectoryType && + while (pos->SnapshotType != cmStateEnums::BaseType && + pos->SnapshotType != cmStateEnums::BuildsystemDirectoryType && pos != this->State->SnapshotData.Root()) { ++pos; } diff --git a/Source/cmState.h b/Source/cmState.h index 4fcbb00..8f0b5ee 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -30,6 +30,21 @@ struct PolicyStackEntry; typedef cmLinkedTree::iterator PositionType; } +namespace cmStateEnums { + +enum SnapshotType +{ + BaseType, + BuildsystemDirectoryType, + FunctionCallType, + MacroCallType, + IncludeFileType, + InlineListFileType, + PolicyScopeType, + VariableScopeType +}; +} + class cmState { @@ -37,18 +52,6 @@ public: cmState(); ~cmState(); - enum SnapshotType - { - BaseType, - BuildsystemDirectoryType, - FunctionCallType, - MacroCallType, - IncludeFileType, - InlineListFileType, - PolicyScopeType, - VariableScopeType - }; - class Directory; class Snapshot @@ -75,7 +78,7 @@ public: Snapshot GetBuildsystemDirectoryParent() const; Snapshot GetCallStackParent() const; Snapshot GetCallStackBottom() const; - SnapshotType GetType() const; + cmStateEnums::SnapshotType GetType() const; void SetPolicy(cmPolicies::PolicyID id, cmPolicies::PolicyStatus status); cmPolicies::PolicyStatus GetPolicy(cmPolicies::PolicyID id) const; -- cgit v0.12 From a49751fb2eed0ca6415b243c35b23201b8060597 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 18 Oct 2016 21:28:46 +0200 Subject: cmState: Move TargetType enum to separate namespace --- Source/cmAddExecutableCommand.cxx | 6 +- Source/cmAddLibraryCommand.cxx | 63 ++++----- Source/cmCPluginAPI.cxx | 10 +- Source/cmCommonTargetGenerator.cxx | 2 +- Source/cmComputeLinkDepends.cxx | 4 +- Source/cmComputeLinkInformation.cxx | 45 +++--- Source/cmComputeTargetDepends.cxx | 20 +-- Source/cmCoreTryCompile.cxx | 37 ++--- Source/cmCoreTryCompile.h | 2 +- Source/cmCustomCommandGenerator.cxx | 6 +- Source/cmExportBuildAndroidMKGenerator.cxx | 24 ++-- Source/cmExportBuildFileGenerator.cxx | 8 +- Source/cmExportCommand.cxx | 4 +- Source/cmExportFileGenerator.cxx | 18 +-- Source/cmExportInstallAndroidMKGenerator.cxx | 2 +- Source/cmExportInstallFileGenerator.cxx | 6 +- Source/cmExportLibraryDependenciesCommand.cxx | 4 +- Source/cmExportTryCompileFileGenerator.cxx | 2 +- Source/cmExtraCodeBlocksGenerator.cxx | 42 +++--- Source/cmExtraCodeLiteGenerator.cxx | 32 ++--- Source/cmExtraEclipseCDT4Generator.cxx | 30 ++-- Source/cmExtraKateGenerator.cxx | 14 +- Source/cmExtraSublimeTextGenerator.cxx | 14 +- Source/cmGeneratorExpressionNode.cxx | 18 +-- Source/cmGeneratorTarget.cxx | 189 +++++++++++++------------- Source/cmGeneratorTarget.h | 4 +- Source/cmGhsMultiTargetGenerator.cxx | 8 +- Source/cmGlobalGenerator.cxx | 28 ++-- Source/cmGlobalKdevelopGenerator.cxx | 2 +- Source/cmGlobalNinjaGenerator.cxx | 32 +++-- Source/cmGlobalUnixMakefileGenerator3.cxx | 65 +++++---- Source/cmGlobalVisualStudio11Generator.cxx | 5 +- Source/cmGlobalVisualStudio11Generator.h | 2 +- Source/cmGlobalVisualStudio71Generator.cxx | 2 +- Source/cmGlobalVisualStudio71Generator.h | 2 +- Source/cmGlobalVisualStudio7Generator.cxx | 10 +- Source/cmGlobalVisualStudio7Generator.h | 2 +- Source/cmGlobalVisualStudio8Generator.cxx | 10 +- Source/cmGlobalVisualStudio8Generator.h | 4 +- Source/cmGlobalVisualStudioGenerator.cxx | 21 +-- Source/cmGlobalXCodeGenerator.cxx | 132 +++++++++--------- Source/cmGraphVizWriter.cxx | 18 +-- Source/cmGraphVizWriter.h | 2 +- Source/cmIncludeExternalMSProjectCommand.cxx | 4 +- Source/cmInstallCommand.cxx | 26 ++-- Source/cmInstallTargetGenerator.cxx | 44 +++--- Source/cmLinkLineComputer.cxx | 3 +- Source/cmLocalGenerator.cxx | 58 ++++---- Source/cmLocalGhsMultiGenerator.cxx | 2 +- Source/cmLocalNinjaGenerator.cxx | 2 +- Source/cmLocalUnixMakefileGenerator3.cxx | 18 +-- Source/cmLocalVisualStudio10Generator.cxx | 2 +- Source/cmLocalVisualStudio7Generator.cxx | 77 +++++------ Source/cmLocalVisualStudioGenerator.cxx | 4 +- Source/cmMakefile.cxx | 47 ++++--- Source/cmMakefile.h | 8 +- Source/cmMakefileLibraryTargetGenerator.cxx | 34 ++--- Source/cmMakefileTargetGenerator.cxx | 24 ++-- Source/cmNinjaNormalTargetGenerator.cxx | 44 +++--- Source/cmNinjaTargetGenerator.cxx | 28 ++-- Source/cmNinjaUtilityTargetGenerator.cxx | 2 +- Source/cmServerProtocol.cxx | 2 +- Source/cmState.cxx | 20 +-- Source/cmState.h | 28 ++-- Source/cmTarget.cxx | 91 +++++++------ Source/cmTarget.h | 8 +- Source/cmTargetLinkLibrariesCommand.cxx | 16 +-- Source/cmTargetPropCommandBase.cxx | 14 +- Source/cmTargetPropertyComputer.cxx | 6 +- Source/cmTargetPropertyComputer.h | 12 +- Source/cmTestGenerator.cxx | 2 +- Source/cmVisualStudio10TargetGenerator.cxx | 106 ++++++++------- 72 files changed, 855 insertions(+), 828 deletions(-) diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx index 96ad82a..a03d77d 100644 --- a/Source/cmAddExecutableCommand.cxx +++ b/Source/cmAddExecutableCommand.cxx @@ -133,8 +133,8 @@ bool cmAddExecutableCommand::InitialPass(std::vector const& args, this->SetError(e.str()); return false; } - cmState::TargetType type = aliasedTarget->GetType(); - if (type != cmState::EXECUTABLE) { + cmStateEnums::TargetType type = aliasedTarget->GetType(); + if (type != cmStateEnums::EXECUTABLE) { std::ostringstream e; e << "cannot create ALIAS target \"" << exename << "\" because target \"" << aliasedName << "\" is not an " @@ -165,7 +165,7 @@ bool cmAddExecutableCommand::InitialPass(std::vector const& args, } // Create the imported target. - this->Makefile->AddImportedTarget(exename, cmState::EXECUTABLE, + this->Makefile->AddImportedTarget(exename, cmStateEnums::EXECUTABLE, importGlobal); return true; } diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx index 26e38b8..d1281d4 100644 --- a/Source/cmAddLibraryCommand.cxx +++ b/Source/cmAddLibraryCommand.cxx @@ -15,10 +15,10 @@ bool cmAddLibraryCommand::InitialPass(std::vector const& args, } // Library type defaults to value of BUILD_SHARED_LIBS, if it exists, // otherwise it defaults to static library. - cmState::TargetType type = cmState::SHARED_LIBRARY; + cmStateEnums::TargetType type = cmStateEnums::SHARED_LIBRARY; if (cmSystemTools::IsOff( this->Makefile->GetDefinition("BUILD_SHARED_LIBS"))) { - type = cmState::STATIC_LIBRARY; + type = cmStateEnums::STATIC_LIBRARY; } bool excludeFromAll = false; bool importTarget = false; @@ -38,57 +38,57 @@ bool cmAddLibraryCommand::InitialPass(std::vector const& args, while (s != args.end()) { std::string libType = *s; if (libType == "STATIC") { - if (type == cmState::INTERFACE_LIBRARY) { + if (type == cmStateEnums::INTERFACE_LIBRARY) { std::ostringstream e; e << "INTERFACE library specified with conflicting STATIC type."; this->SetError(e.str()); return false; } ++s; - type = cmState::STATIC_LIBRARY; + type = cmStateEnums::STATIC_LIBRARY; haveSpecifiedType = true; } else if (libType == "SHARED") { - if (type == cmState::INTERFACE_LIBRARY) { + if (type == cmStateEnums::INTERFACE_LIBRARY) { std::ostringstream e; e << "INTERFACE library specified with conflicting SHARED type."; this->SetError(e.str()); return false; } ++s; - type = cmState::SHARED_LIBRARY; + type = cmStateEnums::SHARED_LIBRARY; haveSpecifiedType = true; } else if (libType == "MODULE") { - if (type == cmState::INTERFACE_LIBRARY) { + if (type == cmStateEnums::INTERFACE_LIBRARY) { std::ostringstream e; e << "INTERFACE library specified with conflicting MODULE type."; this->SetError(e.str()); return false; } ++s; - type = cmState::MODULE_LIBRARY; + type = cmStateEnums::MODULE_LIBRARY; haveSpecifiedType = true; } else if (libType == "OBJECT") { - if (type == cmState::INTERFACE_LIBRARY) { + if (type == cmStateEnums::INTERFACE_LIBRARY) { std::ostringstream e; e << "INTERFACE library specified with conflicting OBJECT type."; this->SetError(e.str()); return false; } ++s; - type = cmState::OBJECT_LIBRARY; + type = cmStateEnums::OBJECT_LIBRARY; haveSpecifiedType = true; } else if (libType == "UNKNOWN") { - if (type == cmState::INTERFACE_LIBRARY) { + if (type == cmStateEnums::INTERFACE_LIBRARY) { std::ostringstream e; e << "INTERFACE library specified with conflicting UNKNOWN type."; this->SetError(e.str()); return false; } ++s; - type = cmState::UNKNOWN_LIBRARY; + type = cmStateEnums::UNKNOWN_LIBRARY; haveSpecifiedType = true; } else if (libType == "ALIAS") { - if (type == cmState::INTERFACE_LIBRARY) { + if (type == cmStateEnums::INTERFACE_LIBRARY) { std::ostringstream e; e << "INTERFACE library specified with conflicting ALIAS type."; this->SetError(e.str()); @@ -116,10 +116,10 @@ bool cmAddLibraryCommand::InitialPass(std::vector const& args, return false; } ++s; - type = cmState::INTERFACE_LIBRARY; + type = cmStateEnums::INTERFACE_LIBRARY; haveSpecifiedType = true; } else if (*s == "EXCLUDE_FROM_ALL") { - if (type == cmState::INTERFACE_LIBRARY) { + if (type == cmStateEnums::INTERFACE_LIBRARY) { std::ostringstream e; e << "INTERFACE library may not be used with EXCLUDE_FROM_ALL."; this->SetError(e.str()); @@ -133,7 +133,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector const& args, } else if (importTarget && *s == "GLOBAL") { ++s; importGlobal = true; - } else if (type == cmState::INTERFACE_LIBRARY && *s == "GLOBAL") { + } else if (type == cmStateEnums::INTERFACE_LIBRARY && *s == "GLOBAL") { std::ostringstream e; e << "GLOBAL option may only be used with IMPORTED libraries."; this->SetError(e.str()); @@ -143,7 +143,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector const& args, } } - if (type == cmState::INTERFACE_LIBRARY) { + if (type == cmStateEnums::INTERFACE_LIBRARY) { if (s != args.end()) { std::ostringstream e; e << "INTERFACE library requires no source arguments."; @@ -170,7 +170,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector const& args, bool issueMessage = false; switch (this->Makefile->GetPolicyStatus(cmPolicies::CMP0037)) { case cmPolicies::WARN: - if (type != cmState::INTERFACE_LIBRARY) { + if (type != cmStateEnums::INTERFACE_LIBRARY) { e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0037) << "\n"; issueMessage = true; } @@ -233,12 +233,12 @@ bool cmAddLibraryCommand::InitialPass(std::vector const& args, this->SetError(e.str()); return false; } - cmState::TargetType aliasedType = aliasedTarget->GetType(); - if (aliasedType != cmState::SHARED_LIBRARY && - aliasedType != cmState::STATIC_LIBRARY && - aliasedType != cmState::MODULE_LIBRARY && - aliasedType != cmState::OBJECT_LIBRARY && - aliasedType != cmState::INTERFACE_LIBRARY) { + cmStateEnums::TargetType aliasedType = aliasedTarget->GetType(); + if (aliasedType != cmStateEnums::SHARED_LIBRARY && + aliasedType != cmStateEnums::STATIC_LIBRARY && + aliasedType != cmStateEnums::MODULE_LIBRARY && + aliasedType != cmStateEnums::OBJECT_LIBRARY && + aliasedType != cmStateEnums::INTERFACE_LIBRARY) { std::ostringstream e; e << "cannot create ALIAS target \"" << libName << "\" because target \"" << aliasedName << "\" is not a library."; @@ -265,16 +265,17 @@ bool cmAddLibraryCommand::InitialPass(std::vector const& args, CMAKE_${LANG}_CREATE_SHARED_LIBRARY is defined and if not default to STATIC. But at this point we know only the name of the target, but not yet its linker language. */ - if ((type == cmState::SHARED_LIBRARY || type == cmState::MODULE_LIBRARY) && + if ((type == cmStateEnums::SHARED_LIBRARY || + type == cmStateEnums::MODULE_LIBRARY) && (this->Makefile->GetState()->GetGlobalPropertyAsBool( "TARGET_SUPPORTS_SHARED_LIBS") == false)) { std::ostringstream w; w << "ADD_LIBRARY called with " - << (type == cmState::SHARED_LIBRARY ? "SHARED" : "MODULE") + << (type == cmStateEnums::SHARED_LIBRARY ? "SHARED" : "MODULE") << " option but the target platform does not support dynamic linking. " "Building a STATIC library instead. This may lead to problems."; this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); - type = cmState::STATIC_LIBRARY; + type = cmStateEnums::STATIC_LIBRARY; } // Handle imported target creation. @@ -284,13 +285,13 @@ bool cmAddLibraryCommand::InitialPass(std::vector const& args, this->SetError("called with IMPORTED argument but no library type."); return false; } - if (type == cmState::OBJECT_LIBRARY) { + if (type == cmStateEnums::OBJECT_LIBRARY) { this->Makefile->IssueMessage( cmake::FATAL_ERROR, "The OBJECT library type may not be used for IMPORTED libraries."); return true; } - if (type == cmState::INTERFACE_LIBRARY) { + if (type == cmStateEnums::INTERFACE_LIBRARY) { if (!cmGeneratorExpression::IsValidTargetName(libName)) { std::ostringstream e; e << "Invalid name for IMPORTED INTERFACE library target: " << libName; @@ -314,7 +315,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector const& args, } // A non-imported target may not have UNKNOWN type. - if (type == cmState::UNKNOWN_LIBRARY) { + if (type == cmStateEnums::UNKNOWN_LIBRARY) { this->Makefile->IssueMessage( cmake::FATAL_ERROR, "The UNKNOWN library type may be used only for IMPORTED libraries."); @@ -332,7 +333,7 @@ bool cmAddLibraryCommand::InitialPass(std::vector const& args, std::vector srclists; - if (type == cmState::INTERFACE_LIBRARY) { + if (type == cmStateEnums::INTERFACE_LIBRARY) { if (!cmGeneratorExpression::IsValidTargetName(libName) || libName.find("::") != std::string::npos) { std::ostringstream e; diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 56a469d..98e18ed 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -350,9 +350,9 @@ static void addLinkLibrary(cmMakefile* mf, std::string const& target, } cmTarget* tgt = mf->GetGlobalGenerator()->FindTarget(lib); - if (tgt && (tgt->GetType() != cmState::STATIC_LIBRARY) && - (tgt->GetType() != cmState::SHARED_LIBRARY) && - (tgt->GetType() != cmState::INTERFACE_LIBRARY) && + if (tgt && (tgt->GetType() != cmStateEnums::STATIC_LIBRARY) && + (tgt->GetType() != cmStateEnums::SHARED_LIBRARY) && + (tgt->GetType() != cmStateEnums::INTERFACE_LIBRARY) && !tgt->IsExecutableWithExports()) { std::ostringstream e; e << "Target \"" << lib << "\" of type " @@ -393,8 +393,8 @@ void CCONV cmAddLibrary(void* arg, const char* libname, int shared, for (i = 0; i < numSrcs; ++i) { srcs2.push_back(srcs[i]); } - mf->AddLibrary(libname, - (shared ? cmState::SHARED_LIBRARY : cmState::STATIC_LIBRARY), + mf->AddLibrary(libname, (shared ? cmStateEnums::SHARED_LIBRARY + : cmStateEnums::STATIC_LIBRARY), srcs2); } diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index b995fa1..72556b8 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -171,7 +171,7 @@ std::vector cmCommonTargetGenerator::GetLinkedTargetDirectories() // We can ignore the INTERFACE_LIBRARY items because // Target->GetLinkInformation already processed their // link interface and they don't have any output themselves. - && linkee->GetType() != cmState::INTERFACE_LIBRARY && + && linkee->GetType() != cmStateEnums::INTERFACE_LIBRARY && emitted.insert(linkee).second) { cmLocalGenerator* lg = linkee->GetLocalGenerator(); std::string di = lg->GetCurrentBinaryDirectory(); diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 93f3289..804d900 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -262,7 +262,7 @@ cmComputeLinkDepends::Compute() LinkEntry const& e = this->EntryList[i]; cmGeneratorTarget const* t = e.Target; // Entries that we know the linker will re-use do not need to be repeated. - bool uniquify = t && t->GetType() == cmState::SHARED_LIBRARY; + bool uniquify = t && t->GetType() == cmStateEnums::SHARED_LIBRARY; if (!uniquify || emmitted.insert(i).second) { this->FinalLinkEntries.push_back(e); } @@ -345,7 +345,7 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry const& qe) if (cmLinkInterface const* iface = entry.Target->GetLinkInterface(this->Config, this->Target)) { const bool isIface = - entry.Target->GetType() == cmState::INTERFACE_LIBRARY; + entry.Target->GetType() == cmStateEnums::INTERFACE_LIBRARY; // This target provides its own link interface information. this->AddLinkEntries(depender_index, iface->Libraries); diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 0807ef8..565eb15 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -282,7 +282,7 @@ cmComputeLinkInformation::cmComputeLinkInformation( // the program that will load it. this->LoaderFlag = CM_NULLPTR; if (!this->UseImportLibrary && - this->Target->GetType() == cmState::MODULE_LIBRARY) { + this->Target->GetType() == cmStateEnums::MODULE_LIBRARY) { std::string loader_flag_var = "CMAKE_SHARED_MODULE_LOADER_"; loader_flag_var += this->LinkLanguage; loader_flag_var += "_FLAG"; @@ -299,10 +299,10 @@ cmComputeLinkInformation::cmComputeLinkInformation( // Get options needed to specify RPATHs. this->RuntimeUseChrpath = false; - if (this->Target->GetType() != cmState::STATIC_LIBRARY) { - const char* tType = - ((this->Target->GetType() == cmState::EXECUTABLE) ? "EXECUTABLE" - : "SHARED_LIBRARY"); + if (this->Target->GetType() != cmStateEnums::STATIC_LIBRARY) { + const char* tType = ((this->Target->GetType() == cmStateEnums::EXECUTABLE) + ? "EXECUTABLE" + : "SHARED_LIBRARY"); std::string rtVar = "CMAKE_"; rtVar += tType; rtVar += "_RUNTIME_"; @@ -446,10 +446,10 @@ cmComputeLinkInformation::GetSharedLibrariesLinked() bool cmComputeLinkInformation::Compute() { // Skip targets that do not link. - if (!(this->Target->GetType() == cmState::EXECUTABLE || - this->Target->GetType() == cmState::SHARED_LIBRARY || - this->Target->GetType() == cmState::MODULE_LIBRARY || - this->Target->GetType() == cmState::STATIC_LIBRARY)) { + if (!(this->Target->GetType() == cmStateEnums::EXECUTABLE || + this->Target->GetType() == cmStateEnums::SHARED_LIBRARY || + this->Target->GetType() == cmStateEnums::MODULE_LIBRARY || + this->Target->GetType() == cmStateEnums::STATIC_LIBRARY)) { return false; } @@ -498,7 +498,7 @@ bool cmComputeLinkInformation::Compute() i != wrongItems.end(); ++i) { cmGeneratorTarget const* tgt = *i; bool implib = (this->UseImportLibrary && - (tgt->GetType() == cmState::SHARED_LIBRARY)); + (tgt->GetType() == cmStateEnums::SHARED_LIBRARY)); std::string lib = tgt->GetFullPath(this->Config, implib, true); this->OldLinkDirItems.push_back(lib); } @@ -600,20 +600,21 @@ void cmComputeLinkInformation::AddItem(std::string const& item, linkItem += exe; this->Items.push_back(Item(linkItem, true, tgt)); this->Depends.push_back(exe); - } else if (tgt->GetType() == cmState::INTERFACE_LIBRARY) { + } else if (tgt->GetType() == cmStateEnums::INTERFACE_LIBRARY) { // Add the interface library as an item so it can be considered as part // of COMPATIBLE_INTERFACE_ enforcement. The generators will ignore // this for the actual link line. this->Items.push_back(Item(std::string(), false, tgt)); } else { // Decide whether to use an import library. - bool implib = (this->UseImportLibrary && - (impexe || tgt->GetType() == cmState::SHARED_LIBRARY)); + bool implib = + (this->UseImportLibrary && + (impexe || tgt->GetType() == cmStateEnums::SHARED_LIBRARY)); // Pass the full path to the target file. std::string lib = tgt->GetFullPath(config, implib, true); if (!this->LinkDependsNoShared || - tgt->GetType() != cmState::SHARED_LIBRARY) { + tgt->GetType() != cmStateEnums::SHARED_LIBRARY) { this->Depends.push_back(lib); } @@ -652,7 +653,7 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item, if (tgt) { // The target will provide a full path. Make sure it is a shared // library. - if (tgt->GetType() != cmState::SHARED_LIBRARY) { + if (tgt->GetType() != cmStateEnums::SHARED_LIBRARY) { return; } } else { @@ -725,13 +726,13 @@ void cmComputeLinkInformation::ComputeLinkTypeInfo() const char* shared_link_type_flag = CM_NULLPTR; const char* target_type_str = CM_NULLPTR; switch (this->Target->GetType()) { - case cmState::EXECUTABLE: + case cmStateEnums::EXECUTABLE: target_type_str = "EXE"; break; - case cmState::SHARED_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: target_type_str = "SHARED_LIBRARY"; break; - case cmState::MODULE_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: target_type_str = "SHARED_MODULE"; break; default: @@ -964,12 +965,12 @@ void cmComputeLinkInformation::AddTargetItem(std::string const& item, // shared and static libraries but static-mode can handle only // static libraries. If a previous user item changed the link type // to static we need to make sure it is back to shared. - if (target->GetType() != cmState::STATIC_LIBRARY) { + if (target->GetType() != cmStateEnums::STATIC_LIBRARY) { this->SetCurrentLinkType(LinkShared); } // Keep track of shared library targets linked. - if (target->GetType() == cmState::SHARED_LIBRARY) { + if (target->GetType() == cmStateEnums::SHARED_LIBRARY) { this->SharedLibrariesLinked.insert(target); } @@ -1590,13 +1591,13 @@ void cmComputeLinkInformation::AddLibraryRuntimeInfo( // Libraries with unknown type must be handled using just the file // on disk. - if (target->GetType() == cmState::UNKNOWN_LIBRARY) { + if (target->GetType() == cmStateEnums::UNKNOWN_LIBRARY) { this->AddLibraryRuntimeInfo(fullPath); return; } // Skip targets that are not shared libraries (modules cannot be linked). - if (target->GetType() != cmState::SHARED_LIBRARY) { + if (target->GetType() != cmStateEnums::SHARED_LIBRARY) { return; } diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 735bc32..4cc4edf 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -187,7 +187,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) { // Get the depender. cmGeneratorTarget const* depender = this->Targets[depender_index]; - if (depender->GetType() == cmState::INTERFACE_LIBRARY) { + if (depender->GetType() == cmStateEnums::INTERFACE_LIBRARY) { return; } @@ -212,10 +212,10 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) oi != objectFiles.end(); ++oi) { std::string objLib = (*oi)->GetObjectLibrary(); if (!objLib.empty() && emitted.insert(objLib).second) { - if (depender->GetType() != cmState::EXECUTABLE && - depender->GetType() != cmState::STATIC_LIBRARY && - depender->GetType() != cmState::SHARED_LIBRARY && - depender->GetType() != cmState::MODULE_LIBRARY) { + if (depender->GetType() != cmStateEnums::EXECUTABLE && + depender->GetType() != cmStateEnums::STATIC_LIBRARY && + depender->GetType() != cmStateEnums::SHARED_LIBRARY && + depender->GetType() != cmStateEnums::MODULE_LIBRARY) { this->GlobalGenerator->GetCMakeInstance()->IssueMessage( cmake::FATAL_ERROR, "Only executables and non-OBJECT libraries may " @@ -287,7 +287,7 @@ void cmComputeTargetDepends::AddInterfaceDepends( // Skip targets that will not really be linked. This is probably a // name conflict between an external library and an executable // within the project. - if (dependee && dependee->GetType() == cmState::EXECUTABLE && + if (dependee && dependee->GetType() == cmStateEnums::EXECUTABLE && !dependee->IsExecutableWithExports()) { dependee = CM_NULLPTR; } @@ -316,7 +316,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, cmGeneratorTarget const* dependee = dependee_name.Target; if (!dependee && !linking && - (depender->GetType() != cmState::GLOBAL_TARGET)) { + (depender->GetType() != cmStateEnums::GLOBAL_TARGET)) { cmake::MessageType messageType = cmake::AUTHOR_WARNING; bool issueMessage = false; std::ostringstream e; @@ -351,7 +351,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, // Skip targets that will not really be linked. This is probably a // name conflict between an external library and an executable // within the project. - if (linking && dependee && dependee->GetType() == cmState::EXECUTABLE && + if (linking && dependee && dependee->GetType() == cmStateEnums::EXECUTABLE && !dependee->IsExecutableWithExports()) { dependee = CM_NULLPTR; } @@ -366,7 +366,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, bool linking) { if (dependee->IsImported() || - dependee->GetType() == cmState::INTERFACE_LIBRARY) { + dependee->GetType() == cmStateEnums::INTERFACE_LIBRARY) { // Skip IMPORTED and INTERFACE targets but follow their utility // dependencies. std::set const& utils = dependee->GetUtilityItems(); @@ -452,7 +452,7 @@ bool cmComputeTargetDepends::CheckComponents( // Make sure the component is all STATIC_LIBRARY targets. for (NodeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni) { - if (this->Targets[*ni]->GetType() != cmState::STATIC_LIBRARY) { + if (this->Targets[*ni]->GetType() != cmStateEnums::STATIC_LIBRARY) { this->ComplainAboutBadComponent(ccg, c); return false; } diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index a409d40..cafba86 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -43,24 +43,25 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, // which signature were we called with ? this->SrcFileSignature = true; - cmState::TargetType targetType = cmState::EXECUTABLE; + cmStateEnums::TargetType targetType = cmStateEnums::EXECUTABLE; const char* tt = this->Makefile->GetDefinition("CMAKE_TRY_COMPILE_TARGET_TYPE"); if (!isTryRun && tt && *tt) { - if (strcmp(tt, cmState::GetTargetTypeName(cmState::EXECUTABLE)) == 0) { - targetType = cmState::EXECUTABLE; + if (strcmp(tt, cmState::GetTargetTypeName(cmStateEnums::EXECUTABLE)) == + 0) { + targetType = cmStateEnums::EXECUTABLE; } else if (strcmp(tt, cmState::GetTargetTypeName( - cmState::STATIC_LIBRARY)) == 0) { - targetType = cmState::STATIC_LIBRARY; + cmStateEnums::STATIC_LIBRARY)) == 0) { + targetType = cmStateEnums::STATIC_LIBRARY; } else { this->Makefile->IssueMessage( cmake::FATAL_ERROR, std::string("Invalid value '") + tt + "' for " "CMAKE_TRY_COMPILE_TARGET_TYPE. Only " "'" + - cmState::GetTargetTypeName(cmState::EXECUTABLE) + "' and " - "'" + - cmState::GetTargetTypeName(cmState::STATIC_LIBRARY) + + cmState::GetTargetTypeName(cmStateEnums::EXECUTABLE) + "' and " + "'" + + cmState::GetTargetTypeName(cmStateEnums::STATIC_LIBRARY) + "' " "are allowed."); return -1; @@ -122,12 +123,12 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, libsToLink += "\"" + cmSystemTools::TrimWhitespace(argv[i]) + "\" "; if (cmTarget* tgt = this->Makefile->FindTargetToUse(argv[i])) { switch (tgt->GetType()) { - case cmState::SHARED_LIBRARY: - case cmState::STATIC_LIBRARY: - case cmState::INTERFACE_LIBRARY: - case cmState::UNKNOWN_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: + case cmStateEnums::STATIC_LIBRARY: + case cmStateEnums::INTERFACE_LIBRARY: + case cmStateEnums::UNKNOWN_LIBRARY: break; - case cmState::EXECUTABLE: + case cmStateEnums::EXECUTABLE: if (tgt->IsExecutableWithExports()) { break; } @@ -481,13 +482,13 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, ? "NEW" : "OLD"); - if (targetType == cmState::EXECUTABLE) { + if (targetType == cmStateEnums::EXECUTABLE) { /* Put the executable at a known location (for COPY_FILE). */ fprintf(fout, "set(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"%s\")\n", this->BinaryDirectory.c_str()); /* Create the actual executable. */ fprintf(fout, "add_executable(%s", targetName.c_str()); - } else // if (targetType == cmState::STATIC_LIBRARY) + } else // if (targetType == cmStateEnums::STATIC_LIBRARY) { /* Put the static library at a known location (for COPY_FILE). */ fprintf(fout, "set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY \"%s\")\n", @@ -627,16 +628,16 @@ void cmCoreTryCompile::CleanupFiles(const char* binDir) } void cmCoreTryCompile::FindOutputFile(const std::string& targetName, - cmState::TargetType targetType) + cmStateEnums::TargetType targetType) { this->FindErrorMessage = ""; this->OutputFile = ""; std::string tmpOutputFile = "/"; - if (targetType == cmState::EXECUTABLE) { + if (targetType == cmStateEnums::EXECUTABLE) { tmpOutputFile += targetName; tmpOutputFile += this->Makefile->GetSafeDefinition("CMAKE_EXECUTABLE_SUFFIX"); - } else // if (targetType == cmState::STATIC_LIBRARY) + } else // if (targetType == cmStateEnums::STATIC_LIBRARY) { tmpOutputFile += this->Makefile->GetSafeDefinition("CMAKE_STATIC_LIBRARY_PREFIX"); diff --git a/Source/cmCoreTryCompile.h b/Source/cmCoreTryCompile.h index e173a16..43b971f 100644 --- a/Source/cmCoreTryCompile.h +++ b/Source/cmCoreTryCompile.h @@ -35,7 +35,7 @@ protected: the error message is stored in FindErrorMessage. */ void FindOutputFile(const std::string& targetName, - cmState::TargetType targetType); + cmStateEnums::TargetType targetType); cmTypeMacro(cmCoreTryCompile, cmCommand); diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index 0fd4ffb..5cb1104 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -42,7 +42,7 @@ bool cmCustomCommandGenerator::UseCrossCompilingEmulator(unsigned int c) const { std::string const& argv0 = this->CC.GetCommandLines()[c][0]; cmGeneratorTarget* target = this->LG->FindGeneratorTargetToUse(argv0); - if (target && target->GetType() == cmState::EXECUTABLE) { + if (target && target->GetType() == cmStateEnums::EXECUTABLE) { return target->GetProperty("CROSSCOMPILING_EMULATOR") != CM_NULLPTR; } return false; @@ -52,12 +52,12 @@ std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const { std::string const& argv0 = this->CC.GetCommandLines()[c][0]; cmGeneratorTarget* target = this->LG->FindGeneratorTargetToUse(argv0); - if (target && target->GetType() == cmState::EXECUTABLE && + if (target && target->GetType() == cmStateEnums::EXECUTABLE && (target->IsImported() || !this->LG->GetMakefile()->IsOn("CMAKE_CROSSCOMPILING"))) { return target->GetLocation(this->Config); } - if (target && target->GetType() == cmState::EXECUTABLE) { + if (target && target->GetType() == cmStateEnums::EXECUTABLE) { const char* emulator = target->GetProperty("CROSSCOMPILING_EMULATOR"); if (emulator) { return std::string(emulator); diff --git a/Source/cmExportBuildAndroidMKGenerator.cxx b/Source/cmExportBuildAndroidMKGenerator.cxx index f5e6628..38f95d2 100644 --- a/Source/cmExportBuildAndroidMKGenerator.cxx +++ b/Source/cmExportBuildAndroidMKGenerator.cxx @@ -111,8 +111,8 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties( target->GetLocalGenerator()->FindGeneratorTargetToUse(*i); if (gt) { - if (gt->GetType() == cmState::SHARED_LIBRARY || - gt->GetType() == cmState::MODULE_LIBRARY) { + if (gt->GetType() == cmStateEnums::SHARED_LIBRARY || + gt->GetType() == cmStateEnums::MODULE_LIBRARY) { sharedLibs += " " + *i; } else { staticLibs += " " + *i; @@ -168,7 +168,7 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties( } // Tell the NDK build system if prebuilt static libraries use C++. - if (target->GetType() == cmState::STATIC_LIBRARY) { + if (target->GetType() == cmStateEnums::STATIC_LIBRARY) { cmLinkImplementation const* li = target->GetLinkImplementation(config); if (std::find(li->Languages.begin(), li->Languages.end(), "CXX") != li->Languages.end()) { @@ -177,19 +177,19 @@ void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties( } switch (target->GetType()) { - case cmState::SHARED_LIBRARY: - case cmState::MODULE_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: os << "include $(PREBUILT_SHARED_LIBRARY)\n"; break; - case cmState::STATIC_LIBRARY: + case cmStateEnums::STATIC_LIBRARY: os << "include $(PREBUILT_STATIC_LIBRARY)\n"; break; - case cmState::EXECUTABLE: - case cmState::UTILITY: - case cmState::OBJECT_LIBRARY: - case cmState::GLOBAL_TARGET: - case cmState::INTERFACE_LIBRARY: - case cmState::UNKNOWN_LIBRARY: + case cmStateEnums::EXECUTABLE: + case cmStateEnums::UTILITY: + case cmStateEnums::OBJECT_LIBRARY: + case cmStateEnums::GLOBAL_TARGET: + case cmStateEnums::INTERFACE_LIBRARY: + case cmStateEnums::UNKNOWN_LIBRARY: break; } os << "\n"; diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index 68831c7..e5f7a55 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -57,7 +57,7 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) this->LG->GetMakefile()->GetBacktrace()); return false; } - if (te->GetType() == cmState::INTERFACE_LIBRARY) { + if (te->GetType() == cmStateEnums::INTERFACE_LIBRARY) { this->GenerateRequiredCMakeVersion(os, "3.0.0"); } } @@ -134,12 +134,12 @@ void cmExportBuildFileGenerator::GenerateImportTargetsConfig( cmGeneratorTarget* target = *tei; ImportPropertyMap properties; - if (target->GetType() != cmState::INTERFACE_LIBRARY) { + if (target->GetType() != cmStateEnums::INTERFACE_LIBRARY) { this->SetImportLocationProperty(config, suffix, target, properties); } if (!properties.empty()) { // Get the rest of the target details. - if (target->GetType() != cmState::INTERFACE_LIBRARY) { + if (target->GetType() != cmStateEnums::INTERFACE_LIBRARY) { this->SetImportDetailProperties(config, suffix, target, properties, missingTargets); this->SetImportLinkInterface(config, suffix, @@ -186,7 +186,7 @@ void cmExportBuildFileGenerator::SetImportLocationProperty( // Add the import library for windows DLLs. if (target->IsDLLPlatform() && - (target->GetType() == cmState::SHARED_LIBRARY || + (target->GetType() == cmStateEnums::SHARED_LIBRARY || target->IsExecutableWithExports()) && mf->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX")) { std::string prop = "IMPORTED_IMPLIB"; diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index d438363..4fb5998 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -141,14 +141,14 @@ bool cmExportCommand::InitialPass(std::vector const& args, } if (cmTarget* target = gg->FindTarget(*currentTarget)) { - if (target->GetType() == cmState::OBJECT_LIBRARY) { + if (target->GetType() == cmStateEnums::OBJECT_LIBRARY) { std::ostringstream e; e << "given OBJECT library \"" << *currentTarget << "\" which may not be exported."; this->SetError(e.str()); return false; } - if (target->GetType() == cmState::UTILITY) { + if (target->GetType() == cmStateEnums::UTILITY) { this->SetError("given custom target \"" + *currentTarget + "\" which may not be exported."); return false; diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index d3a99fa..3cd72a8 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -492,7 +492,7 @@ void cmExportFileGenerator::PopulateCompatibleInterfaceProperties( getPropertyContents(gtarget, "COMPATIBLE_INTERFACE_NUMBER_MAX", ifaceProperties); - if (gtarget->GetType() != cmState::INTERFACE_LIBRARY) { + if (gtarget->GetType() != cmStateEnums::INTERFACE_LIBRARY) { getCompatibleInterfaceProperties(gtarget, ifaceProperties, ""); std::vector configNames; @@ -735,8 +735,8 @@ void cmExportFileGenerator::SetImportDetailProperties( cmMakefile* mf = target->Makefile; // Add the soname for unix shared libraries. - if (target->GetType() == cmState::SHARED_LIBRARY || - target->GetType() == cmState::MODULE_LIBRARY) { + if (target->GetType() == cmStateEnums::SHARED_LIBRARY || + target->GetType() == cmStateEnums::MODULE_LIBRARY) { if (!target->IsDLLPlatform()) { std::string prop; std::string value; @@ -912,22 +912,22 @@ void cmExportFileGenerator::GenerateImportTargetCode( // Create the imported target. os << "# Create imported target " << targetName << "\n"; switch (target->GetType()) { - case cmState::EXECUTABLE: + case cmStateEnums::EXECUTABLE: os << "add_executable(" << targetName << " IMPORTED)\n"; break; - case cmState::STATIC_LIBRARY: + case cmStateEnums::STATIC_LIBRARY: os << "add_library(" << targetName << " STATIC IMPORTED)\n"; break; - case cmState::SHARED_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: os << "add_library(" << targetName << " SHARED IMPORTED)\n"; break; - case cmState::MODULE_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: os << "add_library(" << targetName << " MODULE IMPORTED)\n"; break; - case cmState::UNKNOWN_LIBRARY: + case cmStateEnums::UNKNOWN_LIBRARY: os << "add_library(" << targetName << " UNKNOWN IMPORTED)\n"; break; - case cmState::INTERFACE_LIBRARY: + case cmStateEnums::INTERFACE_LIBRARY: os << "add_library(" << targetName << " INTERFACE IMPORTED)\n"; break; default: // should never happen diff --git a/Source/cmExportInstallAndroidMKGenerator.cxx b/Source/cmExportInstallAndroidMKGenerator.cxx index 58b7510..f9f5f3a 100644 --- a/Source/cmExportInstallAndroidMKGenerator.cxx +++ b/Source/cmExportInstallAndroidMKGenerator.cxx @@ -38,7 +38,7 @@ void cmExportInstallAndroidMKGenerator::GenerateImportHeaderCode( tei != this->IEGen->GetExportSet()->GetTargetExports()->end(); ++tei) { // Collect import properties for this target. cmTargetExport const* te = *tei; - if (te->Target->GetType() == cmState::INTERFACE_LIBRARY) { + if (te->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } std::string dest; diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 0e043de..92c3bf1 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -81,7 +81,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) cmGeneratorTarget* gt = (*tei)->Target; requiresConfigFiles = - requiresConfigFiles || gt->GetType() != cmState::INTERFACE_LIBRARY; + requiresConfigFiles || gt->GetType() != cmStateEnums::INTERFACE_LIBRARY; this->GenerateImportTargetCode(os, gt); @@ -120,7 +120,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) require2_8_12 = true; } } - if (gt->GetType() == cmState::INTERFACE_LIBRARY) { + if (gt->GetType() == cmStateEnums::INTERFACE_LIBRARY) { require3_0_0 = true; } if (gt->GetProperty("INTERFACE_SOURCES")) { @@ -316,7 +316,7 @@ void cmExportInstallFileGenerator::GenerateImportTargetsConfig( tei != this->IEGen->GetExportSet()->GetTargetExports()->end(); ++tei) { // Collect import properties for this target. cmTargetExport const* te = *tei; - if (te->Target->GetType() == cmState::INTERFACE_LIBRARY) { + if (te->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx index f80980a..66b77a6 100644 --- a/Source/cmExportLibraryDependenciesCommand.cxx +++ b/Source/cmExportLibraryDependenciesCommand.cxx @@ -79,8 +79,8 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const cmTarget const& target = l->second; // Skip non-library targets. - if (target.GetType() < cmState::STATIC_LIBRARY || - target.GetType() > cmState::MODULE_LIBRARY) { + if (target.GetType() < cmStateEnums::STATIC_LIBRARY || + target.GetType() > cmStateEnums::MODULE_LIBRARY) { continue; } diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx index 9fc71f6..a262e14 100644 --- a/Source/cmExportTryCompileFileGenerator.cxx +++ b/Source/cmExportTryCompileFileGenerator.cxx @@ -67,7 +67,7 @@ std::string cmExportTryCompileFileGenerator::FindTargets( CM_AUTO_PTR cge = ge.Parse(prop); - cmTarget dummyHead("try_compile_dummy_exe", cmState::EXECUTABLE, + cmTarget dummyHead("try_compile_dummy_exe", cmStateEnums::EXECUTABLE, cmTarget::VisibilityNormal, tgt->Target->GetMakefile()); cmGeneratorTarget gDummyHead(&dummyHead, tgt->GetLocalGenerator()); diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 18c732d..b91cae9 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -302,7 +302,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( ti != targets.end(); ti++) { std::string targetName = (*ti)->GetName(); switch ((*ti)->GetType()) { - case cmState::GLOBAL_TARGET: { + case cmStateEnums::GLOBAL_TARGET: { // Only add the global targets from CMAKE_BINARY_DIR, // not from the subdirs if (strcmp((*lg)->GetCurrentBinaryDirectory(), @@ -311,7 +311,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( compiler.c_str(), makeArgs); } } break; - case cmState::UTILITY: + case cmStateEnums::UTILITY: // Add all utility targets, except the Nightly/Continuous/ // Experimental-"sub"targets as e.g. NightlyStart if (((targetName.find("Nightly") == 0) && @@ -326,11 +326,11 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( this->AppendTarget(xml, targetName, CM_NULLPTR, make.c_str(), *lg, compiler.c_str(), makeArgs); break; - case cmState::EXECUTABLE: - case cmState::STATIC_LIBRARY: - case cmState::SHARED_LIBRARY: - case cmState::MODULE_LIBRARY: - case cmState::OBJECT_LIBRARY: { + case cmStateEnums::EXECUTABLE: + case cmStateEnums::STATIC_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: + case cmStateEnums::OBJECT_LIBRARY: { cmGeneratorTarget* gt = *ti; this->AppendTarget(xml, targetName, gt, make.c_str(), *lg, compiler.c_str(), makeArgs); @@ -364,12 +364,12 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( for (std::vector::iterator ti = targets.begin(); ti != targets.end(); ti++) { switch ((*ti)->GetType()) { - case cmState::EXECUTABLE: - case cmState::STATIC_LIBRARY: - case cmState::SHARED_LIBRARY: - case cmState::MODULE_LIBRARY: - case cmState::OBJECT_LIBRARY: - case cmState::UTILITY: // can have sources since 2.6.3 + case cmStateEnums::EXECUTABLE: + case cmStateEnums::STATIC_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: + case cmStateEnums::OBJECT_LIBRARY: + case cmStateEnums::UTILITY: // can have sources since 2.6.3 { std::vector sources; cmGeneratorTarget* gt = *ti; @@ -379,7 +379,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile( si != sources.end(); si++) { // don't add source files from UTILITY target which have the // GENERATED property set: - if (gt->GetType() == cmState::UTILITY && + if (gt->GetType() == cmStateEnums::UTILITY && (*si)->GetPropertyAsBool("GENERATED")) { continue; } @@ -519,7 +519,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget( if (target != CM_NULLPTR) { int cbTargetType = this->GetCBTargetType(target); std::string workingDir = lg->GetCurrentBinaryDirectory(); - if (target->GetType() == cmState::EXECUTABLE) { + if (target->GetType() == cmStateEnums::EXECUTABLE) { // Determine the directory where the executable target is created, and // set the working directory to this dir. const char* runtimeOutputDir = @@ -537,7 +537,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget( std::string buildType = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); std::string location; - if (target->GetType() == cmState::OBJECT_LIBRARY) { + if (target->GetType() == cmStateEnums::OBJECT_LIBRARY) { location = this->CreateDummyTargetFile(const_cast(lg), target); } else { @@ -713,17 +713,17 @@ std::string cmExtraCodeBlocksGenerator::GetCBCompilerId(const cmMakefile* mf) int cmExtraCodeBlocksGenerator::GetCBTargetType(cmGeneratorTarget* target) { switch (target->GetType()) { - case cmState::EXECUTABLE: + case cmStateEnums::EXECUTABLE: if ((target->GetPropertyAsBool("WIN32_EXECUTABLE")) || (target->GetPropertyAsBool("MACOSX_BUNDLE"))) { return 0; } return 1; - case cmState::STATIC_LIBRARY: - case cmState::OBJECT_LIBRARY: + case cmStateEnums::STATIC_LIBRARY: + case cmStateEnums::OBJECT_LIBRARY: return 2; - case cmState::SHARED_LIBRARY: - case cmState::MODULE_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: return 3; default: return 4; diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index 360c852..90d41fe 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -127,7 +127,7 @@ std::vector cmExtraCodeLiteGenerator::CreateProjectsByTarget( for (std::vector::const_iterator lt = (*lg)->GetGeneratorTargets().begin(); lt != (*lg)->GetGeneratorTargets().end(); lt++) { - cmState::TargetType type = (*lt)->GetType(); + cmStateEnums::TargetType type = (*lt)->GetType(); std::string outputDir = (*lg)->GetCurrentBinaryDirectory(); std::string filename = outputDir + "/" + (*lt)->GetName() + ".project"; retval.push_back((*lt)->GetName()); @@ -136,11 +136,11 @@ std::vector cmExtraCodeLiteGenerator::CreateProjectsByTarget( this->WorkspacePath.c_str(), filename.c_str()); std::string visualname = (*lt)->GetName(); switch (type) { - case cmState::SHARED_LIBRARY: - case cmState::STATIC_LIBRARY: - case cmState::MODULE_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: + case cmStateEnums::STATIC_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: visualname = "lib" + visualname; - case cmState::EXECUTABLE: + case cmStateEnums::EXECUTABLE: xml->StartElement("Project"); xml->Attribute("Name", visualname); xml->Attribute("Path", relafilename); @@ -209,16 +209,16 @@ std::string cmExtraCodeLiteGenerator::CollectSourceFiles( std::string projectType; switch (gt->GetType()) { - case cmState::EXECUTABLE: { + case cmStateEnums::EXECUTABLE: { projectType = "Executable"; } break; - case cmState::STATIC_LIBRARY: { + case cmStateEnums::STATIC_LIBRARY: { projectType = "Static Library"; } break; - case cmState::SHARED_LIBRARY: { + case cmStateEnums::SHARED_LIBRARY: { projectType = "Dynamic Library"; } break; - case cmState::MODULE_LIBRARY: { + case cmStateEnums::MODULE_LIBRARY: { projectType = "Dynamic Library"; } break; default: // intended fallthrough @@ -226,10 +226,10 @@ std::string cmExtraCodeLiteGenerator::CollectSourceFiles( } switch (gt->GetType()) { - case cmState::EXECUTABLE: - case cmState::STATIC_LIBRARY: - case cmState::SHARED_LIBRARY: - case cmState::MODULE_LIBRARY: { + case cmStateEnums::EXECUTABLE: + case cmStateEnums::STATIC_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: { std::vector sources; gt->GetSourceFiles(sources, makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); @@ -511,9 +511,9 @@ void cmExtraCodeLiteGenerator::CreateNewProjectFile( xml.StartElement("CodeLite_Project"); std::string visualname = gt->GetName(); switch (gt->GetType()) { - case cmState::STATIC_LIBRARY: - case cmState::SHARED_LIBRARY: - case cmState::MODULE_LIBRARY: + case cmStateEnums::STATIC_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: visualname = "lib" + visualname; default: // intended fallthrough break; diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index e342f4c..7535e8c 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -482,13 +482,14 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(cmXMLWriter& xml) std::string linkName2 = linkName; linkName2 += "/"; switch ((*ti)->GetType()) { - case cmState::EXECUTABLE: - case cmState::STATIC_LIBRARY: - case cmState::SHARED_LIBRARY: - case cmState::MODULE_LIBRARY: - case cmState::OBJECT_LIBRARY: { + case cmStateEnums::EXECUTABLE: + case cmStateEnums::STATIC_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: + case cmStateEnums::OBJECT_LIBRARY: { const char* prefix = - ((*ti)->GetType() == cmState::EXECUTABLE ? "[exe] " : "[lib] "); + ((*ti)->GetType() == cmStateEnums::EXECUTABLE ? "[exe] " + : "[lib] "); linkName2 += prefix; linkName2 += (*ti)->GetName(); this->AppendLinkedResource(xml, linkName2, "virtual:/virtual", @@ -912,14 +913,14 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const ti != targets.end(); ++ti) { std::string targetName = (*ti)->GetName(); switch ((*ti)->GetType()) { - case cmState::GLOBAL_TARGET: { + case cmStateEnums::GLOBAL_TARGET: { // Only add the global targets from CMAKE_BINARY_DIR, // not from the subdirs if (subdir.empty()) { this->AppendTarget(xml, targetName, make, makeArgs, subdir, ": "); } } break; - case cmState::UTILITY: + case cmStateEnums::UTILITY: // Add all utility targets, except the Nightly/Continuous/ // Experimental-"sub"targets as e.g. NightlyStart if (((targetName.find("Nightly") == 0) && @@ -933,13 +934,14 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const this->AppendTarget(xml, targetName, make, makeArgs, subdir, ": "); break; - case cmState::EXECUTABLE: - case cmState::STATIC_LIBRARY: - case cmState::SHARED_LIBRARY: - case cmState::MODULE_LIBRARY: - case cmState::OBJECT_LIBRARY: { + case cmStateEnums::EXECUTABLE: + case cmStateEnums::STATIC_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: + case cmStateEnums::OBJECT_LIBRARY: { const char* prefix = - ((*ti)->GetType() == cmState::EXECUTABLE ? "[exe] " : "[lib] "); + ((*ti)->GetType() == cmStateEnums::EXECUTABLE ? "[exe] " + : "[lib] "); this->AppendTarget(xml, targetName, make, makeArgs, subdir, prefix); std::string fastTarget = targetName; fastTarget += "/fast"; diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx index b78d09a..3f09469 100644 --- a/Source/cmExtraKateGenerator.cxx +++ b/Source/cmExtraKateGenerator.cxx @@ -124,7 +124,7 @@ void cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg, ti != targets.end(); ++ti) { std::string targetName = (*ti)->GetName(); switch ((*ti)->GetType()) { - case cmState::GLOBAL_TARGET: { + case cmStateEnums::GLOBAL_TARGET: { bool insertTarget = false; // Only add the global targets from CMAKE_BINARY_DIR, // not from the subdirs @@ -147,7 +147,7 @@ void cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg, homeOutputDir); } } break; - case cmState::UTILITY: + case cmStateEnums::UTILITY: // Add all utility targets, except the Nightly/Continuous/ // Experimental-"sub"targets as e.g. NightlyStart if (((targetName.find("Nightly") == 0) && @@ -162,11 +162,11 @@ void cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg, this->AppendTarget(fout, targetName, make, makeArgs, currentDir, homeOutputDir); break; - case cmState::EXECUTABLE: - case cmState::STATIC_LIBRARY: - case cmState::SHARED_LIBRARY: - case cmState::MODULE_LIBRARY: - case cmState::OBJECT_LIBRARY: { + case cmStateEnums::EXECUTABLE: + case cmStateEnums::STATIC_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: + case cmStateEnums::OBJECT_LIBRARY: { this->AppendTarget(fout, targetName, make, makeArgs, currentDir, homeOutputDir); std::string fastTarget = targetName; diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 41f82a2..9a83c49 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -156,7 +156,7 @@ void cmExtraSublimeTextGenerator::AppendAllTargets( ti != targets.end(); ti++) { std::string targetName = (*ti)->GetName(); switch ((*ti)->GetType()) { - case cmState::GLOBAL_TARGET: { + case cmStateEnums::GLOBAL_TARGET: { // Only add the global targets from CMAKE_BINARY_DIR, // not from the subdirs if (strcmp((*lg)->GetCurrentBinaryDirectory(), @@ -166,7 +166,7 @@ void cmExtraSublimeTextGenerator::AppendAllTargets( false); } } break; - case cmState::UTILITY: + case cmStateEnums::UTILITY: // Add all utility targets, except the Nightly/Continuous/ // Experimental-"sub"targets as e.g. NightlyStart if (((targetName.find("Nightly") == 0) && @@ -182,11 +182,11 @@ void cmExtraSublimeTextGenerator::AppendAllTargets( makefile, compiler.c_str(), sourceFileFlags, false); break; - case cmState::EXECUTABLE: - case cmState::STATIC_LIBRARY: - case cmState::SHARED_LIBRARY: - case cmState::MODULE_LIBRARY: - case cmState::OBJECT_LIBRARY: { + case cmStateEnums::EXECUTABLE: + case cmStateEnums::STATIC_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: + case cmStateEnums::OBJECT_LIBRARY: { this->AppendTarget(fout, targetName, *lg, *ti, make.c_str(), makefile, compiler.c_str(), sourceFileFlags, false); diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index f866605..f34b2d6 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -1104,7 +1104,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode if (!prop) { if (target->IsImported() || - target->GetType() == cmState::INTERFACE_LIBRARY) { + target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { return linkedTargetsContent; } if (target->IsLinkInterfaceDependentBoolProperty(propertyName, @@ -1224,7 +1224,7 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode reportError(context, content->GetOriginalExpression(), e.str()); return std::string(); } - if (gt->GetType() != cmState::OBJECT_LIBRARY) { + if (gt->GetType() != cmStateEnums::OBJECT_LIBRARY) { std::ostringstream e; e << "Objects of target \"" << tgtName << "\" referenced but is not an OBJECT library."; @@ -1506,7 +1506,7 @@ struct TargetFilesystemArtifactResultCreator "for DLL target platforms."); return std::string(); } - if (target->GetType() != cmState::SHARED_LIBRARY) { + if (target->GetType() != cmStateEnums::SHARED_LIBRARY) { ::reportError(context, content->GetOriginalExpression(), "TARGET_SONAME_FILE is allowed only for " "SHARED libraries."); @@ -1542,11 +1542,11 @@ struct TargetFilesystemArtifactResultCreator return std::string(); } - cmState::TargetType targetType = target->GetType(); + cmStateEnums::TargetType targetType = target->GetType(); - if (targetType != cmState::SHARED_LIBRARY && - targetType != cmState::MODULE_LIBRARY && - targetType != cmState::EXECUTABLE) { + if (targetType != cmStateEnums::SHARED_LIBRARY && + targetType != cmStateEnums::MODULE_LIBRARY && + targetType != cmStateEnums::EXECUTABLE) { ::reportError(context, content->GetOriginalExpression(), "TARGET_PDB_FILE is allowed only for " "targets with linker created artifacts."); @@ -1646,8 +1646,8 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode "No target \"" + name + "\""); return std::string(); } - if (target->GetType() >= cmState::OBJECT_LIBRARY && - target->GetType() != cmState::UNKNOWN_LIBRARY) { + if (target->GetType() >= cmStateEnums::OBJECT_LIBRARY && + target->GetType() != cmStateEnums::UNKNOWN_LIBRARY) { ::reportError(context, content->GetOriginalExpression(), "Target \"" + name + "\" is not an executable or library."); return std::string(); diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index b16cfc6..8324c30 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -215,7 +215,7 @@ struct TagVisitor , Target(target) , GlobalGenerator(target->GetLocalGenerator()->GetGlobalGenerator()) , Header(CM_HEADER_REGEX) - , IsObjLib(target->GetType() == cmState::OBJECT_LIBRARY) + , IsObjLib(target->GetType() == cmStateEnums::OBJECT_LIBRARY) { } @@ -230,7 +230,7 @@ struct TagVisitor std::string ext = cmSystemTools::LowerCase(sf->GetExtension()); if (sf->GetCustomCommand()) { DoAccept::Result>::Do(this->Data, sf); - } else if (this->Target->GetType() == cmState::UTILITY) { + } else if (this->Target->GetType() == cmStateEnums::UTILITY) { DoAccept::Result>::Do(this->Data, sf); } else if (sf->GetPropertyAsBool("HEADER_FILE_ONLY")) { DoAccept::Result>::Do(this->Data, sf); @@ -368,7 +368,7 @@ cmLocalGenerator* cmGeneratorTarget::GetLocalGenerator() const return this->LocalGenerator; } -cmState::TargetType cmGeneratorTarget::GetType() const +cmStateEnums::TargetType cmGeneratorTarget::GetType() const { return this->Target->GetType(); } @@ -415,7 +415,7 @@ const char* cmGeneratorTarget::GetProperty(const std::string& prop) const const char* cmGeneratorTarget::GetOutputTargetType(bool implib) const { switch (this->GetType()) { - case cmState::SHARED_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: if (this->IsDLLPlatform()) { if (implib) { // A DLL import library is treated as an archive target. @@ -428,10 +428,10 @@ const char* cmGeneratorTarget::GetOutputTargetType(bool implib) const // library targets. return "LIBRARY"; } - case cmState::STATIC_LIBRARY: + case cmStateEnums::STATIC_LIBRARY: // Static libraries are always treated as archive targets. return "ARCHIVE"; - case cmState::MODULE_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: if (implib) { // Module libraries are always treated as library targets. return "ARCHIVE"; @@ -439,7 +439,7 @@ const char* cmGeneratorTarget::GetOutputTargetType(bool implib) const // Module import libraries are treated as archive targets. return "LIBRARY"; } - case cmState::EXECUTABLE: + case cmStateEnums::EXECUTABLE: if (implib) { // Executable import libraries are treated as archive targets. return "ARCHIVE"; @@ -845,7 +845,7 @@ const char* cmGeneratorTarget::GetLocationForBuild() const bool cmGeneratorTarget::IsSystemIncludeDirectory( const std::string& dir, const std::string& config) const { - assert(this->GetType() != cmState::INTERFACE_LIBRARY); + assert(this->GetType() != cmStateEnums::INTERFACE_LIBRARY); std::string config_upper; if (!config.empty()) { config_upper = cmSystemTools::UpperCase(config); @@ -1006,7 +1006,7 @@ static bool processSources( void cmGeneratorTarget::GetSourceFiles(std::vector& files, const std::string& config) const { - assert(this->GetType() != cmState::INTERFACE_LIBRARY); + assert(this->GetType() != cmStateEnums::INTERFACE_LIBRARY); if (!this->LocalGenerator->GetGlobalGenerator()->GetConfigureDoneCMP0026()) { // At configure-time, this method can be called as part of getting the @@ -1151,7 +1151,7 @@ bool cmGeneratorTarget::HasSOName(const std::string& config) const { // soname is supported only for shared libraries and modules, // and then only when the platform supports an soname flag. - return ((this->GetType() == cmState::SHARED_LIBRARY) && + return ((this->GetType() == cmStateEnums::SHARED_LIBRARY) && !this->GetPropertyAsBool("NO_SONAME") && this->Makefile->GetSONameFlag(this->GetLinkerLanguage(config))); } @@ -1161,9 +1161,9 @@ bool cmGeneratorTarget::NeedRelinkBeforeInstall( { // Only executables and shared libraries can have an rpath and may // need relinking. - if (this->GetType() != cmState::EXECUTABLE && - this->GetType() != cmState::SHARED_LIBRARY && - this->GetType() != cmState::MODULE_LIBRARY) { + if (this->GetType() != cmStateEnums::EXECUTABLE && + this->GetType() != cmStateEnums::SHARED_LIBRARY && + this->GetType() != cmStateEnums::MODULE_LIBRARY) { return false; } @@ -1235,9 +1235,9 @@ bool cmGeneratorTarget::NeedRelinkBeforeInstall( bool cmGeneratorTarget::IsChrpathUsed(const std::string& config) const { // Only certain target types have an rpath. - if (!(this->GetType() == cmState::SHARED_LIBRARY || - this->GetType() == cmState::MODULE_LIBRARY || - this->GetType() == cmState::EXECUTABLE)) { + if (!(this->GetType() == cmStateEnums::SHARED_LIBRARY || + this->GetType() == cmStateEnums::MODULE_LIBRARY || + this->GetType() == cmStateEnums::EXECUTABLE)) { return false; } @@ -1292,7 +1292,7 @@ bool cmGeneratorTarget::IsChrpathUsed(const std::string& config) const bool cmGeneratorTarget::IsImportedSharedLibWithoutSOName( const std::string& config) const { - if (this->IsImported() && this->GetType() == cmState::SHARED_LIBRARY) { + if (this->IsImported() && this->GetType() == cmStateEnums::SHARED_LIBRARY) { if (cmGeneratorTarget::ImportInfo const* info = this->GetImportInfo(config)) { return info->NoSOName; @@ -1308,7 +1308,7 @@ bool cmGeneratorTarget::HasMacOSXRpathInstallNameDir( bool macosx_rpath = false; if (!this->IsImported()) { - if (this->GetType() != cmState::SHARED_LIBRARY) { + if (this->GetType() != cmStateEnums::SHARED_LIBRARY) { return false; } const char* install_name = this->GetProperty("INSTALL_NAME_DIR"); @@ -1562,17 +1562,17 @@ const cmListFileBacktrace* cmGeneratorTarget::GetUtilityBacktrace( bool cmGeneratorTarget::HaveWellDefinedOutputFiles() const { - return this->GetType() == cmState::STATIC_LIBRARY || - this->GetType() == cmState::SHARED_LIBRARY || - this->GetType() == cmState::MODULE_LIBRARY || - this->GetType() == cmState::EXECUTABLE; + return this->GetType() == cmStateEnums::STATIC_LIBRARY || + this->GetType() == cmStateEnums::SHARED_LIBRARY || + this->GetType() == cmStateEnums::MODULE_LIBRARY || + this->GetType() == cmStateEnums::EXECUTABLE; } const char* cmGeneratorTarget::GetExportMacro() const { // Define the symbol for targets that export symbols. - if (this->GetType() == cmState::SHARED_LIBRARY || - this->GetType() == cmState::MODULE_LIBRARY || + if (this->GetType() == cmStateEnums::SHARED_LIBRARY || + this->GetType() == cmStateEnums::MODULE_LIBRARY || this->IsExecutableWithExports()) { if (const char* custom_export_name = this->GetProperty("DEFINE_SYMBOL")) { this->ExportMacro = custom_export_name; @@ -1846,7 +1846,7 @@ cmGeneratorTarget::CompileInfo const* cmGeneratorTarget::GetCompileInfo( return CM_NULLPTR; } - if (this->GetType() > cmState::OBJECT_LIBRARY) { + if (this->GetType() > cmStateEnums::OBJECT_LIBRARY) { std::string msg = "cmTarget::GetCompileInfo called for "; msg += this->GetName(); msg += " which has type "; @@ -2023,7 +2023,7 @@ cmTargetTraceDependencies::cmTargetTraceDependencies(cmGeneratorTarget* target) this->CurrentEntry = CM_NULLPTR; // Queue all the source files already specified for the target. - if (target->GetType() != cmState::INTERFACE_LIBRARY) { + if (target->GetType() != cmStateEnums::INTERFACE_LIBRARY) { std::vector configs; this->Makefile->GetConfigurations(configs); if (configs.empty()) { @@ -2158,8 +2158,8 @@ bool cmTargetTraceDependencies::IsUtility(std::string const& dep) // then make sure it was not a full path to something else, and // the fact that the name matched a target was just a coincidence. if (cmSystemTools::FileIsFullPath(dep.c_str())) { - if (t->GetType() >= cmState::EXECUTABLE && - t->GetType() <= cmState::MODULE_LIBRARY) { + if (t->GetType() >= cmStateEnums::EXECUTABLE && + t->GetType() <= cmStateEnums::MODULE_LIBRARY) { // This is really only for compatibility so we do not need to // worry about configuration names and output names. std::string tLocation = t->GetLocationForBuild(); @@ -2199,7 +2199,7 @@ void cmTargetTraceDependencies::CheckCustomCommand(cmCustomCommand const& cc) // Check for a target with this name. if (cmGeneratorTarget* t = this->LocalGenerator->FindGeneratorTargetToUse(command)) { - if (t->GetType() == cmState::EXECUTABLE) { + if (t->GetType() == cmStateEnums::EXECUTABLE) { // The command refers to an executable target built in // this project. Add the target-level dependency to make // sure the executable is up to date before this custom @@ -2273,7 +2273,7 @@ void cmGeneratorTarget::TraceDependencies() // would find nothing anyway, but when building CMake itself the "install" // target command ends up referencing the "cmake" target but we do not // really want the dependency because "install" depend on "all" anyway. - if (this->GetType() == cmState::GLOBAL_TARGET) { + if (this->GetType() == cmStateEnums::GLOBAL_TARGET) { return; } @@ -2312,7 +2312,7 @@ std::string cmGeneratorTarget::GetCreateRuleVariable( std::string const& lang, std::string const& config) const { switch (this->GetType()) { - case cmState::STATIC_LIBRARY: { + case cmStateEnums::STATIC_LIBRARY: { std::string var = "CMAKE_" + lang + "_CREATE_STATIC_LIBRARY"; if (this->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION", config)) { std::string varIPO = var + "_IPO"; @@ -2322,11 +2322,11 @@ std::string cmGeneratorTarget::GetCreateRuleVariable( } return var; } - case cmState::SHARED_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: return "CMAKE_" + lang + "_CREATE_SHARED_LIBRARY"; - case cmState::MODULE_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: return "CMAKE_" + lang + "_CREATE_SHARED_MODULE"; - case cmState::EXECUTABLE: + case cmStateEnums::EXECUTABLE: return "CMAKE_" + lang + "_LINK_EXECUTABLE"; default: break; @@ -2753,11 +2753,11 @@ void cmGeneratorTarget::ComputeTargetManifest(const std::string& config) const std::string realName; std::string impName; std::string pdbName; - if (this->GetType() == cmState::EXECUTABLE) { + if (this->GetType() == cmStateEnums::EXECUTABLE) { this->GetExecutableNames(name, realName, impName, pdbName, config); - } else if (this->GetType() == cmState::STATIC_LIBRARY || - this->GetType() == cmState::SHARED_LIBRARY || - this->GetType() == cmState::MODULE_LIBRARY) { + } else if (this->GetType() == cmStateEnums::STATIC_LIBRARY || + this->GetType() == cmStateEnums::SHARED_LIBRARY || + this->GetType() == cmStateEnums::MODULE_LIBRARY) { this->GetLibraryNames(name, soName, realName, impName, pdbName, config); } else { return; @@ -2843,7 +2843,7 @@ std::string cmGeneratorTarget::NormalGetRealName( this->LocalGenerator->IssueMessage(cmake::INTERNAL_ERROR, msg); } - if (this->GetType() == cmState::EXECUTABLE) { + if (this->GetType() == cmStateEnums::EXECUTABLE) { // Compute the real name that will be built. std::string name; std::string realName; @@ -2926,8 +2926,8 @@ void cmGeneratorTarget::GetLibraryNames(std::string& name, std::string& soName, } // The import library name. - if (this->GetType() == cmState::SHARED_LIBRARY || - this->GetType() == cmState::MODULE_LIBRARY) { + if (this->GetType() == cmStateEnums::SHARED_LIBRARY || + this->GetType() == cmStateEnums::MODULE_LIBRARY) { impName = this->GetFullNameInternal(config, true); } else { impName = ""; @@ -2959,7 +2959,7 @@ void cmGeneratorTarget::GetExecutableNames(std::string& name, #else // Check for executable version properties. const char* version = this->GetProperty("VERSION"); - if (this->GetType() != cmState::EXECUTABLE || + if (this->GetType() != cmStateEnums::EXECUTABLE || this->Makefile->IsOn("XCODE")) { version = CM_NULLPTR; } @@ -3028,10 +3028,10 @@ void cmGeneratorTarget::GetFullNameInternal(const std::string& config, std::string& outSuffix) const { // Use just the target name for non-main target types. - if (this->GetType() != cmState::STATIC_LIBRARY && - this->GetType() != cmState::SHARED_LIBRARY && - this->GetType() != cmState::MODULE_LIBRARY && - this->GetType() != cmState::EXECUTABLE) { + if (this->GetType() != cmStateEnums::STATIC_LIBRARY && + this->GetType() != cmStateEnums::SHARED_LIBRARY && + this->GetType() != cmStateEnums::MODULE_LIBRARY && + this->GetType() != cmStateEnums::EXECUTABLE) { outPrefix = ""; outBase = this->GetName(); outSuffix = ""; @@ -3050,9 +3050,9 @@ void cmGeneratorTarget::GetFullNameInternal(const std::string& config, // The implib option is only allowed for shared libraries, module // libraries, and executables. - if (this->GetType() != cmState::SHARED_LIBRARY && - this->GetType() != cmState::MODULE_LIBRARY && - this->GetType() != cmState::EXECUTABLE) { + if (this->GetType() != cmStateEnums::SHARED_LIBRARY && + this->GetType() != cmStateEnums::MODULE_LIBRARY && + this->GetType() != cmStateEnums::EXECUTABLE) { implib = false; } @@ -3130,7 +3130,7 @@ void cmGeneratorTarget::GetFullNameInternal(const std::string& config, // Name shared libraries with their version number on some platforms. if (const char* soversion = this->GetProperty("SOVERSION")) { - if (this->GetType() == cmState::SHARED_LIBRARY && !implib && + if (this->GetType() == cmStateEnums::SHARED_LIBRARY && !implib && this->Makefile->IsOn("CMAKE_SHARED_LIBRARY_NAME_WITH_VERSION")) { outBase += "-"; outBase += soversion; @@ -3296,8 +3296,8 @@ cmGeneratorTarget::GetCompatibleInterfaces(std::string const& config) const bool cmGeneratorTarget::IsLinkInterfaceDependentBoolProperty( const std::string& p, const std::string& config) const { - if (this->GetType() == cmState::OBJECT_LIBRARY || - this->GetType() == cmState::INTERFACE_LIBRARY) { + if (this->GetType() == cmStateEnums::OBJECT_LIBRARY || + this->GetType() == cmStateEnums::INTERFACE_LIBRARY) { return false; } return this->GetCompatibleInterfaces(config).PropsBool.count(p) > 0; @@ -3306,8 +3306,8 @@ bool cmGeneratorTarget::IsLinkInterfaceDependentBoolProperty( bool cmGeneratorTarget::IsLinkInterfaceDependentStringProperty( const std::string& p, const std::string& config) const { - if (this->GetType() == cmState::OBJECT_LIBRARY || - this->GetType() == cmState::INTERFACE_LIBRARY) { + if (this->GetType() == cmStateEnums::OBJECT_LIBRARY || + this->GetType() == cmStateEnums::INTERFACE_LIBRARY) { return false; } return this->GetCompatibleInterfaces(config).PropsString.count(p) > 0; @@ -3316,8 +3316,8 @@ bool cmGeneratorTarget::IsLinkInterfaceDependentStringProperty( bool cmGeneratorTarget::IsLinkInterfaceDependentNumberMinProperty( const std::string& p, const std::string& config) const { - if (this->GetType() == cmState::OBJECT_LIBRARY || - this->GetType() == cmState::INTERFACE_LIBRARY) { + if (this->GetType() == cmStateEnums::OBJECT_LIBRARY || + this->GetType() == cmStateEnums::INTERFACE_LIBRARY) { return false; } return this->GetCompatibleInterfaces(config).PropsNumberMin.count(p) > 0; @@ -3326,8 +3326,8 @@ bool cmGeneratorTarget::IsLinkInterfaceDependentNumberMinProperty( bool cmGeneratorTarget::IsLinkInterfaceDependentNumberMaxProperty( const std::string& p, const std::string& config) const { - if (this->GetType() == cmState::OBJECT_LIBRARY || - this->GetType() == cmState::INTERFACE_LIBRARY) { + if (this->GetType() == cmStateEnums::OBJECT_LIBRARY || + this->GetType() == cmStateEnums::INTERFACE_LIBRARY) { return false; } return this->GetCompatibleInterfaces(config).PropsNumberMax.count(p) > 0; @@ -3921,7 +3921,7 @@ void cmGeneratorTarget::GetTargetVersion(bool soversion, int& major, minor = 0; patch = 0; - assert(this->GetType() != cmState::INTERFACE_LIBRARY); + assert(this->GetType() != cmStateEnums::INTERFACE_LIBRARY); // Look for a VERSION or SOVERSION property. const char* prop = soversion ? "SOVERSION" : "VERSION"; @@ -3993,7 +3993,7 @@ std::string cmGeneratorTarget::CreateFortranModuleDirectory( std::string cmGeneratorTarget::GetFrameworkVersion() const { - assert(this->GetType() != cmState::INTERFACE_LIBRARY); + assert(this->GetType() != cmStateEnums::INTERFACE_LIBRARY); if (const char* fversion = this->GetProperty("FRAMEWORK_VERSION")) { return fversion; @@ -4109,7 +4109,7 @@ cmLinkInterface const* cmGeneratorTarget::GetLinkInterface( // Link interfaces are not supported for executables that do not // export symbols. - if (this->GetType() == cmState::EXECUTABLE && + if (this->GetType() == cmStateEnums::EXECUTABLE && !this->IsExecutableWithExports()) { return CM_NULLPTR; } @@ -4143,9 +4143,9 @@ void cmGeneratorTarget::ComputeLinkInterface( cmGeneratorTarget const* headTarget) const { if (iface.ExplicitLibraries) { - if (this->GetType() == cmState::SHARED_LIBRARY || - this->GetType() == cmState::STATIC_LIBRARY || - this->GetType() == cmState::INTERFACE_LIBRARY) { + if (this->GetType() == cmStateEnums::SHARED_LIBRARY || + this->GetType() == cmStateEnums::STATIC_LIBRARY || + this->GetType() == cmStateEnums::INTERFACE_LIBRARY) { // Shared libraries may have runtime implementation dependencies // on other shared libraries that are not in the interface. UNORDERED_SET emitted; @@ -4154,7 +4154,7 @@ void cmGeneratorTarget::ComputeLinkInterface( li != iface.Libraries.end(); ++li) { emitted.insert(*li); } - if (this->GetType() != cmState::INTERFACE_LIBRARY) { + if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY) { cmLinkImplementation const* impl = this->GetLinkImplementation(config); for (std::vector::const_iterator li = impl->Libraries.begin(); @@ -4162,7 +4162,7 @@ void cmGeneratorTarget::ComputeLinkInterface( if (emitted.insert(*li).second) { if (li->Target) { // This is a runtime dependency on another shared library. - if (li->Target->GetType() == cmState::SHARED_LIBRARY) { + if (li->Target->GetType() == cmStateEnums::SHARED_LIBRARY) { iface.SharedDeps.push_back(*li); } } else { @@ -4192,7 +4192,7 @@ void cmGeneratorTarget::ComputeLinkInterface( } } - if (this->GetType() == cmState::STATIC_LIBRARY) { + if (this->GetType() == cmStateEnums::STATIC_LIBRARY) { // Construct the property name suffix for this configuration. std::string suffix = "_"; if (!config.empty()) { @@ -4225,7 +4225,7 @@ const cmLinkInterfaceLibraries* cmGeneratorTarget::GetLinkInterfaceLibraries( // Link interfaces are not supported for executables that do not // export symbols. - if (this->GetType() == cmState::EXECUTABLE && + if (this->GetType() == cmStateEnums::EXECUTABLE && !this->IsExecutableWithExports()) { return CM_NULLPTR; } @@ -4372,12 +4372,12 @@ bool cmGeneratorTarget::ComputeOutputDir(const std::string& config, if (out != outdir) { conf = ""; } - } else if (this->GetType() == cmState::EXECUTABLE) { + } else if (this->GetType() == cmStateEnums::EXECUTABLE) { // Lookup the output path for executables. out = this->Makefile->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH"); - } else if (this->GetType() == cmState::STATIC_LIBRARY || - this->GetType() == cmState::SHARED_LIBRARY || - this->GetType() == cmState::MODULE_LIBRARY) { + } else if (this->GetType() == cmStateEnums::STATIC_LIBRARY || + this->GetType() == cmStateEnums::SHARED_LIBRARY || + this->GetType() == cmStateEnums::MODULE_LIBRARY) { // Lookup the output path for libraries. out = this->Makefile->GetSafeDefinition("LIBRARY_OUTPUT_PATH"); } @@ -4486,7 +4486,7 @@ void cmGeneratorTarget::ComputeLinkInterfaceLibraries( // CMP0022 NEW behavior is to use INTERFACE_LINK_LIBRARIES. linkIfaceProp = "INTERFACE_LINK_LIBRARIES"; explicitLibraries = this->GetProperty(linkIfaceProp); - } else if (this->GetType() == cmState::SHARED_LIBRARY || + } else if (this->GetType() == cmStateEnums::SHARED_LIBRARY || this->IsExecutableWithExports()) { // CMP0022 OLD behavior is to use LINK_INTERFACE_LIBRARIES if set on a // shared lib or executable. @@ -4531,8 +4531,9 @@ void cmGeneratorTarget::ComputeLinkInterfaceLibraries( // There is no implicit link interface for executables or modules // so if none was explicitly set then there is no link interface. - if (!explicitLibraries && (this->GetType() == cmState::EXECUTABLE || - (this->GetType() == cmState::MODULE_LIBRARY))) { + if (!explicitLibraries && + (this->GetType() == cmStateEnums::EXECUTABLE || + (this->GetType() == cmStateEnums::MODULE_LIBRARY))) { return; } iface.Exists = true; @@ -4661,7 +4662,7 @@ cmGeneratorTarget::ImportInfo const* cmGeneratorTarget::GetImportInfo( i = this->ImportInfoMap.insert(entry).first; } - if (this->GetType() == cmState::INTERFACE_LIBRARY) { + if (this->GetType() == cmStateEnums::INTERFACE_LIBRARY) { return &i->second; } // If the location is empty then the target is not available for @@ -4696,7 +4697,7 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config, std::string linkProp = "INTERFACE_LINK_LIBRARIES"; const char* propertyLibs = this->GetProperty(linkProp); - if (this->GetType() != cmState::INTERFACE_LIBRARY) { + if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY) { if (!propertyLibs) { linkProp = "IMPORTED_LINK_INTERFACE_LIBRARIES"; linkProp += suffix; @@ -4713,7 +4714,7 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config, info.Libraries = propertyLibs; } } - if (this->GetType() == cmState::INTERFACE_LIBRARY) { + if (this->GetType() == cmStateEnums::INTERFACE_LIBRARY) { return; } @@ -4734,7 +4735,7 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config, } // Get the soname. - if (this->GetType() == cmState::SHARED_LIBRARY) { + if (this->GetType() == cmStateEnums::SHARED_LIBRARY) { std::string soProp = "IMPORTED_SONAME"; soProp += suffix; if (const char* config_soname = this->GetProperty(soProp)) { @@ -4745,7 +4746,7 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config, } // Get the "no-soname" mark. - if (this->GetType() == cmState::SHARED_LIBRARY) { + if (this->GetType() == cmStateEnums::SHARED_LIBRARY) { std::string soProp = "IMPORTED_NO_SONAME"; soProp += suffix; if (const char* config_no_soname = this->GetProperty(soProp)) { @@ -4759,7 +4760,7 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config, // Get the import library. if (imp) { info.ImportLibrary = imp; - } else if (this->GetType() == cmState::SHARED_LIBRARY || + } else if (this->GetType() == cmStateEnums::SHARED_LIBRARY || this->IsExecutableWithExports()) { std::string impProp = "IMPORTED_IMPLIB"; impProp += suffix; @@ -4795,7 +4796,7 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config, } // Get the cyclic repetition count. - if (this->GetType() == cmState::STATIC_LIBRARY) { + if (this->GetType() == cmStateEnums::STATIC_LIBRARY) { std::string linkProp = "IMPORTED_LINK_INTERFACE_MULTIPLICITY"; linkProp += suffix; if (const char* config_reps = this->GetProperty(linkProp)) { @@ -5191,12 +5192,12 @@ cmGeneratorTarget* cmGeneratorTarget::FindTargetToLink( // Skip targets that will not really be linked. This is probably a // name conflict between an external library and an executable // within the project. - if (tgt && tgt->GetType() == cmState::EXECUTABLE && + if (tgt && tgt->GetType() == cmStateEnums::EXECUTABLE && !tgt->IsExecutableWithExports()) { tgt = CM_NULLPTR; } - if (tgt && tgt->GetType() == cmState::OBJECT_LIBRARY) { + if (tgt && tgt->GetType() == cmStateEnums::OBJECT_LIBRARY) { std::ostringstream e; e << "Target \"" << this->GetName() << "\" links to " "OBJECT library \"" @@ -5242,14 +5243,14 @@ bool cmGeneratorTarget::GetImplibGNUtoMS(std::string const& gnuName, bool cmGeneratorTarget::IsExecutableWithExports() const { - return (this->GetType() == cmState::EXECUTABLE && + return (this->GetType() == cmStateEnums::EXECUTABLE && this->GetPropertyAsBool("ENABLE_EXPORTS")); } bool cmGeneratorTarget::HasImportLibrary() const { return (this->IsDLLPlatform() && - (this->GetType() == cmState::SHARED_LIBRARY || + (this->GetType() == cmStateEnums::SHARED_LIBRARY || this->IsExecutableWithExports())); } @@ -5269,24 +5270,24 @@ std::string cmGeneratorTarget::GetSupportDirectory() const bool cmGeneratorTarget::IsLinkable() const { - return (this->GetType() == cmState::STATIC_LIBRARY || - this->GetType() == cmState::SHARED_LIBRARY || - this->GetType() == cmState::MODULE_LIBRARY || - this->GetType() == cmState::UNKNOWN_LIBRARY || - this->GetType() == cmState::INTERFACE_LIBRARY || + return (this->GetType() == cmStateEnums::STATIC_LIBRARY || + this->GetType() == cmStateEnums::SHARED_LIBRARY || + this->GetType() == cmStateEnums::MODULE_LIBRARY || + this->GetType() == cmStateEnums::UNKNOWN_LIBRARY || + this->GetType() == cmStateEnums::INTERFACE_LIBRARY || this->IsExecutableWithExports()); } bool cmGeneratorTarget::IsFrameworkOnApple() const { - return (this->GetType() == cmState::SHARED_LIBRARY && + return (this->GetType() == cmStateEnums::SHARED_LIBRARY && this->Makefile->IsOn("APPLE") && this->GetPropertyAsBool("FRAMEWORK")); } bool cmGeneratorTarget::IsAppBundleOnApple() const { - return (this->GetType() == cmState::EXECUTABLE && + return (this->GetType() == cmStateEnums::EXECUTABLE && this->Makefile->IsOn("APPLE") && this->GetPropertyAsBool("MACOSX_BUNDLE")); } @@ -5298,6 +5299,6 @@ bool cmGeneratorTarget::IsXCTestOnApple() const bool cmGeneratorTarget::IsCFBundleOnApple() const { - return (this->GetType() == cmState::MODULE_LIBRARY && + return (this->GetType() == cmStateEnums::MODULE_LIBRARY && this->Makefile->IsOn("APPLE") && this->GetPropertyAsBool("BUNDLE")); } diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 8e5a02d..625c28e 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -60,7 +60,7 @@ public: cmComputeLinkInformation* GetLinkInformation( const std::string& config) const; - cmState::TargetType GetType() const; + cmStateEnums::TargetType GetType() const; const std::string& GetName() const; std::string GetExportName() const; @@ -198,7 +198,7 @@ public: bool LinkLanguagePropagatesToDependents() const { - return this->GetType() == cmState::STATIC_LIBRARY; + return this->GetType() == cmStateEnums::STATIC_LIBRARY; } /** Get the macro to define when building sources in this target. diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 3154f8d..ba623d5 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -130,7 +130,7 @@ void cmGhsMultiTargetGenerator::Generate() this->WriteCompilerFlags(config, language); this->WriteCompilerDefinitions(config, language); this->WriteIncludes(config, language); - if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE) { + if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE) { this->WriteTargetLinkLibraries(config, language); } this->WriteCustomCommands(); @@ -174,7 +174,7 @@ GhsMultiGpj::Types cmGhsMultiTargetGenerator::GetGpjTag( GhsMultiGpj::Types output; if (cmGhsMultiTargetGenerator::DetermineIfTargetGroup(target)) { output = GhsMultiGpj::INTERGRITY_APPLICATION; - } else if (target->GetType() == cmState::STATIC_LIBRARY) { + } else if (target->GetType() == cmStateEnums::STATIC_LIBRARY) { output = GhsMultiGpj::LIBRARY; } else { output = GhsMultiGpj::PROGRAM; @@ -195,13 +195,13 @@ void cmGhsMultiTargetGenerator::WriteTypeSpecifics(const std::string& config, std::string outputDir(this->GetOutputDirectory(config)); std::string outputFilename(this->GetOutputFilename(config)); - if (this->GeneratorTarget->GetType() == cmState::STATIC_LIBRARY) { + if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY) { std::string const static_library_suffix = this->Makefile->GetSafeDefinition("CMAKE_STATIC_LIBRARY_SUFFIX"); *this->GetFolderBuildStreams() << " -o \"" << outputDir << outputFilename << static_library_suffix << "\"" << std::endl; - } else if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE) { + } else if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE) { if (notKernel && !this->IsTargetGroup()) { *this->GetFolderBuildStreams() << " -relprog" << std::endl; } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 7d0c2da..58c6a00 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1371,14 +1371,14 @@ cmGlobalGenerator::CreateQtAutoGeneratorsTargets() filteredTargets.reserve(targets.size()); for (std::vector::iterator ti = targets.begin(); ti != targets.end(); ++ti) { - if ((*ti)->GetType() == cmState::GLOBAL_TARGET) { + if ((*ti)->GetType() == cmStateEnums::GLOBAL_TARGET) { continue; } - if ((*ti)->GetType() != cmState::EXECUTABLE && - (*ti)->GetType() != cmState::STATIC_LIBRARY && - (*ti)->GetType() != cmState::SHARED_LIBRARY && - (*ti)->GetType() != cmState::MODULE_LIBRARY && - (*ti)->GetType() != cmState::OBJECT_LIBRARY) { + if ((*ti)->GetType() != cmStateEnums::EXECUTABLE && + (*ti)->GetType() != cmStateEnums::STATIC_LIBRARY && + (*ti)->GetType() != cmStateEnums::SHARED_LIBRARY && + (*ti)->GetType() != cmStateEnums::MODULE_LIBRARY && + (*ti)->GetType() != cmStateEnums::OBJECT_LIBRARY) { continue; } if ((!(*ti)->GetPropertyAsBool("AUTOMOC") && @@ -1443,13 +1443,13 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo() cmTargets& targets = mf->GetTargets(); for (cmTargets::iterator ti = targets.begin(); ti != targets.end(); ++ti) { cmTarget* t = &ti->second; - if (t->GetType() == cmState::GLOBAL_TARGET) { + if (t->GetType() == cmStateEnums::GLOBAL_TARGET) { continue; } t->AppendBuildInterfaceIncludes(); - if (t->GetType() == cmState::INTERFACE_LIBRARY) { + if (t->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } @@ -1575,7 +1575,7 @@ void cmGlobalGenerator::CheckTargetProperties() this->Makefiles[i]->ConfigureFinalPass(); cmTargets& targets = this->Makefiles[i]->GetTargets(); for (cmTargets::iterator l = targets.begin(); l != targets.end(); l++) { - if (l->second.GetType() == cmState::INTERFACE_LIBRARY) { + if (l->second.GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } const cmTarget::LinkLibraryVectorType& libs = @@ -1942,7 +1942,7 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root, bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root, cmGeneratorTarget* target) const { - if (target->GetType() == cmState::INTERFACE_LIBRARY || + if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY || target->GetPropertyAsBool("EXCLUDE_FROM_ALL")) { // This target is excluded from its directory. return true; @@ -2398,8 +2398,8 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget(GlobalTargetInfo const& gti, cmMakefile* mf) { // Package - cmTarget target(gti.Name, cmState::GLOBAL_TARGET, cmTarget::VisibilityNormal, - mf); + cmTarget target(gti.Name, cmStateEnums::GLOBAL_TARGET, + cmTarget::VisibilityNormal, mf); target.SetProperty("EXCLUDE_FROM_ALL", "TRUE"); std::vector no_outputs; @@ -2544,7 +2544,7 @@ void cmGlobalGenerator::GetTargetSets(TargetDependSet& projectTargets, bool cmGlobalGenerator::IsRootOnlyTarget(cmGeneratorTarget* target) const { - return (target->GetType() == cmState::GLOBAL_TARGET || + return (target->GetType() == cmStateEnums::GLOBAL_TARGET || target->GetName() == this->GetAllTargetName()); } @@ -2729,7 +2729,7 @@ void cmGlobalGenerator::WriteSummary() this->LocalGenerators[i]->GetGeneratorTargets(); for (std::vector::iterator it = tgts.begin(); it != tgts.end(); ++it) { - if ((*it)->GetType() == cmState::INTERFACE_LIBRARY) { + if ((*it)->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } this->WriteSummary(*it); diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx index 57d9aca..1881b7a 100644 --- a/Source/cmGlobalKdevelopGenerator.cxx +++ b/Source/cmGlobalKdevelopGenerator.cxx @@ -74,7 +74,7 @@ void cmGlobalKdevelopGenerator::Generate() for (std::vector::const_iterator ti = targets.begin(); ti != targets.end(); ti++) { - if ((*ti)->GetType() == cmState::EXECUTABLE) { + if ((*ti)->GetType() == cmStateEnums::EXECUTABLE) { executable = (*ti)->GetLocation(""); break; } diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 67df038..98654c5 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -956,17 +956,17 @@ void cmGlobalNinjaGenerator::AppendTargetOutputs( bool realname = target->IsFrameworkOnApple(); switch (target->GetType()) { - case cmState::EXECUTABLE: - case cmState::SHARED_LIBRARY: - case cmState::STATIC_LIBRARY: - case cmState::MODULE_LIBRARY: { + case cmStateEnums::EXECUTABLE: + case cmStateEnums::SHARED_LIBRARY: + case cmStateEnums::STATIC_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: { outputs.push_back(this->ConvertToNinjaPath( target->GetFullPath(configName, false, realname))); break; } - case cmState::OBJECT_LIBRARY: - case cmState::GLOBAL_TARGET: - case cmState::UTILITY: { + case cmStateEnums::OBJECT_LIBRARY: + case cmStateEnums::GLOBAL_TARGET: + case cmStateEnums::UTILITY: { std::string path = target->GetLocalGenerator()->GetCurrentBinaryDirectory() + std::string("/") + target->GetName(); @@ -982,7 +982,7 @@ void cmGlobalNinjaGenerator::AppendTargetOutputs( void cmGlobalNinjaGenerator::AppendTargetDepends( cmGeneratorTarget const* target, cmNinjaDeps& outputs) { - if (target->GetType() == cmState::GLOBAL_TARGET) { + if (target->GetType() == cmStateEnums::GLOBAL_TARGET) { // These depend only on other CMake-provided targets, e.g. "all". std::set const& utils = target->GetUtilities(); for (std::set::const_iterator i = utils.begin(); @@ -997,7 +997,7 @@ void cmGlobalNinjaGenerator::AppendTargetDepends( cmTargetDependSet const& targetDeps = this->GetTargetDirectDepends(target); for (cmTargetDependSet::const_iterator i = targetDeps.begin(); i != targetDeps.end(); ++i) { - if ((*i)->GetType() == cmState::INTERFACE_LIBRARY) { + if ((*i)->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } this->AppendTargetOutputs(*i, outs); @@ -1034,7 +1034,7 @@ void cmGlobalNinjaGenerator::ComputeTargetDependsClosure( cmTargetDependSet const& targetDeps = this->GetTargetDirectDepends(target); for (cmTargetDependSet::const_iterator i = targetDeps.begin(); i != targetDeps.end(); ++i) { - if ((*i)->GetType() == cmState::INTERFACE_LIBRARY) { + if ((*i)->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } if (depends.insert(*i).second) { @@ -1102,11 +1102,13 @@ void cmGlobalNinjaGenerator::WriteFolderTargets(std::ostream& os) lg->GetGeneratorTargets().begin(); ti != lg->GetGeneratorTargets().end(); ++ti) { cmGeneratorTarget const* gt = *ti; - cmState::TargetType const type = gt->GetType(); - if ((type == cmState::EXECUTABLE || type == cmState::STATIC_LIBRARY || - type == cmState::SHARED_LIBRARY || - type == cmState::MODULE_LIBRARY || - type == cmState::OBJECT_LIBRARY || type == cmState::UTILITY) && + cmStateEnums::TargetType const type = gt->GetType(); + if ((type == cmStateEnums::EXECUTABLE || + type == cmStateEnums::STATIC_LIBRARY || + type == cmStateEnums::SHARED_LIBRARY || + type == cmStateEnums::MODULE_LIBRARY || + type == cmStateEnums::OBJECT_LIBRARY || + type == cmStateEnums::UTILITY) && !gt->GetPropertyAsBool("EXCLUDE_FROM_ALL")) { targetsPerFolder[currentSourceFolder].push_back(gt->GetName()); } diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index daacef0..615670c 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -382,12 +382,12 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefileLanguageRules( std::vector tgts = lg->GetGeneratorTargets(); for (std::vector::iterator l = tgts.begin(); l != tgts.end(); l++) { - if (((*l)->GetType() == cmState::EXECUTABLE) || - ((*l)->GetType() == cmState::STATIC_LIBRARY) || - ((*l)->GetType() == cmState::SHARED_LIBRARY) || - ((*l)->GetType() == cmState::MODULE_LIBRARY) || - ((*l)->GetType() == cmState::OBJECT_LIBRARY) || - ((*l)->GetType() == cmState::UTILITY)) { + if (((*l)->GetType() == cmStateEnums::EXECUTABLE) || + ((*l)->GetType() == cmStateEnums::STATIC_LIBRARY) || + ((*l)->GetType() == cmStateEnums::SHARED_LIBRARY) || + ((*l)->GetType() == cmStateEnums::MODULE_LIBRARY) || + ((*l)->GetType() == cmStateEnums::OBJECT_LIBRARY) || + ((*l)->GetType() == cmStateEnums::UTILITY)) { cmGeneratorTarget* gt = *l; std::string tname = lg->GetRelativeTargetDirectory(gt); tname += "/DependInfo.cmake"; @@ -416,10 +416,12 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRule2( l != targets.end(); ++l) { cmGeneratorTarget* gtarget = *l; int type = gtarget->GetType(); - if ((type == cmState::EXECUTABLE) || (type == cmState::STATIC_LIBRARY) || - (type == cmState::SHARED_LIBRARY) || - (type == cmState::MODULE_LIBRARY) || - (type == cmState::OBJECT_LIBRARY) || (type == cmState::UTILITY)) { + if ((type == cmStateEnums::EXECUTABLE) || + (type == cmStateEnums::STATIC_LIBRARY) || + (type == cmStateEnums::SHARED_LIBRARY) || + (type == cmStateEnums::MODULE_LIBRARY) || + (type == cmStateEnums::OBJECT_LIBRARY) || + (type == cmStateEnums::UTILITY)) { // Add this to the list of depends rules in this directory. if ((!check_all || !gtarget->GetPropertyAsBool("EXCLUDE_FROM_ALL")) && (!check_relink || @@ -554,11 +556,12 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules( if (!name.empty() && emitted.insert(name).second && // Handle user targets here. Global targets are handled in // the local generator on a per-directory basis. - ((type == cmState::EXECUTABLE) || - (type == cmState::STATIC_LIBRARY) || - (type == cmState::SHARED_LIBRARY) || - (type == cmState::MODULE_LIBRARY) || - (type == cmState::OBJECT_LIBRARY) || (type == cmState::UTILITY))) { + ((type == cmStateEnums::EXECUTABLE) || + (type == cmStateEnums::STATIC_LIBRARY) || + (type == cmStateEnums::SHARED_LIBRARY) || + (type == cmStateEnums::MODULE_LIBRARY) || + (type == cmStateEnums::OBJECT_LIBRARY) || + (type == cmStateEnums::UTILITY))) { // Add a rule to build the target by name. lg->WriteDivider(ruleFileStream); ruleFileStream << "# Target rules for targets named " << name @@ -630,11 +633,12 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2( cmGeneratorTarget* gtarget = *t; int type = gtarget->GetType(); std::string name = gtarget->GetName(); - if (!name.empty() && - ((type == cmState::EXECUTABLE) || (type == cmState::STATIC_LIBRARY) || - (type == cmState::SHARED_LIBRARY) || - (type == cmState::MODULE_LIBRARY) || - (type == cmState::OBJECT_LIBRARY) || (type == cmState::UTILITY))) { + if (!name.empty() && ((type == cmStateEnums::EXECUTABLE) || + (type == cmStateEnums::STATIC_LIBRARY) || + (type == cmStateEnums::SHARED_LIBRARY) || + (type == cmStateEnums::MODULE_LIBRARY) || + (type == cmStateEnums::OBJECT_LIBRARY) || + (type == cmStateEnums::UTILITY))) { std::string makefileName; // Add a rule to build the target by name. localName = lg->GetRelativeTargetDirectory(gtarget); @@ -808,7 +812,7 @@ void cmGlobalUnixMakefileGenerator3::InitializeProgressMarks() cmLocalGenerator* tlg = gt->GetLocalGenerator(); - if (gt->GetType() == cmState::INTERFACE_LIBRARY || + if (gt->GetType() == cmStateEnums::INTERFACE_LIBRARY || gt->GetPropertyAsBool("EXCLUDE_FROM_ALL")) { continue; } @@ -847,7 +851,7 @@ size_t cmGlobalUnixMakefileGenerator3::CountProgressMarksInTarget( TargetDependSet const& depends = this->GetTargetDirectDepends(target); for (TargetDependSet::const_iterator di = depends.begin(); di != depends.end(); ++di) { - if ((*di)->GetType() == cmState::INTERFACE_LIBRARY) { + if ((*di)->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } count += this->CountProgressMarksInTarget(*di, emitted); @@ -908,7 +912,7 @@ void cmGlobalUnixMakefileGenerator3::AppendGlobalTargetDepends( i != depends_set.end(); ++i) { // Create the target-level dependency. cmGeneratorTarget const* dep = *i; - if (dep->GetType() == cmState::INTERFACE_LIBRARY) { + if (dep->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } cmLocalUnixMakefileGenerator3* lg3 = @@ -950,13 +954,14 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule( for (std::vector::iterator t = targets.begin(); t != targets.end(); ++t) { cmGeneratorTarget* target = *t; - cmState::TargetType type = target->GetType(); - if ((type == cmState::EXECUTABLE) || - (type == cmState::STATIC_LIBRARY) || - (type == cmState::SHARED_LIBRARY) || - (type == cmState::MODULE_LIBRARY) || - (type == cmState::OBJECT_LIBRARY) || - (type == cmState::GLOBAL_TARGET) || (type == cmState::UTILITY)) { + cmStateEnums::TargetType type = target->GetType(); + if ((type == cmStateEnums::EXECUTABLE) || + (type == cmStateEnums::STATIC_LIBRARY) || + (type == cmStateEnums::SHARED_LIBRARY) || + (type == cmStateEnums::MODULE_LIBRARY) || + (type == cmStateEnums::OBJECT_LIBRARY) || + (type == cmStateEnums::GLOBAL_TARGET) || + (type == cmStateEnums::UTILITY)) { std::string name = target->GetName(); if (emittedTargets.insert(name).second) { path = "... "; diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index 5d9a02b..f120762 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -230,9 +230,10 @@ cmGlobalVisualStudio11Generator::GetInstalledWindowsCESDKs() } bool cmGlobalVisualStudio11Generator::NeedsDeploy( - cmState::TargetType type) const + cmStateEnums::TargetType type) const { - if ((type == cmState::EXECUTABLE || type == cmState::SHARED_LIBRARY) && + if ((type == cmStateEnums::EXECUTABLE || + type == cmStateEnums::SHARED_LIBRARY) && (this->SystemIsWindowsPhone || this->SystemIsWindowsStore)) { return true; } diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h index 0c03b0a..be78544 100644 --- a/Source/cmGlobalVisualStudio11Generator.h +++ b/Source/cmGlobalVisualStudio11Generator.h @@ -37,7 +37,7 @@ protected: static std::set GetInstalledWindowsCESDKs(); /** Return true if the configuration needs to be deployed */ - virtual bool NeedsDeploy(cmState::TargetType type) const; + virtual bool NeedsDeploy(cmStateEnums::TargetType type) const; private: class Factory; diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index ffd87e2..6941e15 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -246,7 +246,7 @@ void cmGlobalVisualStudio71Generator::WriteExternalProject( // Write a dsp file into the SLN file, Note, that dependencies from // executables to the libraries it uses are also done here void cmGlobalVisualStudio71Generator::WriteProjectConfigurations( - std::ostream& fout, const std::string& name, cmState::TargetType, + std::ostream& fout, const std::string& name, cmStateEnums::TargetType, std::vector const& configs, const std::set& configsPartOfDefaultBuild, std::string const& platformMapping) diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h index eb65bcb..9953047 100644 --- a/Source/cmGlobalVisualStudio71Generator.h +++ b/Source/cmGlobalVisualStudio71Generator.h @@ -56,7 +56,7 @@ protected: const char* path, cmGeneratorTarget const* t); virtual void WriteProjectConfigurations( - std::ostream& fout, const std::string& name, cmState::TargetType type, + std::ostream& fout, const std::string& name, cmStateEnums::TargetType type, std::vector const& configs, const std::set& configsPartOfDefaultBuild, const std::string& platformMapping = ""); diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 0287def..1ffcf07 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -345,7 +345,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations( for (OrderedTargetDependSet::const_iterator tt = projectTargets.begin(); tt != projectTargets.end(); ++tt) { cmGeneratorTarget const* target = *tt; - if (target->GetType() == cmState::INTERFACE_LIBRARY) { + if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } const char* expath = target->GetProperty("EXTERNAL_MSPROJECT"); @@ -377,7 +377,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution( for (OrderedTargetDependSet::const_iterator tt = projectTargets.begin(); tt != projectTargets.end(); ++tt) { cmGeneratorTarget const* target = *tt; - if (target->GetType() == cmState::INTERFACE_LIBRARY) { + if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } bool written = false; @@ -446,7 +446,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetDepends( for (OrderedTargetDependSet::const_iterator tt = projectTargets.begin(); tt != projectTargets.end(); ++tt) { cmGeneratorTarget const* target = *tt; - if (target->GetType() == cmState::INTERFACE_LIBRARY) { + if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } const char* vcprojName = target->GetProperty("GENERATOR_FILE_NAME"); @@ -676,7 +676,7 @@ std::set cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild( // if it is a utilitiy target then only make it part of the // default build if another target depends on it int type = target->GetType(); - if (type == cmState::GLOBAL_TARGET) { + if (type == cmStateEnums::GLOBAL_TARGET) { // check if INSTALL target is part of default build if (target->GetName() == "INSTALL") { // inspect CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD properties @@ -696,7 +696,7 @@ std::set cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild( } return activeConfigs; } - if (type == cmState::UTILITY && + if (type == cmStateEnums::UTILITY && !this->IsDependedOn(projectTargets, target)) { return activeConfigs; } diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 3c6ce11..4d588e6 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -120,7 +120,7 @@ protected: const char* path, cmGeneratorTarget const* t) = 0; virtual void WriteProjectConfigurations( - std::ostream& fout, const std::string& name, cmState::TargetType type, + std::ostream& fout, const std::string& name, cmStateEnums::TargetType type, std::vector const& configs, const std::set& configsPartOfDefaultBuild, const std::string& platformMapping = "") = 0; diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 2ce0098..64808c9 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -347,7 +347,7 @@ void cmGlobalVisualStudio8Generator::WriteSolutionConfigurations( } void cmGlobalVisualStudio8Generator::WriteProjectConfigurations( - std::ostream& fout, const std::string& name, cmState::TargetType type, + std::ostream& fout, const std::string& name, cmStateEnums::TargetType type, std::vector const& configs, const std::set& configsPartOfDefaultBuild, std::string const& platformMapping) @@ -380,10 +380,10 @@ void cmGlobalVisualStudio8Generator::WriteProjectConfigurations( } bool cmGlobalVisualStudio8Generator::NeedsDeploy( - cmState::TargetType type) const + cmStateEnums::TargetType type) const { bool needsDeploy = - (type == cmState::EXECUTABLE || type == cmState::SHARED_LIBRARY); + (type == cmStateEnums::EXECUTABLE || type == cmStateEnums::SHARED_LIBRARY); return this->TargetsWindowsCE() && needsDeploy; } @@ -402,7 +402,7 @@ void cmGlobalVisualStudio8Generator::WriteProjectDepends( OrderedTargetDependSet depends(unordered, std::string()); for (OrderedTargetDependSet::const_iterator i = depends.begin(); i != depends.end(); ++i) { - if ((*i)->GetType() == cmState::INTERFACE_LIBRARY) { + if ((*i)->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } std::string guid = this->GetGUID((*i)->GetName().c_str()); @@ -419,7 +419,7 @@ bool cmGlobalVisualStudio8Generator::NeedLinkLibraryDependencies( ui != target->GetUtilities().end(); ++ui) { if (cmGeneratorTarget* depTarget = target->GetLocalGenerator()->FindGeneratorTargetToUse(ui->c_str())) { - if (depTarget->GetType() != cmState::INTERFACE_LIBRARY && + if (depTarget->GetType() != cmStateEnums::INTERFACE_LIBRARY && depTarget->GetProperty("EXTERNAL_MSPROJECT")) { // This utility dependency names an external .vcproj target. // We use LinkLibraryDependencies="true" to link to it without diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index 2543ec1..b149c9d 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -72,14 +72,14 @@ protected: bool AddCheckTarget(); /** Return true if the configuration needs to be deployed */ - virtual bool NeedsDeploy(cmState::TargetType type) const; + virtual bool NeedsDeploy(cmStateEnums::TargetType type) const; static cmIDEFlagTable const* GetExtraFlagTableVS8(); virtual void WriteSLNHeader(std::ostream& fout); virtual void WriteSolutionConfigurations( std::ostream& fout, std::vector const& configs); virtual void WriteProjectConfigurations( - std::ostream& fout, const std::string& name, cmState::TargetType type, + std::ostream& fout, const std::string& name, cmStateEnums::TargetType type, std::vector const& configs, const std::set& configsPartOfDefaultBuild, const std::string& platformMapping = ""); diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 6296dd2..45f7913 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -81,7 +81,8 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets() for (std::vector::iterator t = targets.begin(); t != targets.end(); ++t) { cmGeneratorTarget* tgt = *t; - if (tgt->GetType() == cmState::GLOBAL_TARGET || tgt->IsImported()) { + if (tgt->GetType() == cmStateEnums::GLOBAL_TARGET || + tgt->IsImported()) { continue; } if (!this->IsExcluded(gen[0], tgt)) { @@ -265,11 +266,11 @@ cmGlobalVisualStudioGenerator::GetTargetLinkClosure(cmGeneratorTarget* target) void cmGlobalVisualStudioGenerator::FollowLinkDepends( const cmGeneratorTarget* target, std::set& linked) { - if (target->GetType() == cmState::INTERFACE_LIBRARY) { + if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { return; } if (linked.insert(target).second && - target->GetType() == cmState::STATIC_LIBRARY) { + target->GetType() == cmStateEnums::STATIC_LIBRARY) { // Static library targets do not list their link dependencies so // we must follow them transitively now. TargetDependSet const& depends = this->GetTargetDirectDepends(target); @@ -304,7 +305,7 @@ bool cmGlobalVisualStudioGenerator::ComputeTargetDepends() static bool VSLinkable(cmGeneratorTarget const* t) { - return t->IsLinkable() || t->GetType() == cmState::OBJECT_LIBRARY; + return t->IsLinkable() || t->GetType() == cmStateEnums::OBJECT_LIBRARY; } void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends( @@ -333,10 +334,10 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends( // leaving them out for the static library itself but following them // transitively for other targets. - bool allowLinkable = (target->GetType() != cmState::STATIC_LIBRARY && - target->GetType() != cmState::SHARED_LIBRARY && - target->GetType() != cmState::MODULE_LIBRARY && - target->GetType() != cmState::EXECUTABLE); + bool allowLinkable = (target->GetType() != cmStateEnums::STATIC_LIBRARY && + target->GetType() != cmStateEnums::SHARED_LIBRARY && + target->GetType() != cmStateEnums::MODULE_LIBRARY && + target->GetType() != cmStateEnums::EXECUTABLE); TargetDependSet const& depends = this->GetTargetDirectDepends(target); @@ -344,7 +345,7 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends( // Static libraries cannot depend on their link implementation // due to behavior (2), but they do not really need to. std::set linkDepends; - if (target->GetType() != cmState::STATIC_LIBRARY) { + if (target->GetType() != cmStateEnums::STATIC_LIBRARY) { for (TargetDependSet::const_iterator di = depends.begin(); di != depends.end(); ++di) { cmTargetDepend dep = *di; @@ -367,7 +368,7 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends( // Collect all targets linked by this target so we can avoid // intermediate targets below. TargetSet linked; - if (target->GetType() != cmState::STATIC_LIBRARY) { + if (target->GetType() != cmStateEnums::STATIC_LIBRARY) { linked = this->GetTargetLinkClosure(target); } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 7b1afa5..34a01d6 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -444,7 +444,7 @@ void cmGlobalXCodeGenerator::AddExtraTargets( l != tgts.end(); l++) { cmGeneratorTarget* target = *l; - if (target->GetType() == cmState::GLOBAL_TARGET) { + if (target->GetType() == cmStateEnums::GLOBAL_TARGET) { continue; } @@ -459,12 +459,12 @@ void cmGlobalXCodeGenerator::AddExtraTargets( // this will make sure that when the next target is built // things are up-to-date if (!makeHelper.empty() && - (target->GetType() == cmState::EXECUTABLE || + (target->GetType() == cmStateEnums::EXECUTABLE || // Nope - no post-build for OBJECT_LIRBRARY - // target->GetType() == cmState::OBJECT_LIBRARY || - target->GetType() == cmState::STATIC_LIBRARY || - target->GetType() == cmState::SHARED_LIBRARY || - target->GetType() == cmState::MODULE_LIBRARY)) { + // target->GetType() == cmStateEnums::OBJECT_LIBRARY || + target->GetType() == cmStateEnums::STATIC_LIBRARY || + target->GetType() == cmStateEnums::SHARED_LIBRARY || + target->GetType() == cmStateEnums::MODULE_LIBRARY)) { makeHelper[makeHelper.size() - 1] = // fill placeholder this->PostBuildMakeTarget(target->GetName(), "$(CONFIGURATION)"); cmCustomCommandLines commandLines; @@ -475,7 +475,7 @@ void cmGlobalXCodeGenerator::AddExtraTargets( cmTarget::POST_BUILD, "Depend check for xcode", dir.c_str()); } - if (target->GetType() != cmState::INTERFACE_LIBRARY && + if (target->GetType() != cmStateEnums::INTERFACE_LIBRARY && !target->GetPropertyAsBool("EXCLUDE_FROM_ALL")) { allbuild->AddUtility(target->GetName()); } @@ -955,12 +955,12 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets( continue; } - if (gtgt->GetType() == cmState::INTERFACE_LIBRARY) { + if (gtgt->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } - if (gtgt->GetType() == cmState::UTILITY || - gtgt->GetType() == cmState::GLOBAL_TARGET) { + if (gtgt->GetType() == cmStateEnums::UTILITY || + gtgt->GetType() == cmStateEnums::GLOBAL_TARGET) { cmXCodeObject* t = this->CreateUtilityTarget(gtgt); if (!t) { return false; @@ -1188,9 +1188,9 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguages() void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmGeneratorTarget* gtgt) { // This matters only for targets that link. - if (gtgt->GetType() != cmState::EXECUTABLE && - gtgt->GetType() != cmState::SHARED_LIBRARY && - gtgt->GetType() != cmState::MODULE_LIBRARY) { + if (gtgt->GetType() != cmStateEnums::EXECUTABLE && + gtgt->GetType() != cmStateEnums::SHARED_LIBRARY && + gtgt->GetType() != cmStateEnums::MODULE_LIBRARY) { return; } @@ -1268,7 +1268,7 @@ void cmGlobalXCodeGenerator::CreateCustomCommands( std::vector const& prelink = gtgt->GetPreLinkCommands(); std::vector postbuild = gtgt->GetPostBuildCommands(); - if (gtgt->GetType() == cmState::SHARED_LIBRARY && + if (gtgt->GetType() == cmStateEnums::SHARED_LIBRARY && !gtgt->IsFrameworkOnApple()) { cmCustomCommandLines cmd; cmd.resize(1); @@ -1590,16 +1590,16 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, cmXCodeObject* buildSettings, const std::string& configName) { - if (gtgt->GetType() == cmState::INTERFACE_LIBRARY) { + if (gtgt->GetType() == cmStateEnums::INTERFACE_LIBRARY) { return; } std::string defFlags; - bool shared = ((gtgt->GetType() == cmState::SHARED_LIBRARY) || - (gtgt->GetType() == cmState::MODULE_LIBRARY)); - bool binary = ((gtgt->GetType() == cmState::OBJECT_LIBRARY) || - (gtgt->GetType() == cmState::STATIC_LIBRARY) || - (gtgt->GetType() == cmState::EXECUTABLE) || shared); + bool shared = ((gtgt->GetType() == cmStateEnums::SHARED_LIBRARY) || + (gtgt->GetType() == cmStateEnums::MODULE_LIBRARY)); + bool binary = ((gtgt->GetType() == cmStateEnums::OBJECT_LIBRARY) || + (gtgt->GetType() == cmStateEnums::STATIC_LIBRARY) || + (gtgt->GetType() == cmStateEnums::EXECUTABLE) || shared); // Compute the compilation flags for each language. std::set languages; @@ -1653,11 +1653,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, std::string extraLinkOptionsVar; std::string extraLinkOptions; - if (gtgt->GetType() == cmState::EXECUTABLE) { + if (gtgt->GetType() == cmStateEnums::EXECUTABLE) { extraLinkOptionsVar = "CMAKE_EXE_LINKER_FLAGS"; - } else if (gtgt->GetType() == cmState::SHARED_LIBRARY) { + } else if (gtgt->GetType() == cmStateEnums::SHARED_LIBRARY) { extraLinkOptionsVar = "CMAKE_SHARED_LINKER_FLAGS"; - } else if (gtgt->GetType() == cmState::MODULE_LIBRARY) { + } else if (gtgt->GetType() == cmStateEnums::MODULE_LIBRARY) { extraLinkOptionsVar = "CMAKE_MODULE_LINKER_FLAGS"; } if (!extraLinkOptionsVar.empty()) { @@ -1665,8 +1665,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, extraLinkOptions, extraLinkOptionsVar, configName); } - if (gtgt->GetType() == cmState::OBJECT_LIBRARY || - gtgt->GetType() == cmState::STATIC_LIBRARY) { + if (gtgt->GetType() == cmStateEnums::OBJECT_LIBRARY || + gtgt->GetType() == cmStateEnums::STATIC_LIBRARY) { this->CurrentLocalGenerator->GetStaticLibraryFlags( extraLinkOptions, cmSystemTools::UpperCase(configName), gtgt); } else { @@ -1736,10 +1736,10 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, // Set attributes to specify the proper name for the target. std::string pndir = this->CurrentLocalGenerator->GetCurrentBinaryDirectory(); - if (gtgt->GetType() == cmState::STATIC_LIBRARY || - gtgt->GetType() == cmState::SHARED_LIBRARY || - gtgt->GetType() == cmState::MODULE_LIBRARY || - gtgt->GetType() == cmState::EXECUTABLE) { + if (gtgt->GetType() == cmStateEnums::STATIC_LIBRARY || + gtgt->GetType() == cmStateEnums::SHARED_LIBRARY || + gtgt->GetType() == cmStateEnums::MODULE_LIBRARY || + gtgt->GetType() == cmStateEnums::EXECUTABLE) { if (this->XcodeVersion >= 21) { if (!gtgt->UsesDefaultOutputDir(configName, false)) { std::string pncdir = gtgt->GetDirectory(configName); @@ -1759,7 +1759,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, this->CreateString(pnprefix)); buildSettings->AddAttribute("EXECUTABLE_SUFFIX", this->CreateString(pnsuffix)); - } else if (gtgt->GetType() == cmState::OBJECT_LIBRARY) { + } else if (gtgt->GetType() == cmStateEnums::OBJECT_LIBRARY) { pnprefix = "lib"; pnbase = gtgt->GetName(); pnsuffix = ".a"; @@ -1782,14 +1782,14 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, // Handle settings for each target type. switch (gtgt->GetType()) { - case cmState::OBJECT_LIBRARY: - case cmState::STATIC_LIBRARY: { + case cmStateEnums::OBJECT_LIBRARY: + case cmStateEnums::STATIC_LIBRARY: { buildSettings->AddAttribute("LIBRARY_STYLE", this->CreateString("STATIC")); break; } - case cmState::MODULE_LIBRARY: { + case cmStateEnums::MODULE_LIBRARY: { buildSettings->AddAttribute("LIBRARY_STYLE", this->CreateString("BUNDLE")); if (gtgt->IsCFBundleOnApple()) { @@ -1839,7 +1839,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, } break; } - case cmState::SHARED_LIBRARY: { + case cmStateEnums::SHARED_LIBRARY: { if (gtgt->GetPropertyAsBool("FRAMEWORK")) { std::string fw_version = gtgt->GetFrameworkVersion(); buildSettings->AddAttribute("FRAMEWORK_VERSION", @@ -1872,7 +1872,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, this->CreateString("DYNAMIC")); break; } - case cmState::EXECUTABLE: { + case cmStateEnums::EXECUTABLE: { // Add the flags to create an executable. std::string createFlags = this->LookupFlags("CMAKE_", llang, "_LINK_FLAGS", ""); @@ -2051,7 +2051,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, // Create the INSTALL_PATH attribute. std::string install_name_dir; - if (gtgt->GetType() == cmState::SHARED_LIBRARY) { + if (gtgt->GetType() == cmStateEnums::SHARED_LIBRARY) { // Get the install_name directory for the build tree. install_name_dir = gtgt->GetInstallNameDirForBuildTree(configName); // Xcode doesn't create the correct install_name in some cases. @@ -2124,7 +2124,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, } // Runtime version information. - if (gtgt->GetType() == cmState::SHARED_LIBRARY) { + if (gtgt->GetType() == cmStateEnums::SHARED_LIBRARY) { int major; int minor; int patch; @@ -2219,7 +2219,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateUtilityTarget( this->XCodeObjectMap[gtgt] = target; // Add source files without build rules for editing convenience. - if (gtgt->GetType() == cmState::UTILITY) { + if (gtgt->GetType() == cmStateEnums::UTILITY) { std::vector sources; if (!gtgt->GetConfigCommonSourceFiles(sources)) { return 0; @@ -2285,8 +2285,8 @@ const char* cmGlobalXCodeGenerator::GetTargetLinkFlagsVar( cmGeneratorTarget const* target) const { if (this->XcodeVersion >= 60 && - (target->GetType() == cmState::STATIC_LIBRARY || - target->GetType() == cmState::OBJECT_LIBRARY)) { + (target->GetType() == cmStateEnums::STATIC_LIBRARY || + target->GetType() == cmStateEnums::OBJECT_LIBRARY)) { return "OTHER_LIBTOOLFLAGS"; } else { return "OTHER_LDFLAGS"; @@ -2297,10 +2297,10 @@ const char* cmGlobalXCodeGenerator::GetTargetFileType( cmGeneratorTarget* target) { switch (target->GetType()) { - case cmState::OBJECT_LIBRARY: - case cmState::STATIC_LIBRARY: + case cmStateEnums::OBJECT_LIBRARY: + case cmStateEnums::STATIC_LIBRARY: return "archive.ar"; - case cmState::MODULE_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: if (target->IsXCTestOnApple()) return "wrapper.cfbundle"; else if (target->IsCFBundleOnApple()) @@ -2308,11 +2308,11 @@ const char* cmGlobalXCodeGenerator::GetTargetFileType( else return ((this->XcodeVersion >= 22) ? "compiled.mach-o.executable" : "compiled.mach-o.dylib"); - case cmState::SHARED_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: return (target->GetPropertyAsBool("FRAMEWORK") ? "wrapper.framework" : "compiled.mach-o.dylib"); - case cmState::EXECUTABLE: + case cmStateEnums::EXECUTABLE: return "compiled.mach-o.executable"; default: break; @@ -2324,10 +2324,10 @@ const char* cmGlobalXCodeGenerator::GetTargetProductType( cmGeneratorTarget* target) { switch (target->GetType()) { - case cmState::OBJECT_LIBRARY: - case cmState::STATIC_LIBRARY: + case cmStateEnums::OBJECT_LIBRARY: + case cmStateEnums::STATIC_LIBRARY: return "com.apple.product-type.library.static"; - case cmState::MODULE_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: if (target->IsXCTestOnApple()) return "com.apple.product-type.bundle.unit-test"; else if (target->IsCFBundleOnApple()) @@ -2336,11 +2336,11 @@ const char* cmGlobalXCodeGenerator::GetTargetProductType( return ((this->XcodeVersion >= 22) ? "com.apple.product-type.tool" : "com.apple.product-type.library.dynamic"); - case cmState::SHARED_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: return (target->GetPropertyAsBool("FRAMEWORK") ? "com.apple.product-type.framework" : "com.apple.product-type.library.dynamic"); - case cmState::EXECUTABLE: + case cmStateEnums::EXECUTABLE: return (target->GetPropertyAsBool("MACOSX_BUNDLE") ? "com.apple.product-type.application" : "com.apple.product-type.tool"); @@ -2353,7 +2353,7 @@ const char* cmGlobalXCodeGenerator::GetTargetProductType( cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeTarget( cmGeneratorTarget* gtgt, cmXCodeObject* buildPhases) { - if (gtgt->GetType() == cmState::INTERFACE_LIBRARY) { + if (gtgt->GetType() == cmStateEnums::INTERFACE_LIBRARY) { return 0; } cmXCodeObject* target = this->CreateObject(cmXCodeObject::PBXNativeTarget); @@ -2380,7 +2380,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeTarget( fileRef->AddAttribute("explicitFileType", this->CreateString(fileType)); } std::string fullName; - if (gtgt->GetType() == cmState::OBJECT_LIBRARY) { + if (gtgt->GetType() == cmStateEnums::OBJECT_LIBRARY) { fullName = "lib"; fullName += gtgt->GetName(); fullName += ".a"; @@ -2527,7 +2527,7 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target) cmSystemTools::Error("Error no target on xobject\n"); return; } - if (gt->GetType() == cmState::INTERFACE_LIBRARY) { + if (gt->GetType() == cmStateEnums::INTERFACE_LIBRARY) { return; } @@ -2564,8 +2564,8 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target) } // Skip link information for object libraries. - if (gt->GetType() == cmState::OBJECT_LIBRARY || - gt->GetType() == cmState::STATIC_LIBRARY) { + if (gt->GetType() == cmStateEnums::OBJECT_LIBRARY || + gt->GetType() == cmStateEnums::STATIC_LIBRARY) { continue; } @@ -2620,7 +2620,7 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target) if (li->IsPath) { linkLibs += this->XCodeEscapePath(li->Value); } else if (!li->Target || - li->Target->GetType() != cmState::INTERFACE_LIBRARY) { + li->Target->GetType() != cmStateEnums::INTERFACE_LIBRARY) { linkLibs += li->Value; } if (li->Target && !li->Target->IsImported()) { @@ -2649,10 +2649,10 @@ bool cmGlobalXCodeGenerator::CreateGroups( // end up with (empty anyhow) ALL_BUILD and XCODE_DEPEND_HELPER source // groups: // - if (gtgt->GetType() == cmState::GLOBAL_TARGET) { + if (gtgt->GetType() == cmStateEnums::GLOBAL_TARGET) { continue; } - if (gtgt->GetType() == cmState::INTERFACE_LIBRARY) { + if (gtgt->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } @@ -3149,20 +3149,20 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( cmXCodeObject* target = *i; cmGeneratorTarget* gt = target->GetTarget(); - if (gt->GetType() == cmState::EXECUTABLE || + if (gt->GetType() == cmStateEnums::EXECUTABLE || // Nope - no post-build for OBJECT_LIRBRARY - // gt->GetType() == cmState::OBJECT_LIBRARY || - gt->GetType() == cmState::STATIC_LIBRARY || - gt->GetType() == cmState::SHARED_LIBRARY || - gt->GetType() == cmState::MODULE_LIBRARY) { + // gt->GetType() == cmStateEnums::OBJECT_LIBRARY || + gt->GetType() == cmStateEnums::STATIC_LIBRARY || + gt->GetType() == cmStateEnums::SHARED_LIBRARY || + gt->GetType() == cmStateEnums::MODULE_LIBRARY) { // Declare an entry point for the target post-build phase. makefileStream << this->PostBuildMakeTarget(gt->GetName(), *ct) << ":\n"; } - if (gt->GetType() == cmState::EXECUTABLE || - gt->GetType() == cmState::SHARED_LIBRARY || - gt->GetType() == cmState::MODULE_LIBRARY) { + if (gt->GetType() == cmStateEnums::EXECUTABLE || + gt->GetType() == cmStateEnums::SHARED_LIBRARY || + gt->GetType() == cmStateEnums::MODULE_LIBRARY) { std::string tfull = gt->GetFullPath(configName); std::string trel = this->ConvertToRelativeForMake(tfull.c_str()); diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index db11bd3..6b32f73 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -24,13 +24,13 @@ static const char* getShapeForTarget(const cmGeneratorTarget* target) } switch (target->GetType()) { - case cmState::EXECUTABLE: + case cmStateEnums::EXECUTABLE: return "house"; - case cmState::STATIC_LIBRARY: + case cmStateEnums::STATIC_LIBRARY: return "diamond"; - case cmState::SHARED_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: return "polygon"; - case cmState::MODULE_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: return "octagon"; default: break; @@ -495,16 +495,16 @@ bool cmGraphVizWriter::IgnoreThisTarget(const std::string& name) } bool cmGraphVizWriter::GenerateForTargetType( - cmState::TargetType targetType) const + cmStateEnums::TargetType targetType) const { switch (targetType) { - case cmState::EXECUTABLE: + case cmStateEnums::EXECUTABLE: return this->GenerateForExecutables; - case cmState::STATIC_LIBRARY: + case cmStateEnums::STATIC_LIBRARY: return this->GenerateForStaticLibs; - case cmState::SHARED_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: return this->GenerateForSharedLibs; - case cmState::MODULE_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: return this->GenerateForModuleLibs; default: break; diff --git a/Source/cmGraphVizWriter.h b/Source/cmGraphVizWriter.h index 0efe2b7..8d5515b 100644 --- a/Source/cmGraphVizWriter.h +++ b/Source/cmGraphVizWriter.h @@ -60,7 +60,7 @@ protected: bool IgnoreThisTarget(const std::string& name); - bool GenerateForTargetType(cmState::TargetType targetType) const; + bool GenerateForTargetType(cmStateEnums::TargetType targetType) const; std::string GraphType; std::string GraphName; diff --git a/Source/cmIncludeExternalMSProjectCommand.cxx b/Source/cmIncludeExternalMSProjectCommand.cxx index 166bc7c..57bf33e 100644 --- a/Source/cmIncludeExternalMSProjectCommand.cxx +++ b/Source/cmIncludeExternalMSProjectCommand.cxx @@ -70,8 +70,8 @@ bool cmIncludeExternalMSProjectCommand::InitialPass( } // Create a target instance for this utility. - cmTarget* target = - this->Makefile->AddNewTarget(cmState::UTILITY, utility_name.c_str()); + cmTarget* target = this->Makefile->AddNewTarget(cmStateEnums::UTILITY, + utility_name.c_str()); target->SetProperty("GENERATOR_FILE_NAME", utility_name.c_str()); target->SetProperty("EXTERNAL_MSPROJECT", path.c_str()); diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index f040a4e..d85748e 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -327,19 +327,19 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) if (cmTarget* target = this->Makefile->FindLocalNonAliasTarget(*targetIt)) { // Found the target. Check its type. - if (target->GetType() != cmState::EXECUTABLE && - target->GetType() != cmState::STATIC_LIBRARY && - target->GetType() != cmState::SHARED_LIBRARY && - target->GetType() != cmState::MODULE_LIBRARY && - target->GetType() != cmState::OBJECT_LIBRARY && - target->GetType() != cmState::INTERFACE_LIBRARY) { + if (target->GetType() != cmStateEnums::EXECUTABLE && + target->GetType() != cmStateEnums::STATIC_LIBRARY && + target->GetType() != cmStateEnums::SHARED_LIBRARY && + target->GetType() != cmStateEnums::MODULE_LIBRARY && + target->GetType() != cmStateEnums::OBJECT_LIBRARY && + target->GetType() != cmStateEnums::INTERFACE_LIBRARY) { std::ostringstream e; e << "TARGETS given target \"" << (*targetIt) << "\" which is not an executable, library, or module."; this->SetError(e.str()); return false; } - if (target->GetType() == cmState::OBJECT_LIBRARY) { + if (target->GetType() == cmStateEnums::OBJECT_LIBRARY) { std::ostringstream e; e << "TARGETS given OBJECT library \"" << (*targetIt) << "\" which may not be installed."; @@ -387,7 +387,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) bool namelinkOnly = false; switch (target.GetType()) { - case cmState::SHARED_LIBRARY: { + case cmStateEnums::SHARED_LIBRARY: { // Shared libraries are handled differently on DLL and non-DLL // platforms. All windows platforms are DLL platforms including // cygwin. Currently no other platform is a DLL platform. @@ -454,7 +454,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) } } } break; - case cmState::STATIC_LIBRARY: { + case cmStateEnums::STATIC_LIBRARY: { // Static libraries use ARCHIVE properties. if (!archiveArgs.GetDestination().empty()) { archiveGenerator = @@ -468,7 +468,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) return false; } } break; - case cmState::MODULE_LIBRARY: { + case cmStateEnums::MODULE_LIBRARY: { // Modules use LIBRARY properties. if (!libraryArgs.GetDestination().empty()) { libraryGenerator = @@ -484,7 +484,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) return false; } } break; - case cmState::EXECUTABLE: { + case cmStateEnums::EXECUTABLE: { if (target.IsAppBundleOnApple()) { // Application bundles use the BUNDLE properties. if (!bundleArgs.GetDestination().empty()) { @@ -534,7 +534,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) CreateInstallTargetGenerator(target, archiveArgs, true, true); } } break; - case cmState::INTERFACE_LIBRARY: + case cmStateEnums::INTERFACE_LIBRARY: // Nothing to do. An INTERFACE_LIBRARY can be installed, but the // only effect of that is to make it exportable. It installs no // other files itself. @@ -553,7 +553,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) bool createInstallGeneratorsForTargetFileSets = true; if (target.IsFrameworkOnApple() || - target.GetType() == cmState::INTERFACE_LIBRARY) { + target.GetType() == cmStateEnums::INTERFACE_LIBRARY) { createInstallGeneratorsForTargetFileSets = false; } diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 70ae204..ed3be3f 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -80,36 +80,36 @@ void cmInstallTargetGenerator::GenerateScriptForConfig( std::vector filesFrom; std::vector filesTo; std::string literal_args; - cmState::TargetType targetType = this->Target->GetType(); + cmStateEnums::TargetType targetType = this->Target->GetType(); cmInstallType type = cmInstallType(); switch (targetType) { - case cmState::EXECUTABLE: + case cmStateEnums::EXECUTABLE: type = cmInstallType_EXECUTABLE; break; - case cmState::STATIC_LIBRARY: + case cmStateEnums::STATIC_LIBRARY: type = cmInstallType_STATIC_LIBRARY; break; - case cmState::SHARED_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: type = cmInstallType_SHARED_LIBRARY; break; - case cmState::MODULE_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: type = cmInstallType_MODULE_LIBRARY; break; - case cmState::INTERFACE_LIBRARY: + case cmStateEnums::INTERFACE_LIBRARY: // Not reachable. We never create a cmInstallTargetGenerator for // an INTERFACE_LIBRARY. assert(0 && "INTERFACE_LIBRARY targets have no installable outputs."); break; - case cmState::OBJECT_LIBRARY: - case cmState::UTILITY: - case cmState::GLOBAL_TARGET: - case cmState::UNKNOWN_LIBRARY: + case cmStateEnums::OBJECT_LIBRARY: + case cmStateEnums::UTILITY: + case cmStateEnums::GLOBAL_TARGET: + case cmStateEnums::UNKNOWN_LIBRARY: this->Target->GetLocalGenerator()->IssueMessage( cmake::INTERNAL_ERROR, "cmInstallTargetGenerator created with non-installable target."); return; } - if (targetType == cmState::EXECUTABLE) { + if (targetType == cmStateEnums::EXECUTABLE) { // There is a bug in cmInstallCommand if this fails. assert(this->NamelinkMode == NamelinkModeNone); @@ -337,7 +337,7 @@ std::string cmInstallTargetGenerator::GetInstallFilename( { std::string fname; // Compute the name of the library. - if (target->GetType() == cmState::EXECUTABLE) { + if (target->GetType() == cmStateEnums::EXECUTABLE) { std::string targetName; std::string targetNameReal; std::string targetNameImport; @@ -471,9 +471,9 @@ void cmInstallTargetGenerator::AddInstallNamePatchRule( std::string const& toDestDirPath) { if (this->ImportLibrary || - !(this->Target->GetType() == cmState::SHARED_LIBRARY || - this->Target->GetType() == cmState::MODULE_LIBRARY || - this->Target->GetType() == cmState::EXECUTABLE)) { + !(this->Target->GetType() == cmStateEnums::SHARED_LIBRARY || + this->Target->GetType() == cmStateEnums::MODULE_LIBRARY || + this->Target->GetType() == cmStateEnums::EXECUTABLE)) { return; } @@ -527,7 +527,7 @@ void cmInstallTargetGenerator::AddInstallNamePatchRule( // Edit the install_name of the target itself if necessary. std::string new_id; - if (this->Target->GetType() == cmState::SHARED_LIBRARY) { + if (this->Target->GetType() == cmStateEnums::SHARED_LIBRARY) { std::string for_build = this->Target->GetInstallNameDirForBuildTree(config); std::string for_install = this->Target->GetInstallNameDirForInstallTree(); @@ -704,7 +704,7 @@ void cmInstallTargetGenerator::AddStripRule(std::ostream& os, // don't strip static and import libraries, because it removes the only // symbol table they have so you can't link to them anymore - if (this->Target->GetType() == cmState::STATIC_LIBRARY || + if (this->Target->GetType() == cmStateEnums::STATIC_LIBRARY || this->ImportLibrary) { return; } @@ -731,7 +731,7 @@ void cmInstallTargetGenerator::AddRanlibRule(std::ostream& os, const std::string& toDestDirPath) { // Static libraries need ranlib on this platform. - if (this->Target->GetType() != cmState::STATIC_LIBRARY) { + if (this->Target->GetType() != cmStateEnums::STATIC_LIBRARY) { return; } @@ -767,10 +767,10 @@ void cmInstallTargetGenerator::AddUniversalInstallRule( } switch (this->Target->GetType()) { - case cmState::EXECUTABLE: - case cmState::STATIC_LIBRARY: - case cmState::SHARED_LIBRARY: - case cmState::MODULE_LIBRARY: + case cmStateEnums::EXECUTABLE: + case cmStateEnums::STATIC_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: break; default: diff --git a/Source/cmLinkLineComputer.cxx b/Source/cmLinkLineComputer.cxx index 24f3578..5fc861b 100644 --- a/Source/cmLinkLineComputer.cxx +++ b/Source/cmLinkLineComputer.cxx @@ -55,7 +55,8 @@ std::string cmLinkLineComputer::ComputeLinkLibs(cmComputeLinkInformation& cli) ItemVector const& items = cli.GetItems(); for (ItemVector::const_iterator li = items.begin(); li != items.end(); ++li) { - if (li->Target && li->Target->GetType() == cmState::INTERFACE_LIBRARY) { + if (li->Target && + li->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } if (li->IsPath) { diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 1c3a97d..b6fb3e6 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -199,7 +199,7 @@ void cmLocalGenerator::TraceDependencies() std::vector targets = this->GetGeneratorTargets(); for (std::vector::iterator t = targets.begin(); t != targets.end(); ++t) { - if ((*t)->GetType() == cmState::INTERFACE_LIBRARY) { + if ((*t)->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } (*t)->TraceDependencies(); @@ -542,7 +542,7 @@ void cmLocalGenerator::ComputeTargetManifest() for (std::vector::iterator t = targets.begin(); t != targets.end(); ++t) { cmGeneratorTarget* target = *t; - if (target->GetType() == cmState::INTERFACE_LIBRARY) { + if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } for (std::vector::iterator ci = configNames.begin(); @@ -911,12 +911,12 @@ void cmLocalGenerator::GetTargetFlags( "CMAKE_SHARED_LINKER_FLAGS"; // default to shared library switch (target->GetType()) { - case cmState::STATIC_LIBRARY: + case cmStateEnums::STATIC_LIBRARY: this->GetStaticLibraryFlags(linkFlags, buildType, target); break; - case cmState::MODULE_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: libraryLinkVariable = "CMAKE_MODULE_LINKER_FLAGS"; - case cmState::SHARED_LIBRARY: { + case cmStateEnums::SHARED_LIBRARY: { linkFlags = this->Makefile->GetSafeDefinition(libraryLinkVariable); linkFlags += " "; if (!buildType.empty()) { @@ -962,7 +962,7 @@ void cmLocalGenerator::GetTargetFlags( frameworkPath, linkPath); } } break; - case cmState::EXECUTABLE: { + case cmStateEnums::EXECUTABLE: { linkFlags += this->Makefile->GetSafeDefinition("CMAKE_EXE_LINKER_FLAGS"); linkFlags += " "; if (!buildType.empty()) { @@ -1189,7 +1189,7 @@ std::string cmLocalGenerator::GetLinkLibsCMP0065( std::string linkFlags; // Flags to link an executable to shared libraries. - if (tgt.GetType() == cmState::EXECUTABLE && + if (tgt.GetType() == cmStateEnums::EXECUTABLE && this->StateSnapshot.GetState()->GetGlobalPropertyAsBool( "TARGET_SUPPORTS_SHARED_LIBS")) { bool add_shlib_flags = false; @@ -1334,8 +1334,8 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName, // found is part of the inName if (cmSystemTools::FileIsFullPath(inName.c_str())) { std::string tLocation; - if (target->GetType() >= cmState::EXECUTABLE && - target->GetType() <= cmState::MODULE_LIBRARY) { + if (target->GetType() >= cmStateEnums::EXECUTABLE && + target->GetType() <= cmStateEnums::MODULE_LIBRARY) { tLocation = target->GetLocation(config); tLocation = cmSystemTools::GetFilenamePath(tLocation); tLocation = cmSystemTools::CollapseFullPath(tLocation); @@ -1352,23 +1352,23 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName, } } switch (target->GetType()) { - case cmState::EXECUTABLE: - case cmState::STATIC_LIBRARY: - case cmState::SHARED_LIBRARY: - case cmState::MODULE_LIBRARY: - case cmState::UNKNOWN_LIBRARY: + case cmStateEnums::EXECUTABLE: + case cmStateEnums::STATIC_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: + case cmStateEnums::UNKNOWN_LIBRARY: dep = target->GetLocation(config); return true; - case cmState::OBJECT_LIBRARY: + case cmStateEnums::OBJECT_LIBRARY: // An object library has no single file on which to depend. // This was listed to get the target-level dependency. return false; - case cmState::INTERFACE_LIBRARY: + case cmStateEnums::INTERFACE_LIBRARY: // An interface library has no file on which to depend. // This was listed to get the target-level dependency. return false; - case cmState::UTILITY: - case cmState::GLOBAL_TARGET: + case cmStateEnums::UTILITY: + case cmStateEnums::GLOBAL_TARGET: // A utility target has no file on which to depend. This was listed // only to get the target-level dependency. return false; @@ -1584,8 +1584,8 @@ void cmLocalGenerator::AddVisibilityPresetFlags( std::string warnCMP0063; std::string* pWarnCMP0063 = CM_NULLPTR; - if (target->GetType() != cmState::SHARED_LIBRARY && - target->GetType() != cmState::MODULE_LIBRARY && + if (target->GetType() != cmStateEnums::SHARED_LIBRARY && + target->GetType() != cmStateEnums::MODULE_LIBRARY && !target->IsExecutableWithExports()) { switch (target->GetPolicyStatusCMP0063()) { case cmPolicies::OLD: @@ -1627,13 +1627,13 @@ void cmLocalGenerator::AddCMP0018Flags(std::string& flags, { int targetType = target->GetType(); - bool shared = ((targetType == cmState::SHARED_LIBRARY) || - (targetType == cmState::MODULE_LIBRARY)); + bool shared = ((targetType == cmStateEnums::SHARED_LIBRARY) || + (targetType == cmStateEnums::MODULE_LIBRARY)); if (this->GetShouldUseOldFlags(shared, lang)) { this->AddSharedFlags(flags, lang, shared); } else { - if (target->GetType() == cmState::OBJECT_LIBRARY) { + if (target->GetType() == cmStateEnums::OBJECT_LIBRARY) { if (target->GetPropertyAsBool("POSITION_INDEPENDENT_CODE")) { this->AddPositionIndependentFlags(flags, lang, targetType); } @@ -1696,7 +1696,7 @@ void cmLocalGenerator::AddPositionIndependentFlags(std::string& flags, { const char* picFlags = CM_NULLPTR; - if (targetType == cmState::EXECUTABLE) { + if (targetType == cmStateEnums::EXECUTABLE) { std::string flagsVar = "CMAKE_"; flagsVar += lang; flagsVar += "_COMPILE_OPTIONS_PIE"; @@ -1933,7 +1933,7 @@ void cmLocalGenerator::GenerateTargetInstallRules( std::vector tgts = this->GetGeneratorTargets(); for (std::vector::iterator l = tgts.begin(); l != tgts.end(); ++l) { - if ((*l)->GetType() == cmState::INTERFACE_LIBRARY) { + if ((*l)->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } @@ -1956,15 +1956,15 @@ void cmLocalGenerator::GenerateTargetInstallRules( // Generate the proper install generator for this target type. switch ((*l)->GetType()) { - case cmState::EXECUTABLE: - case cmState::STATIC_LIBRARY: - case cmState::MODULE_LIBRARY: { + case cmStateEnums::EXECUTABLE: + case cmStateEnums::STATIC_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: { // Use a target install generator. cmInstallTargetGeneratorLocal g(this, (*l)->GetName(), destination.c_str(), false); g.Generate(os, config, configurationTypes); } break; - case cmState::SHARED_LIBRARY: { + case cmStateEnums::SHARED_LIBRARY: { #if defined(_WIN32) || defined(__CYGWIN__) // Special code to handle DLL. Install the import library // to the normal destination and the DLL to the runtime diff --git a/Source/cmLocalGhsMultiGenerator.cxx b/Source/cmLocalGhsMultiGenerator.cxx index 157b32e..5f37af5 100644 --- a/Source/cmLocalGhsMultiGenerator.cxx +++ b/Source/cmLocalGhsMultiGenerator.cxx @@ -24,7 +24,7 @@ void cmLocalGhsMultiGenerator::Generate() for (std::vector::iterator l = tgts.begin(); l != tgts.end(); ++l) { - if ((*l)->GetType() == cmState::INTERFACE_LIBRARY) { + if ((*l)->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } cmGhsMultiTargetGenerator tg(*l); diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 1863376..232e1dc 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -81,7 +81,7 @@ void cmLocalNinjaGenerator::Generate() std::vector targets = this->GetGeneratorTargets(); for (std::vector::iterator t = targets.begin(); t != targets.end(); ++t) { - if ((*t)->GetType() == cmState::INTERFACE_LIBRARY) { + if ((*t)->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } cmNinjaTargetGenerator* tg = cmNinjaTargetGenerator::New(*t); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index f30414c..5b90f99 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -120,7 +120,7 @@ void cmLocalUnixMakefileGenerator3::Generate() static_cast(this->GlobalGenerator); for (std::vector::iterator t = targets.begin(); t != targets.end(); ++t) { - if ((*t)->GetType() == cmState::INTERFACE_LIBRARY) { + if ((*t)->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } CM_AUTO_PTR tg( @@ -172,7 +172,7 @@ void cmLocalUnixMakefileGenerator3::GetLocalObjectFiles( for (std::vector::iterator ti = targets.begin(); ti != targets.end(); ++ti) { cmGeneratorTarget* gt = *ti; - if (gt->GetType() == cmState::INTERFACE_LIBRARY) { + if (gt->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } std::vector objectSources; @@ -382,12 +382,12 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets( std::string localName; for (std::vector::iterator t = targets.begin(); t != targets.end(); ++t) { - if (((*t)->GetType() == cmState::EXECUTABLE) || - ((*t)->GetType() == cmState::STATIC_LIBRARY) || - ((*t)->GetType() == cmState::SHARED_LIBRARY) || - ((*t)->GetType() == cmState::MODULE_LIBRARY) || - ((*t)->GetType() == cmState::OBJECT_LIBRARY) || - ((*t)->GetType() == cmState::UTILITY)) { + if (((*t)->GetType() == cmStateEnums::EXECUTABLE) || + ((*t)->GetType() == cmStateEnums::STATIC_LIBRARY) || + ((*t)->GetType() == cmStateEnums::SHARED_LIBRARY) || + ((*t)->GetType() == cmStateEnums::MODULE_LIBRARY) || + ((*t)->GetType() == cmStateEnums::OBJECT_LIBRARY) || + ((*t)->GetType() == cmStateEnums::UTILITY)) { emitted.insert((*t)->GetName()); // for subdirs add a rule to build this specific target by name. @@ -1558,7 +1558,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules( std::vector targets = this->GetGeneratorTargets(); std::vector::iterator glIt; for (glIt = targets.begin(); glIt != targets.end(); ++glIt) { - if ((*glIt)->GetType() == cmState::GLOBAL_TARGET) { + if ((*glIt)->GetType() == cmStateEnums::GLOBAL_TARGET) { std::string targetString = "Special rule for the target " + (*glIt)->GetName(); std::vector commands; diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx index 6f9f009..006cdf8 100644 --- a/Source/cmLocalVisualStudio10Generator.cxx +++ b/Source/cmLocalVisualStudio10Generator.cxx @@ -63,7 +63,7 @@ void cmLocalVisualStudio10Generator::Generate() std::vector tgts = this->GetGeneratorTargets(); for (std::vector::iterator l = tgts.begin(); l != tgts.end(); ++l) { - if ((*l)->GetType() == cmState::INTERFACE_LIBRARY) { + if ((*l)->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } if (static_cast(this->GlobalGenerator) diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index a4b28b5..1ea56b4 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -64,7 +64,7 @@ void cmLocalVisualStudio7Generator::AddHelperCommands() std::vector tgts = this->GetGeneratorTargets(); for (std::vector::iterator l = tgts.begin(); l != tgts.end(); ++l) { - if ((*l)->GetType() == cmState::INTERFACE_LIBRARY) { + if ((*l)->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } const char* path = (*l)->GetProperty("EXTERNAL_MSPROJECT"); @@ -93,7 +93,7 @@ void cmLocalVisualStudio7Generator::AddCMakeListsRules() std::vector tgts = this->GetGeneratorTargets(); for (std::vector::iterator l = tgts.begin(); l != tgts.end(); ++l) { - if ((*l)->GetType() == cmState::GLOBAL_TARGET) { + if ((*l)->GetType() == cmStateEnums::GLOBAL_TARGET) { continue; } if ((*l)->GetName() != CMAKE_CHECK_BUILD_SYSTEM_TARGET) { @@ -112,7 +112,7 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets() std::vector tgts = this->GetGeneratorTargets(); for (std::vector::iterator l = tgts.begin(); l != tgts.end(); l++) { - if ((*l)->GetType() == cmState::GLOBAL_TARGET) { + if ((*l)->GetType() == cmStateEnums::GLOBAL_TARGET) { std::vector no_depends; cmCustomCommandLine force_command; force_command.push_back("cd"); @@ -154,7 +154,7 @@ void cmLocalVisualStudio7Generator::WriteProjectFiles() // Create the project file for each target. for (std::vector::iterator l = tgts.begin(); l != tgts.end(); l++) { - if ((*l)->GetType() == cmState::INTERFACE_LIBRARY) { + if ((*l)->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } // INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace @@ -615,22 +615,22 @@ void cmLocalVisualStudio7Generator::WriteConfiguration( bool targetBuilds = true; switch (target->GetType()) { - case cmState::OBJECT_LIBRARY: + case cmStateEnums::OBJECT_LIBRARY: targetBuilds = false; // no manifest tool for object library - case cmState::STATIC_LIBRARY: + case cmStateEnums::STATIC_LIBRARY: projectType = "typeStaticLibrary"; configType = "4"; break; - case cmState::SHARED_LIBRARY: - case cmState::MODULE_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: projectType = "typeDynamicLibrary"; configType = "2"; break; - case cmState::EXECUTABLE: + case cmStateEnums::EXECUTABLE: configType = "1"; break; - case cmState::UTILITY: - case cmState::GLOBAL_TARGET: + case cmStateEnums::UTILITY: + case cmStateEnums::GLOBAL_TARGET: configType = "10"; default: targetBuilds = false; @@ -725,8 +725,9 @@ void cmLocalVisualStudio7Generator::WriteConfiguration( intermediateDir += "/"; intermediateDir += configName; - if (target->GetType() < cmState::UTILITY) { - std::string const& outDir = target->GetType() == cmState::OBJECT_LIBRARY + if (target->GetType() < cmStateEnums::UTILITY) { + std::string const& outDir = + target->GetType() == cmStateEnums::OBJECT_LIBRARY ? intermediateDir : target->GetDirectory(configName); /* clang-format off */ @@ -810,7 +811,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration( targetOptions.OutputFlagMap(fout, "\t\t\t\t"); targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", "\n", "CXX"); fout << "\t\t\t\tObjectFile=\"$(IntDir)\\\"\n"; - if (target->GetType() <= cmState::OBJECT_LIBRARY) { + if (target->GetType() <= cmStateEnums::OBJECT_LIBRARY) { // Specify the compiler program database file if configured. std::string pdb = target->GetCompilePDBPath(configName); if (!pdb.empty()) { @@ -959,19 +960,19 @@ void cmLocalVisualStudio7Generator::OutputBuildTool( static_cast(this->GlobalGenerator); std::string temp; std::string extraLinkOptions; - if (target->GetType() == cmState::EXECUTABLE) { + if (target->GetType() == cmStateEnums::EXECUTABLE) { extraLinkOptions = this->Makefile->GetRequiredDefinition("CMAKE_EXE_LINKER_FLAGS") + std::string(" ") + GetBuildTypeLinkerFlags("CMAKE_EXE_LINKER_FLAGS", configName); } - if (target->GetType() == cmState::SHARED_LIBRARY) { + if (target->GetType() == cmStateEnums::SHARED_LIBRARY) { extraLinkOptions = this->Makefile->GetRequiredDefinition("CMAKE_SHARED_LINKER_FLAGS") + std::string(" ") + GetBuildTypeLinkerFlags("CMAKE_SHARED_LINKER_FLAGS", configName); } - if (target->GetType() == cmState::MODULE_LIBRARY) { + if (target->GetType() == cmStateEnums::MODULE_LIBRARY) { extraLinkOptions = this->Makefile->GetRequiredDefinition("CMAKE_MODULE_LINKER_FLAGS") + std::string(" ") + @@ -1004,7 +1005,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool( linkOptions.AddFlag("ModuleDefinitionFile", defFile.c_str()); } - if ((target->GetType() == cmState::SHARED_LIBRARY || + if ((target->GetType() == cmStateEnums::SHARED_LIBRARY || target->IsExecutableWithExports()) && this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) { if (target->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) { @@ -1012,9 +1013,9 @@ void cmLocalVisualStudio7Generator::OutputBuildTool( } } switch (target->GetType()) { - case cmState::UNKNOWN_LIBRARY: + case cmStateEnums::UNKNOWN_LIBRARY: break; - case cmState::OBJECT_LIBRARY: { + case cmStateEnums::OBJECT_LIBRARY: { std::string libpath = this->GetTargetDirectory(target); libpath += "/"; libpath += configName; @@ -1029,7 +1030,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool( << this->ConvertToXMLOutputPathSingle(libpath.c_str()) << "\"/>\n"; break; } - case cmState::STATIC_LIBRARY: { + case cmStateEnums::STATIC_LIBRARY: { std::string targetNameFull = target->GetFullName(configName); std::string libpath = target->GetDirectory(configName); libpath += "/"; @@ -1059,8 +1060,8 @@ void cmLocalVisualStudio7Generator::OutputBuildTool( << this->ConvertToXMLOutputPathSingle(libpath.c_str()) << "\"/>\n"; break; } - case cmState::SHARED_LIBRARY: - case cmState::MODULE_LIBRARY: { + case cmStateEnums::SHARED_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: { std::string targetName; std::string targetNameSO; std::string targetNameFull; @@ -1145,7 +1146,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool( } fout << "/>\n"; } break; - case cmState::EXECUTABLE: { + case cmStateEnums::EXECUTABLE: { std::string targetName; std::string targetNameFull; std::string targetNameImport; @@ -1241,9 +1242,9 @@ void cmLocalVisualStudio7Generator::OutputBuildTool( << this->ConvertToXMLOutputPathSingle(temp.c_str()) << "\"/>\n"; break; } - case cmState::UTILITY: - case cmState::GLOBAL_TARGET: - case cmState::INTERFACE_LIBRARY: + case cmStateEnums::UTILITY: + case cmStateEnums::GLOBAL_TARGET: + case cmStateEnums::INTERFACE_LIBRARY: break; } } @@ -1296,7 +1297,7 @@ void cmLocalVisualStudio7GeneratorInternals::OutputLibraries( lg->ConvertToRelativePath(currentBinDir, l->Value.c_str()); fout << lg->ConvertToXMLOutputPath(rel.c_str()) << " "; } else if (!l->Target || - l->Target->GetType() != cmState::INTERFACE_LIBRARY) { + l->Target->GetType() != cmStateEnums::INTERFACE_LIBRARY) { fout << l->Value << " "; } } @@ -1607,8 +1608,8 @@ bool cmLocalVisualStudio7Generator::WriteGroup( std::string source = (*sf)->GetFullPath(); FCInfo fcinfo(this, target, *(*sf), configs); - if (source != libName || target->GetType() == cmState::UTILITY || - target->GetType() == cmState::GLOBAL_TARGET) { + if (source != libName || target->GetType() == cmStateEnums::UTILITY || + target->GetType() == cmStateEnums::GLOBAL_TARGET) { fout << "\t\t\tConvertToXMLOutputPathSingle(source.c_str()); // Tell MS-Dev what the source is. If the compiler knows how to @@ -1812,7 +1813,7 @@ void cmLocalVisualStudio7Generator::OutputTargetRules( std::ostream& fout, const std::string& configName, cmGeneratorTarget* target, const std::string& /*libName*/) { - if (target->GetType() > cmState::GLOBAL_TARGET) { + if (target->GetType() > cmStateEnums::GLOBAL_TARGET) { return; } EventWriter event(this, configName, fout); @@ -1828,7 +1829,7 @@ void cmLocalVisualStudio7Generator::OutputTargetRules( tool = this->FortranProject ? "VFPreLinkEventTool" : "VCPreLinkEventTool"; event.Start(tool); bool addedPrelink = false; - if ((target->GetType() == cmState::SHARED_LIBRARY || + if ((target->GetType() == cmStateEnums::SHARED_LIBRARY || target->IsExecutableWithExports()) && this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) { if (target->GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) { @@ -1900,27 +1901,27 @@ void cmLocalVisualStudio7Generator::WriteProjectStartFortran( } const char* projectType = 0; switch (target->GetType()) { - case cmState::STATIC_LIBRARY: + case cmStateEnums::STATIC_LIBRARY: projectType = "typeStaticLibrary"; if (keyword) { keyword = "Static Library"; } break; - case cmState::SHARED_LIBRARY: - case cmState::MODULE_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: projectType = "typeDynamicLibrary"; if (!keyword) { keyword = "Dll"; } break; - case cmState::EXECUTABLE: + case cmStateEnums::EXECUTABLE: if (!keyword) { keyword = "Console Application"; } projectType = 0; break; - case cmState::UTILITY: - case cmState::GLOBAL_TARGET: + case cmStateEnums::UTILITY: + case cmStateEnums::GLOBAL_TARGET: default: break; } diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index e2b3cd2..e20fe50 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -76,8 +76,8 @@ cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmGeneratorTarget* target, // If an executable exports symbols then VS wants to create an // import library but forgets to create the output directory. // The Intel Fortran plugin always forgets to the directory. - if (target->GetType() != cmState::EXECUTABLE && - !(isFortran && target->GetType() == cmState::SHARED_LIBRARY)) { + if (target->GetType() != cmStateEnums::EXECUTABLE && + !(isFortran && target->GetType() == cmStateEnums::SHARED_LIBRARY)) { return pcc; } std::string outDir = target->GetDirectory(config, false); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index c3111c0..65116d5 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -730,7 +730,7 @@ void cmMakefile::AddCustomCommandToTarget( return; } - if (ti->second.GetType() == cmState::OBJECT_LIBRARY) { + if (ti->second.GetType() == cmStateEnums::OBJECT_LIBRARY) { std::ostringstream e; e << "Target \"" << target << "\" is an OBJECT library " @@ -738,7 +738,7 @@ void cmMakefile::AddCustomCommandToTarget( this->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } - if (ti->second.GetType() == cmState::INTERFACE_LIBRARY) { + if (ti->second.GetType() == cmStateEnums::INTERFACE_LIBRARY) { std::ostringstream e; e << "Target \"" << target << "\" is an INTERFACE library " @@ -1032,7 +1032,7 @@ cmTarget* cmMakefile::AddUtilityCommand( const char* comment, bool uses_terminal) { // Create a target instance for this utility. - cmTarget* target = this->AddNewTarget(cmState::UTILITY, utilityName); + cmTarget* target = this->AddNewTarget(cmStateEnums::UTILITY, utilityName); if (excludeFromAll) { target->SetProperty("EXCLUDE_FROM_ALL", "TRUE"); } @@ -1774,9 +1774,9 @@ void cmMakefile::AddGlobalLinkInformation(cmTarget& target) { // for these targets do not add anything switch (target.GetType()) { - case cmState::UTILITY: - case cmState::GLOBAL_TARGET: - case cmState::INTERFACE_LIBRARY: + case cmStateEnums::UTILITY: + case cmStateEnums::GLOBAL_TARGET: + case cmStateEnums::INTERFACE_LIBRARY: return; default:; } @@ -1828,13 +1828,15 @@ void cmMakefile::AddAlias(const std::string& lname, std::string const& tgtName) } cmTarget* cmMakefile::AddLibrary(const std::string& lname, - cmState::TargetType type, + cmStateEnums::TargetType type, const std::vector& srcs, bool excludeFromAll) { - assert(type == cmState::STATIC_LIBRARY || type == cmState::SHARED_LIBRARY || - type == cmState::MODULE_LIBRARY || type == cmState::OBJECT_LIBRARY || - type == cmState::INTERFACE_LIBRARY); + assert(type == cmStateEnums::STATIC_LIBRARY || + type == cmStateEnums::SHARED_LIBRARY || + type == cmStateEnums::MODULE_LIBRARY || + type == cmStateEnums::OBJECT_LIBRARY || + type == cmStateEnums::INTERFACE_LIBRARY); cmTarget* target = this->AddNewTarget(type, lname); // Clear its dependencies. Otherwise, dependencies might persist @@ -1853,7 +1855,7 @@ cmTarget* cmMakefile::AddExecutable(const char* exeName, const std::vector& srcs, bool excludeFromAll) { - cmTarget* target = this->AddNewTarget(cmState::EXECUTABLE, exeName); + cmTarget* target = this->AddNewTarget(cmStateEnums::EXECUTABLE, exeName); if (excludeFromAll) { target->SetProperty("EXCLUDE_FROM_ALL", "TRUE"); } @@ -1862,7 +1864,7 @@ cmTarget* cmMakefile::AddExecutable(const char* exeName, return target; } -cmTarget* cmMakefile::AddNewTarget(cmState::TargetType type, +cmTarget* cmMakefile::AddNewTarget(cmStateEnums::TargetType type, const std::string& name) { cmTargets::iterator it = @@ -2040,8 +2042,8 @@ void cmMakefile::ExpandVariablesCMP0019() for (cmTargets::iterator l = this->Targets.begin(); l != this->Targets.end(); ++l) { cmTarget& t = l->second; - if (t.GetType() == cmState::INTERFACE_LIBRARY || - t.GetType() == cmState::GLOBAL_TARGET) { + if (t.GetType() == cmStateEnums::INTERFACE_LIBRARY || + t.GetType() == cmStateEnums::GLOBAL_TARGET) { continue; } includeDirs = t.GetProperty("INCLUDE_DIRECTORIES"); @@ -3681,7 +3683,8 @@ void cmMakefile::RaiseScope(const std::string& var, const char* varDef) } cmTarget* cmMakefile::AddImportedTarget(const std::string& name, - cmState::TargetType type, bool global) + cmStateEnums::TargetType type, + bool global) { // Create the target. CM_AUTO_PTR target( @@ -3767,7 +3770,7 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg, // The conflict is with a non-imported target. // Allow this if the user has requested support. cmake* cm = this->GetCMakeInstance(); - if (isCustom && existing->GetType() == cmState::UTILITY && + if (isCustom && existing->GetType() == cmStateEnums::UTILITY && this != existing->GetMakefile() && cm->GetState()->GetGlobalPropertyAsBool( "ALLOW_DUPLICATE_CUSTOM_TARGETS")) { @@ -3781,22 +3784,22 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg, << "\" because another target with the same name already exists. " << "The existing target is "; switch (existing->GetType()) { - case cmState::EXECUTABLE: + case cmStateEnums::EXECUTABLE: e << "an executable "; break; - case cmState::STATIC_LIBRARY: + case cmStateEnums::STATIC_LIBRARY: e << "a static library "; break; - case cmState::SHARED_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: e << "a shared library "; break; - case cmState::MODULE_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: e << "a module library "; break; - case cmState::UTILITY: + case cmStateEnums::UTILITY: e << "a custom target "; break; - case cmState::INTERFACE_LIBRARY: + case cmStateEnums::INTERFACE_LIBRARY: e << "an interface library "; break; default: diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 0116ce1..71078ab 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -163,9 +163,10 @@ public: /** Create a new imported target with the name and type given. */ cmTarget* AddImportedTarget(const std::string& name, - cmState::TargetType type, bool global); + cmStateEnums::TargetType type, bool global); - cmTarget* AddNewTarget(cmState::TargetType type, const std::string& name); + cmTarget* AddNewTarget(cmStateEnums::TargetType type, + const std::string& name); /** * Add an executable to the build. @@ -251,7 +252,8 @@ public: /** * Set the name of the library. */ - cmTarget* AddLibrary(const std::string& libname, cmState::TargetType type, + cmTarget* AddLibrary(const std::string& libname, + cmStateEnums::TargetType type, const std::vector& srcs, bool excludeFromAll = false); void AddAlias(const std::string& libname, const std::string& tgt); diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 00a9100..5bf2f51 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -24,7 +24,7 @@ cmMakefileLibraryTargetGenerator::cmMakefileLibraryTargetGenerator( : cmMakefileTargetGenerator(target) { this->CustomCommandDriver = OnDepends; - if (this->GeneratorTarget->GetType() != cmState::INTERFACE_LIBRARY) { + if (this->GeneratorTarget->GetType() != cmStateEnums::INTERFACE_LIBRARY) { this->GeneratorTarget->GetLibraryNames( this->TargetNameOut, this->TargetNameSO, this->TargetNameReal, this->TargetNameImport, this->TargetNamePDB, this->ConfigName); @@ -57,24 +57,24 @@ void cmMakefileLibraryTargetGenerator::WriteRuleFiles() // write the link rules // Write the rule for this target type. switch (this->GeneratorTarget->GetType()) { - case cmState::STATIC_LIBRARY: + case cmStateEnums::STATIC_LIBRARY: this->WriteStaticLibraryRules(); break; - case cmState::SHARED_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: this->WriteSharedLibraryRules(false); if (this->GeneratorTarget->NeedRelinkBeforeInstall(this->ConfigName)) { // Write rules to link an installable version of the target. this->WriteSharedLibraryRules(true); } break; - case cmState::MODULE_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: this->WriteModuleLibraryRules(false); if (this->GeneratorTarget->NeedRelinkBeforeInstall(this->ConfigName)) { // Write rules to link an installable version of the target. this->WriteModuleLibraryRules(true); } break; - case cmState::OBJECT_LIBRARY: + case cmStateEnums::OBJECT_LIBRARY: this->WriteObjectLibraryRules(); break; default: @@ -251,8 +251,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( this->LocalGenerator->AppendFlags(linkFlags, extraFlags); // Add OSX version flags, if any. - if (this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY || - this->GeneratorTarget->GetType() == cmState::MODULE_LIBRARY) { + if (this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY || + this->GeneratorTarget->GetType() == cmStateEnums::MODULE_LIBRARY) { this->AppendOSXVerFlag(linkFlags, linkLanguage, "COMPATIBILITY", true); this->AppendOSXVerFlag(linkFlags, linkLanguage, "CURRENT", false); } @@ -345,13 +345,13 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( std::string buildEcho = "Linking "; buildEcho += linkLanguage; switch (this->GeneratorTarget->GetType()) { - case cmState::STATIC_LIBRARY: + case cmStateEnums::STATIC_LIBRARY: buildEcho += " static library "; break; - case cmState::SHARED_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: buildEcho += " shared library "; break; - case cmState::MODULE_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: if (this->GeneratorTarget->IsCFBundleOnApple()) { buildEcho += " CFBundle"; } @@ -399,7 +399,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( #ifdef _WIN32 // There may be a manifest file for this target. Add it to the // clean set just in case. - if (this->GeneratorTarget->GetType() != cmState::STATIC_LIBRARY) { + if (this->GeneratorTarget->GetType() != cmStateEnums::STATIC_LIBRARY) { libCleanFiles.push_back(this->LocalGenerator->MaybeConvertToRelativePath( this->LocalGenerator->GetCurrentBinaryDirectory(), (targetFullPath + ".manifest").c_str())); @@ -409,7 +409,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( std::vector commands1; // Add a command to remove any existing files for this library. // for static libs only - if (this->GeneratorTarget->GetType() == cmState::STATIC_LIBRARY) { + if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY) { this->LocalGenerator->AppendCleanCommand(commands1, libCleanFiles, this->GeneratorTarget, "target"); this->LocalGenerator->CreateCDCommand( @@ -443,7 +443,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( std::vector archiveAppendCommands; std::vector archiveFinishCommands; std::string::size_type archiveCommandLimit = std::string::npos; - if (this->GeneratorTarget->GetType() == cmState::STATIC_LIBRARY) { + if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY) { haveStaticLibraryRule = this->Makefile->IsDefinitionSet(linkRuleVar); std::string arCreateVar = "CMAKE_"; arCreateVar += linkLanguage; @@ -492,7 +492,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( // Collect up flags to link in needed libraries. std::string linkLibs; - if (this->GeneratorTarget->GetType() != cmState::STATIC_LIBRARY) { + if (this->GeneratorTarget->GetType() != cmStateEnums::STATIC_LIBRARY) { CM_AUTO_PTR linkLineComputer( this->CreateLinkLineComputer( @@ -514,7 +514,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( useWatcomQuote); // maybe create .def file from list of objects - if (this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY && + if (this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY && this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) { this->GenDefFile(real_link_commands, linkFlags); } @@ -574,7 +574,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( // Compute the directory portion of the install_name setting. std::string install_name_dir; - if (this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY) { + if (this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY) { // Get the install_name directory for the build tree. install_name_dir = this->GeneratorTarget->GetInstallNameDirForBuildTree(this->ConfigName); @@ -659,7 +659,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( std::string linkRule = this->GetLinkRule(linkRuleVar); cmSystemTools::ExpandListArgument(linkRule, real_link_commands); if (this->GeneratorTarget->GetPropertyAsBool("LINK_WHAT_YOU_USE") && - (this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY)) { + (this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY)) { std::string cmakeCommand = this->LocalGenerator->ConvertToOutputFormat( cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL); cmakeCommand += " -E __run_iwyu --lwyu="; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index cbfe850..f0502bf 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -68,16 +68,16 @@ cmMakefileTargetGenerator* cmMakefileTargetGenerator::New( cmMakefileTargetGenerator* result = CM_NULLPTR; switch (tgt->GetType()) { - case cmState::EXECUTABLE: + case cmStateEnums::EXECUTABLE: result = new cmMakefileExecutableTargetGenerator(tgt); break; - case cmState::STATIC_LIBRARY: - case cmState::SHARED_LIBRARY: - case cmState::MODULE_LIBRARY: - case cmState::OBJECT_LIBRARY: + case cmStateEnums::STATIC_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: + case cmStateEnums::OBJECT_LIBRARY: result = new cmMakefileLibraryTargetGenerator(tgt); break; - case cmState::UTILITY: + case cmStateEnums::UTILITY: result = new cmMakefileUtilityTargetGenerator(tgt); break; default: @@ -504,10 +504,10 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( std::string targetFullPathReal; std::string targetFullPathPDB; std::string targetFullPathCompilePDB; - if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE || - this->GeneratorTarget->GetType() == cmState::STATIC_LIBRARY || - this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY || - this->GeneratorTarget->GetType() == cmState::MODULE_LIBRARY) { + if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE || + this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY || + this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY || + this->GeneratorTarget->GetType() == cmStateEnums::MODULE_LIBRARY) { targetFullPathReal = this->GeneratorTarget->GetFullPath(this->ConfigName, false, true); targetFullPathPDB = @@ -515,7 +515,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( targetFullPathPDB += "/"; targetFullPathPDB += this->GeneratorTarget->GetPDBName(this->ConfigName); } - if (this->GeneratorTarget->GetType() <= cmState::OBJECT_LIBRARY) { + if (this->GeneratorTarget->GetType() <= cmStateEnums::OBJECT_LIBRARY) { targetFullPathCompilePDB = this->GeneratorTarget->GetCompilePDBPath(this->ConfigName); if (targetFullPathCompilePDB.empty()) { @@ -1346,7 +1346,7 @@ void cmMakefileTargetGenerator::AppendTargetDepends( std::vector& depends) { // Static libraries never depend on anything for linking. - if (this->GeneratorTarget->GetType() == cmState::STATIC_LIBRARY) { + if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY) { return; } diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index b28b19a..dd903d6 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -45,7 +45,7 @@ cmNinjaNormalTargetGenerator::cmNinjaNormalTargetGenerator( , TargetLinkLanguage("") { this->TargetLinkLanguage = target->GetLinkerLanguage(this->GetConfigName()); - if (target->GetType() == cmState::EXECUTABLE) { + if (target->GetType() == cmStateEnums::EXECUTABLE) { this->GetGeneratorTarget()->GetExecutableNames( this->TargetNameOut, this->TargetNameReal, this->TargetNameImport, this->TargetNamePDB, GetLocalGenerator()->GetConfigName()); @@ -56,7 +56,7 @@ cmNinjaNormalTargetGenerator::cmNinjaNormalTargetGenerator( GetLocalGenerator()->GetConfigName()); } - if (target->GetType() != cmState::OBJECT_LIBRARY) { + if (target->GetType() != cmStateEnums::OBJECT_LIBRARY) { // on Windows the output dir is already needed at compile time // ensure the directory exists (OutDir test) EnsureDirectoryExists(target->GetDirectory(this->GetConfigName())); @@ -87,7 +87,7 @@ void cmNinjaNormalTargetGenerator::Generate() // Write the build statements this->WriteObjectBuildStatements(); - if (this->GetGeneratorTarget()->GetType() == cmState::OBJECT_LIBRARY) { + if (this->GetGeneratorTarget()->GetType() == cmStateEnums::OBJECT_LIBRARY) { this->WriteObjectLibStatement(); } else { this->WriteLinkStatement(); @@ -125,17 +125,17 @@ void cmNinjaNormalTargetGenerator::WriteLanguagesRules() const char* cmNinjaNormalTargetGenerator::GetVisibleTypeName() const { switch (this->GetGeneratorTarget()->GetType()) { - case cmState::STATIC_LIBRARY: + case cmStateEnums::STATIC_LIBRARY: return "static library"; - case cmState::SHARED_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: return "shared library"; - case cmState::MODULE_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: if (this->GetGeneratorTarget()->IsCFBundleOnApple()) { return "CFBundle shared module"; } else { return "shared module"; } - case cmState::EXECUTABLE: + case cmStateEnums::EXECUTABLE: return "executable"; default: return CM_NULLPTR; @@ -160,7 +160,7 @@ struct cmNinjaRemoveNoOpCommands void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile) { - cmState::TargetType targetType = this->GetGeneratorTarget()->GetType(); + cmStateEnums::TargetType targetType = this->GetGeneratorTarget()->GetType(); std::string ruleName = this->LanguageLinkerRule(); // Select whether to use a response file for objects. @@ -236,7 +236,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile) vars.Manifests = "$MANIFESTS"; std::string langFlags; - if (targetType != cmState::EXECUTABLE) { + if (targetType != cmStateEnums::EXECUTABLE) { langFlags += "$LANGUAGE_COMPILE_FLAGS $ARCH_FLAGS"; vars.LanguageCompileFlags = langFlags.c_str(); } @@ -292,7 +292,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile) std::string cmakeCommand = this->GetLocalGenerator()->ConvertToOutputFormat( cmSystemTools::GetCMakeCommand(), cmOutputConverter::SHELL); - if (targetType == cmState::EXECUTABLE) { + if (targetType == cmStateEnums::EXECUTABLE) { this->GetGlobalGenerator()->AddRule( "CMAKE_SYMLINK_EXECUTABLE", cmakeCommand + " -E cmake_symlink_executable" @@ -352,7 +352,7 @@ std::vector cmNinjaNormalTargetGenerator::ComputeLinkCmd() } } switch (this->GetGeneratorTarget()->GetType()) { - case cmState::STATIC_LIBRARY: { + case cmStateEnums::STATIC_LIBRARY: { // We have archive link commands set. First, delete the existing archive. { std::string cmakeCommand = @@ -377,9 +377,9 @@ std::vector cmNinjaNormalTargetGenerator::ComputeLinkCmd() } return linkCmds; } - case cmState::SHARED_LIBRARY: - case cmState::MODULE_LIBRARY: - case cmState::EXECUTABLE: + case cmStateEnums::SHARED_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: + case cmStateEnums::EXECUTABLE: break; default: assert(0 && "Unexpected target type"); @@ -452,7 +452,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() // Write comments. cmGlobalNinjaGenerator::WriteDivider(this->GetBuildFileStream()); - const cmState::TargetType targetType = gt.GetType(); + const cmStateEnums::TargetType targetType = gt.GetType(); this->GetBuildFileStream() << "# Link build statements for " << cmState::GetTargetTypeName(targetType) << " target " << this->GetTargetName() << "\n\n"; @@ -497,7 +497,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() linkLineComputer.get(), this->GetConfigName(), vars["LINK_LIBRARIES"], vars["FLAGS"], vars["LINK_FLAGS"], frameworkPath, linkPath, &genTarget); if (this->GetMakefile()->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS") && - (gt.GetType() == cmState::SHARED_LIBRARY || + (gt.GetType() == cmStateEnums::SHARED_LIBRARY || gt.IsExecutableWithExports())) { if (gt.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) { std::string name_of_def_file = gt.GetSupportDirectory(); @@ -510,8 +510,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() } // Add OS X version flags, if any. - if (this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY || - this->GeneratorTarget->GetType() == cmState::MODULE_LIBRARY) { + if (this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY || + this->GeneratorTarget->GetType() == cmStateEnums::MODULE_LIBRARY) { this->AppendOSXVerFlag(vars["LINK_FLAGS"], this->TargetLinkLanguage, "COMPATIBILITY", true); this->AppendOSXVerFlag(vars["LINK_FLAGS"], this->TargetLinkLanguage, @@ -535,7 +535,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() // Compute architecture specific link flags. Yes, these go into a different // variable for executables, probably due to a mistake made when duplicating // code between the Makefile executable and library generators. - if (targetType == cmState::EXECUTABLE) { + if (targetType == cmStateEnums::EXECUTABLE) { std::string t = vars["FLAGS"]; localGen.AddArchitectureFlags(t, &genTarget, TargetLinkLanguage, cfgName); t += lwyuFlags; @@ -552,7 +552,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() if (this->GetGeneratorTarget()->HasSOName(cfgName)) { vars["SONAME_FLAG"] = mf->GetSONameFlag(this->TargetLinkLanguage); vars["SONAME"] = this->TargetNameSO; - if (targetType == cmState::SHARED_LIBRARY) { + if (targetType == cmStateEnums::SHARED_LIBRARY) { std::string install_dir = this->GetGeneratorTarget()->GetInstallNameDirForBuildTree(cfgName); if (!install_dir.empty()) { @@ -625,7 +625,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() } // maybe create .def file from list of objects - if ((gt.GetType() == cmState::SHARED_LIBRARY || + if ((gt.GetType() == cmStateEnums::SHARED_LIBRARY || gt.IsExecutableWithExports()) && this->GetMakefile()->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) { if (gt.GetPropertyAsBool("WINDOWS_EXPORT_ALL_SYMBOLS")) { @@ -713,7 +713,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() this->WriteLinkRule(usedResponseFile); if (symlinkNeeded) { - if (targetType == cmState::EXECUTABLE) { + if (targetType == cmStateEnums::EXECUTABLE) { globalGen.WriteBuild( this->GetBuildFileStream(), "Create executable symlink " + targetOutput, diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 1ac6cd4..6552832 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -31,15 +31,15 @@ cmNinjaTargetGenerator* cmNinjaTargetGenerator::New(cmGeneratorTarget* target) { switch (target->GetType()) { - case cmState::EXECUTABLE: - case cmState::SHARED_LIBRARY: - case cmState::STATIC_LIBRARY: - case cmState::MODULE_LIBRARY: - case cmState::OBJECT_LIBRARY: + case cmStateEnums::EXECUTABLE: + case cmStateEnums::SHARED_LIBRARY: + case cmStateEnums::STATIC_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: + case cmStateEnums::OBJECT_LIBRARY: return new cmNinjaNormalTargetGenerator(target); - case cmState::UTILITY: - case cmState::GLOBAL_TARGET: + case cmStateEnums::UTILITY: + case cmStateEnums::GLOBAL_TARGET: return new cmNinjaUtilityTargetGenerator(target); default: @@ -186,8 +186,8 @@ std::string cmNinjaTargetGenerator::ComputeDefines(cmSourceFile const* source, cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const { // Static libraries never depend on other targets for linking. - if (this->GeneratorTarget->GetType() == cmState::STATIC_LIBRARY || - this->GeneratorTarget->GetType() == cmState::OBJECT_LIBRARY) { + if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY || + this->GeneratorTarget->GetType() == cmStateEnums::OBJECT_LIBRARY) { return cmNinjaDeps(); } @@ -335,15 +335,15 @@ bool cmNinjaTargetGenerator::SetMsvcTargetPdbVariable(cmNinjaVars& vars) const mf->GetDefinition("MSVC_CXX_ARCHITECTURE_ID")) { std::string pdbPath; std::string compilePdbPath; - if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE || - this->GeneratorTarget->GetType() == cmState::STATIC_LIBRARY || - this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY || - this->GeneratorTarget->GetType() == cmState::MODULE_LIBRARY) { + if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE || + this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY || + this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY || + this->GeneratorTarget->GetType() == cmStateEnums::MODULE_LIBRARY) { pdbPath = this->GeneratorTarget->GetPDBDirectory(this->GetConfigName()); pdbPath += "/"; pdbPath += this->GeneratorTarget->GetPDBName(this->GetConfigName()); } - if (this->GeneratorTarget->GetType() <= cmState::OBJECT_LIBRARY) { + if (this->GeneratorTarget->GetType() <= cmStateEnums::OBJECT_LIBRARY) { compilePdbPath = this->GeneratorTarget->GetCompilePDBPath(this->GetConfigName()); if (compilePdbPath.empty()) { diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx index 17e35e5..7de185a 100644 --- a/Source/cmNinjaUtilityTargetGenerator.cxx +++ b/Source/cmNinjaUtilityTargetGenerator.cxx @@ -151,7 +151,7 @@ void cmNinjaUtilityTargetGenerator::Generate() // Add an alias for the logical target name regardless of what directory // contains it. Skip this for GLOBAL_TARGET because they are meant to // be per-directory and have one at the top-level anyway. - if (this->GetGeneratorTarget()->GetType() != cmState::GLOBAL_TARGET) { + if (this->GetGeneratorTarget()->GetType() != cmStateEnums::GLOBAL_TARGET) { this->GetGlobalGenerator()->AddTargetAlias(this->GetTargetName(), this->GetGeneratorTarget()); } diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index a9a3ce2..d332ed7 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -684,7 +684,7 @@ static Json::Value DumpTarget(cmGeneratorTarget* target, cmLocalGenerator* lg = target->GetLocalGenerator(); const cmState* state = lg->GetState(); - const cmState::TargetType type = target->GetType(); + const cmStateEnums::TargetType type = target->GetType(); const std::string typeName = state->GetTargetTypeName(type); Json::Value ttl = Json::arrayValue; diff --git a/Source/cmState.cxx b/Source/cmState.cxx index ca0295a..cdadbda 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -117,26 +117,26 @@ cmState::~cmState() cmDeleteAll(this->Commands); } -const char* cmState::GetTargetTypeName(cmState::TargetType targetType) +const char* cmState::GetTargetTypeName(cmStateEnums::TargetType targetType) { switch (targetType) { - case cmState::STATIC_LIBRARY: + case cmStateEnums::STATIC_LIBRARY: return "STATIC_LIBRARY"; - case cmState::MODULE_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: return "MODULE_LIBRARY"; - case cmState::SHARED_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: return "SHARED_LIBRARY"; - case cmState::OBJECT_LIBRARY: + case cmStateEnums::OBJECT_LIBRARY: return "OBJECT_LIBRARY"; - case cmState::EXECUTABLE: + case cmStateEnums::EXECUTABLE: return "EXECUTABLE"; - case cmState::UTILITY: + case cmStateEnums::UTILITY: return "UTILITY"; - case cmState::GLOBAL_TARGET: + case cmStateEnums::GLOBAL_TARGET: return "GLOBAL_TARGET"; - case cmState::INTERFACE_LIBRARY: + case cmStateEnums::INTERFACE_LIBRARY: return "INTERFACE_LIBRARY"; - case cmState::UNKNOWN_LIBRARY: + case cmStateEnums::UNKNOWN_LIBRARY: return "UNKNOWN_LIBRARY"; } assert(0 && "Unexpected target type"); diff --git a/Source/cmState.h b/Source/cmState.h index 8f0b5ee..521870d 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -43,6 +43,19 @@ enum SnapshotType PolicyScopeType, VariableScopeType }; + +enum TargetType +{ + EXECUTABLE, + STATIC_LIBRARY, + SHARED_LIBRARY, + MODULE_LIBRARY, + OBJECT_LIBRARY, + UTILITY, + GLOBAL_TARGET, + INTERFACE_LIBRARY, + UNKNOWN_LIBRARY +}; } class cmState @@ -185,20 +198,7 @@ public: friend class Snapshot; }; - enum TargetType - { - EXECUTABLE, - STATIC_LIBRARY, - SHARED_LIBRARY, - MODULE_LIBRARY, - OBJECT_LIBRARY, - UTILITY, - GLOBAL_TARGET, - INTERFACE_LIBRARY, - UNKNOWN_LIBRARY - }; - - static const char* GetTargetTypeName(cmState::TargetType targetType); + static const char* GetTargetTypeName(cmStateEnums::TargetType targetType); Snapshot CreateBaseSnapshot(); Snapshot CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 3a22309..5753dd8 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -180,7 +180,7 @@ public: std::vector LinkImplementationPropertyBacktraces; }; -cmTarget::cmTarget(std::string const& name, cmState::TargetType type, +cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, Visibility vis, cmMakefile* mf) { assert(mf); @@ -196,8 +196,8 @@ cmTarget::cmTarget(std::string const& name, cmState::TargetType type, this->BuildInterfaceIncludesAppended = false; // only add dependency information for library targets - if (this->TargetTypeValue >= cmState::STATIC_LIBRARY && - this->TargetTypeValue <= cmState::MODULE_LIBRARY) { + if (this->TargetTypeValue >= cmStateEnums::STATIC_LIBRARY && + this->TargetTypeValue <= cmStateEnums::MODULE_LIBRARY) { this->RecordDependencies = true; } else { this->RecordDependencies = false; @@ -214,8 +214,8 @@ cmTarget::cmTarget(std::string const& name, cmState::TargetType type, "Android") == 0; // Setup default property values. - if (this->GetType() != cmState::INTERFACE_LIBRARY && - this->GetType() != cmState::UTILITY) { + if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY && + this->GetType() != cmStateEnums::UTILITY) { this->SetPropertyDefault("ANDROID_API", CM_NULLPTR); this->SetPropertyDefault("ANDROID_API_MIN", CM_NULLPTR); this->SetPropertyDefault("ANDROID_ARCH", CM_NULLPTR); @@ -282,7 +282,7 @@ cmTarget::cmTarget(std::string const& name, cmState::TargetType type, mf->GetConfigurations(configNames); // Setup per-configuration property default values. - if (this->GetType() != cmState::UTILITY) { + if (this->GetType() != cmStateEnums::UTILITY) { const char* configProps[] = { /* clang-format needs this comment to break after the opening brace */ "ARCHIVE_OUTPUT_DIRECTORY_", @@ -297,7 +297,7 @@ cmTarget::cmTarget(std::string const& name, cmState::TargetType type, ci != configNames.end(); ++ci) { std::string configUpper = cmSystemTools::UpperCase(*ci); for (const char** p = configProps; *p; ++p) { - if (this->TargetTypeValue == cmState::INTERFACE_LIBRARY && + if (this->TargetTypeValue == cmStateEnums::INTERFACE_LIBRARY && strcmp(*p, "MAP_IMPORTED_CONFIG_") != 0) { continue; } @@ -311,8 +311,8 @@ cmTarget::cmTarget(std::string const& name, cmState::TargetType type, // compatibility with previous CMake versions in which executables // did not support this variable. Projects may still specify the // property directly. - if (this->TargetTypeValue != cmState::EXECUTABLE && - this->TargetTypeValue != cmState::INTERFACE_LIBRARY) { + if (this->TargetTypeValue != cmStateEnums::EXECUTABLE && + this->TargetTypeValue != cmStateEnums::INTERFACE_LIBRARY) { std::string property = cmSystemTools::UpperCase(*ci); property += "_POSTFIX"; this->SetPropertyDefault(property, CM_NULLPTR); @@ -357,44 +357,45 @@ cmTarget::cmTarget(std::string const& name, cmState::TargetType type, parentOptionsBts.end()); } - if (this->GetType() != cmState::INTERFACE_LIBRARY && - this->GetType() != cmState::UTILITY) { + if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY && + this->GetType() != cmStateEnums::UTILITY) { this->SetPropertyDefault("C_VISIBILITY_PRESET", CM_NULLPTR); this->SetPropertyDefault("CXX_VISIBILITY_PRESET", CM_NULLPTR); this->SetPropertyDefault("VISIBILITY_INLINES_HIDDEN", CM_NULLPTR); } - if (this->TargetTypeValue == cmState::EXECUTABLE) { + if (this->TargetTypeValue == cmStateEnums::EXECUTABLE) { this->SetPropertyDefault("ANDROID_GUI", CM_NULLPTR); this->SetPropertyDefault("CROSSCOMPILING_EMULATOR", CM_NULLPTR); this->SetPropertyDefault("ENABLE_EXPORTS", CM_NULLPTR); } - if (this->TargetTypeValue == cmState::SHARED_LIBRARY || - this->TargetTypeValue == cmState::MODULE_LIBRARY) { + if (this->TargetTypeValue == cmStateEnums::SHARED_LIBRARY || + this->TargetTypeValue == cmStateEnums::MODULE_LIBRARY) { this->SetProperty("POSITION_INDEPENDENT_CODE", "True"); } - if (this->TargetTypeValue == cmState::SHARED_LIBRARY || - this->TargetTypeValue == cmState::EXECUTABLE) { + if (this->TargetTypeValue == cmStateEnums::SHARED_LIBRARY || + this->TargetTypeValue == cmStateEnums::EXECUTABLE) { this->SetPropertyDefault("WINDOWS_EXPORT_ALL_SYMBOLS", CM_NULLPTR); } - if (this->GetType() != cmState::INTERFACE_LIBRARY && - this->GetType() != cmState::UTILITY) { + if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY && + this->GetType() != cmStateEnums::UTILITY) { this->SetPropertyDefault("POSITION_INDEPENDENT_CODE", CM_NULLPTR); } // Record current policies for later use. this->Makefile->RecordPolicies(this->PolicyMap); - if (this->TargetTypeValue == cmState::INTERFACE_LIBRARY) { + if (this->TargetTypeValue == cmStateEnums::INTERFACE_LIBRARY) { // This policy is checked in a few conditions. The properties relevant - // to the policy are always ignored for cmState::INTERFACE_LIBRARY targets, + // to the policy are always ignored for cmStateEnums::INTERFACE_LIBRARY + // targets, // so ensure that the conditions don't lead to nonsense. this->PolicyMap.Set(cmPolicies::CMP0022, cmPolicies::NEW); } - if (this->GetType() != cmState::INTERFACE_LIBRARY && - this->GetType() != cmState::UTILITY) { + if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY && + this->GetType() != cmStateEnums::UTILITY) { this->SetPropertyDefault("JOB_POOL_COMPILE", CM_NULLPTR); this->SetPropertyDefault("JOB_POOL_LINK", CM_NULLPTR); } @@ -432,26 +433,27 @@ cmListFileBacktrace const& cmTarget::GetBacktrace() const bool cmTarget::IsExecutableWithExports() const { - return (this->GetType() == cmState::EXECUTABLE && + return (this->GetType() == cmStateEnums::EXECUTABLE && this->GetPropertyAsBool("ENABLE_EXPORTS")); } bool cmTarget::HasImportLibrary() const { - return (this->DLLPlatform && (this->GetType() == cmState::SHARED_LIBRARY || - this->IsExecutableWithExports())); + return (this->DLLPlatform && + (this->GetType() == cmStateEnums::SHARED_LIBRARY || + this->IsExecutableWithExports())); } bool cmTarget::IsFrameworkOnApple() const { - return (this->GetType() == cmState::SHARED_LIBRARY && + return (this->GetType() == cmStateEnums::SHARED_LIBRARY && this->Makefile->IsOn("APPLE") && this->GetPropertyAsBool("FRAMEWORK")); } bool cmTarget::IsAppBundleOnApple() const { - return (this->GetType() == cmState::EXECUTABLE && + return (this->GetType() == cmStateEnums::EXECUTABLE && this->Makefile->IsOn("APPLE") && this->GetPropertyAsBool("MACOSX_BUNDLE")); } @@ -730,7 +732,7 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, const std::string& lib, } if (cmGeneratorExpression::Find(lib) != std::string::npos || - (tgt && tgt->GetType() == cmState::INTERFACE_LIBRARY) || + (tgt && tgt->GetType() == cmStateEnums::INTERFACE_LIBRARY) || (this->Name == lib)) { return; } @@ -986,10 +988,10 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, void cmTarget::AppendBuildInterfaceIncludes() { - if (this->GetType() != cmState::SHARED_LIBRARY && - this->GetType() != cmState::STATIC_LIBRARY && - this->GetType() != cmState::MODULE_LIBRARY && - this->GetType() != cmState::INTERFACE_LIBRARY && + if (this->GetType() != cmStateEnums::SHARED_LIBRARY && + this->GetType() != cmStateEnums::STATIC_LIBRARY && + this->GetType() != cmStateEnums::MODULE_LIBRARY && + this->GetType() != cmStateEnums::INTERFACE_LIBRARY && !this->IsExecutableWithExports()) { return; } @@ -1255,15 +1257,15 @@ bool cmTarget::GetPropertyAsBool(const std::string& prop) const const char* cmTarget::GetSuffixVariableInternal(bool implib) const { switch (this->GetType()) { - case cmState::STATIC_LIBRARY: + case cmStateEnums::STATIC_LIBRARY: return "CMAKE_STATIC_LIBRARY_SUFFIX"; - case cmState::SHARED_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: return (implib ? "CMAKE_IMPORT_LIBRARY_SUFFIX" : "CMAKE_SHARED_LIBRARY_SUFFIX"); - case cmState::MODULE_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: return (implib ? "CMAKE_IMPORT_LIBRARY_SUFFIX" : "CMAKE_SHARED_MODULE_SUFFIX"); - case cmState::EXECUTABLE: + case cmStateEnums::EXECUTABLE: return (implib ? "CMAKE_IMPORT_LIBRARY_SUFFIX" // Android GUI application packages store the native @@ -1280,15 +1282,15 @@ const char* cmTarget::GetSuffixVariableInternal(bool implib) const const char* cmTarget::GetPrefixVariableInternal(bool implib) const { switch (this->GetType()) { - case cmState::STATIC_LIBRARY: + case cmStateEnums::STATIC_LIBRARY: return "CMAKE_STATIC_LIBRARY_PREFIX"; - case cmState::SHARED_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: return (implib ? "CMAKE_IMPORT_LIBRARY_PREFIX" : "CMAKE_SHARED_LIBRARY_PREFIX"); - case cmState::MODULE_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: return (implib ? "CMAKE_IMPORT_LIBRARY_PREFIX" : "CMAKE_SHARED_MODULE_PREFIX"); - case cmState::EXECUTABLE: + case cmStateEnums::EXECUTABLE: return (implib ? "CMAKE_IMPORT_LIBRARY_PREFIX" // Android GUI application packages store the native @@ -1322,7 +1324,7 @@ std::string cmTarget::ImportedGetFullPath(const std::string& config, const char* imp = CM_NULLPTR; std::string suffix; - if (this->GetType() != cmState::INTERFACE_LIBRARY && + if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY && this->GetMappedConfig(config_upper, &loc, &imp, suffix)) { if (!pimplib) { if (loc) { @@ -1340,7 +1342,7 @@ std::string cmTarget::ImportedGetFullPath(const std::string& config, } else { if (imp) { result = imp; - } else if (this->GetType() == cmState::SHARED_LIBRARY || + } else if (this->GetType() == cmStateEnums::SHARED_LIBRARY || this->IsExecutableWithExports()) { std::string impProp = "IMPORTED_IMPLIB"; impProp += suffix; @@ -1378,9 +1380,10 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config, const char** loc, const char** imp, std::string& suffix) const { - if (this->GetType() == cmState::INTERFACE_LIBRARY) { + if (this->GetType() == cmStateEnums::INTERFACE_LIBRARY) { // This method attempts to find a config-specific LOCATION for the - // IMPORTED library. In the case of cmState::INTERFACE_LIBRARY, there is no + // IMPORTED library. In the case of cmStateEnums::INTERFACE_LIBRARY, there + // is no // LOCATION at all, so leaving *loc and *imp unchanged is the appropriate // and valid response. return true; diff --git a/Source/cmTarget.h b/Source/cmTarget.h index bd00b3d..6a7c8f0 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -62,8 +62,8 @@ public: VisibilityImportedGlobally }; - cmTarget(std::string const& name, cmState::TargetType type, Visibility vis, - cmMakefile* mf); + cmTarget(std::string const& name, cmStateEnums::TargetType type, + Visibility vis, cmMakefile* mf); enum CustomCommandType { @@ -75,7 +75,7 @@ public: /** * Return the type of target. */ - cmState::TargetType GetType() const { return this->TargetTypeValue; } + cmStateEnums::TargetType GetType() const { return this->TargetTypeValue; } cmGlobalGenerator* GetGlobalGenerator() const; @@ -302,7 +302,7 @@ private: LinkLibraryVectorType OriginalLinkLibraries; cmMakefile* Makefile; cmTargetInternalPointer Internal; - cmState::TargetType TargetTypeValue; + cmStateEnums::TargetType TargetTypeValue; bool HaveInstallRule; bool RecordDependencies; bool DLLPlatform; diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index d1de7ef..804dc5a 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -71,7 +71,7 @@ bool cmTargetLinkLibrariesCommand::InitialPass( return true; } - if (this->Target->GetType() == cmState::OBJECT_LIBRARY) { + if (this->Target->GetType() == cmStateEnums::OBJECT_LIBRARY) { std::ostringstream e; e << "Object library target \"" << args[0] << "\" " << "may not link to anything."; @@ -80,7 +80,7 @@ bool cmTargetLinkLibrariesCommand::InitialPass( return true; } - if (this->Target->GetType() == cmState::UTILITY) { + if (this->Target->GetType() == cmStateEnums::UTILITY) { std::ostringstream e; const char* modal = CM_NULLPTR; cmake::MessageType messageType = cmake::AUTHOR_WARNING; @@ -278,7 +278,7 @@ void cmTargetLinkLibrariesCommand::LinkLibraryTypeSpecifierWarning(int left, bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, cmTargetLinkLibraryType llt) { - if (this->Target->GetType() == cmState::INTERFACE_LIBRARY && + if (this->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY && this->CurrentProcessingState != ProcessingKeywordLinkInterface) { this->Makefile->IssueMessage( cmake::FATAL_ERROR, @@ -351,9 +351,9 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, cmTarget* tgt = this->Makefile->GetGlobalGenerator()->FindTarget(lib); - if (tgt && (tgt->GetType() != cmState::STATIC_LIBRARY) && - (tgt->GetType() != cmState::SHARED_LIBRARY) && - (tgt->GetType() != cmState::INTERFACE_LIBRARY) && + if (tgt && (tgt->GetType() != cmStateEnums::STATIC_LIBRARY) && + (tgt->GetType() != cmStateEnums::SHARED_LIBRARY) && + (tgt->GetType() != cmStateEnums::INTERFACE_LIBRARY) && !tgt->IsExecutableWithExports()) { std::ostringstream e; e << "Target \"" << lib << "\" of type " @@ -375,7 +375,7 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, } if (this->CurrentProcessingState != ProcessingKeywordPublicInterface && this->CurrentProcessingState != ProcessingPlainPublicInterface) { - if (this->Target->GetType() == cmState::STATIC_LIBRARY) { + if (this->Target->GetType() == cmStateEnums::STATIC_LIBRARY) { std::string configLib = this->Target->GetDebugGeneratorExpressions(lib, llt); if (cmGeneratorExpression::IsValidTargetName(lib) || @@ -403,7 +403,7 @@ bool cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, return true; } - if (this->Target->GetType() == cmState::INTERFACE_LIBRARY) { + if (this->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY) { return true; } diff --git a/Source/cmTargetPropCommandBase.cxx b/Source/cmTargetPropCommandBase.cxx index a00360b..e2e02ad 100644 --- a/Source/cmTargetPropCommandBase.cxx +++ b/Source/cmTargetPropCommandBase.cxx @@ -28,12 +28,12 @@ bool cmTargetPropCommandBase::HandleArguments( this->HandleMissingTarget(args[0]); return false; } - if ((this->Target->GetType() != cmState::SHARED_LIBRARY) && - (this->Target->GetType() != cmState::STATIC_LIBRARY) && - (this->Target->GetType() != cmState::OBJECT_LIBRARY) && - (this->Target->GetType() != cmState::MODULE_LIBRARY) && - (this->Target->GetType() != cmState::INTERFACE_LIBRARY) && - (this->Target->GetType() != cmState::EXECUTABLE)) { + if ((this->Target->GetType() != cmStateEnums::SHARED_LIBRARY) && + (this->Target->GetType() != cmStateEnums::STATIC_LIBRARY) && + (this->Target->GetType() != cmStateEnums::OBJECT_LIBRARY) && + (this->Target->GetType() != cmStateEnums::MODULE_LIBRARY) && + (this->Target->GetType() != cmStateEnums::INTERFACE_LIBRARY) && + (this->Target->GetType() != cmStateEnums::EXECUTABLE)) { this->SetError("called with non-compilable target type"); return false; } @@ -86,7 +86,7 @@ bool cmTargetPropCommandBase::ProcessContentArgs( return false; } - if (this->Target->GetType() == cmState::INTERFACE_LIBRARY && + if (this->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY && scope != "INTERFACE") { this->SetError("may only be set INTERFACE properties on INTERFACE " "targets"); diff --git a/Source/cmTargetPropertyComputer.cxx b/Source/cmTargetPropertyComputer.cxx index 21408d1..36d1940 100644 --- a/Source/cmTargetPropertyComputer.cxx +++ b/Source/cmTargetPropertyComputer.cxx @@ -83,10 +83,10 @@ bool cmTargetPropertyComputer::WhiteListedInterfaceProperty( } bool cmTargetPropertyComputer::PassesWhitelist( - cmState::TargetType tgtType, std::string const& prop, cmMessenger* messenger, - cmListFileBacktrace const& context) + cmStateEnums::TargetType tgtType, std::string const& prop, + cmMessenger* messenger, cmListFileBacktrace const& context) { - if (tgtType == cmState::INTERFACE_LIBRARY && + if (tgtType == cmStateEnums::INTERFACE_LIBRARY && !WhiteListedInterfaceProperty(prop)) { std::ostringstream e; e << "INTERFACE_LIBRARY targets may only have whitelisted properties. " diff --git a/Source/cmTargetPropertyComputer.h b/Source/cmTargetPropertyComputer.h index ed9a4e2..f8b683a 100644 --- a/Source/cmTargetPropertyComputer.h +++ b/Source/cmTargetPropertyComputer.h @@ -36,7 +36,7 @@ public: static bool WhiteListedInterfaceProperty(const std::string& prop); - static bool PassesWhitelist(cmState::TargetType tgtType, + static bool PassesWhitelist(cmStateEnums::TargetType tgtType, std::string const& prop, cmMessenger* messenger, cmListFileBacktrace const& context); @@ -59,11 +59,11 @@ private: { // Watch for special "computed" properties that are dependent on // other properties or variables. Always recompute them. - if (tgt->GetType() == cmState::EXECUTABLE || - tgt->GetType() == cmState::STATIC_LIBRARY || - tgt->GetType() == cmState::SHARED_LIBRARY || - tgt->GetType() == cmState::MODULE_LIBRARY || - tgt->GetType() == cmState::UNKNOWN_LIBRARY) { + if (tgt->GetType() == cmStateEnums::EXECUTABLE || + tgt->GetType() == cmStateEnums::STATIC_LIBRARY || + tgt->GetType() == cmStateEnums::SHARED_LIBRARY || + tgt->GetType() == cmStateEnums::MODULE_LIBRARY || + tgt->GetType() == cmStateEnums::UNKNOWN_LIBRARY) { static const std::string propLOCATION = "LOCATION"; if (prop == propLOCATION) { if (!tgt->IsImported() && diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index 3ea59cb..301660e 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -77,7 +77,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, // be translated. std::string exe = command[0]; cmGeneratorTarget* target = this->LG->FindGeneratorTargetToUse(exe); - if (target && target->GetType() == cmState::EXECUTABLE) { + if (target && target->GetType() == cmStateEnums::EXECUTABLE) { // Use the target file on disk. exe = target->GetFullPath(config); diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 8524ecc..9c857f2 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -255,7 +255,7 @@ void cmVisualStudio10TargetGenerator::WriteString(const char* line, void cmVisualStudio10TargetGenerator::Generate() { // do not generate external ms projects - if (this->GeneratorTarget->GetType() == cmState::INTERFACE_LIBRARY || + if (this->GeneratorTarget->GetType() == cmStateEnums::INTERFACE_LIBRARY || this->GeneratorTarget->GetProperty("EXTERNAL_MSPROJECT")) { return; } @@ -264,7 +264,7 @@ void cmVisualStudio10TargetGenerator::Generate() this->Name.c_str()); this->GeneratorTarget->Target->SetProperty("GENERATOR_FILE_NAME_EXT", ".vcxproj"); - if (this->GeneratorTarget->GetType() <= cmState::OBJECT_LIBRARY) { + if (this->GeneratorTarget->GetType() <= cmStateEnums::OBJECT_LIBRARY) { if (!this->ComputeClOptions()) { return; } @@ -344,7 +344,7 @@ void cmVisualStudio10TargetGenerator::Generate() (*this->BuildFileStream) << "{" << this->GUID << "}\n"; if (this->MSTools && - this->GeneratorTarget->GetType() <= cmState::GLOBAL_TARGET) { + this->GeneratorTarget->GetType() <= cmStateEnums::GLOBAL_TARGET) { this->WriteApplicationTypeSettings(); this->VerifyNecessaryFiles(); } @@ -655,15 +655,15 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() configType += cmVS10EscapeXML(vsConfigurationType); } else { switch (this->GeneratorTarget->GetType()) { - case cmState::SHARED_LIBRARY: - case cmState::MODULE_LIBRARY: + case cmStateEnums::SHARED_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: configType += "DynamicLibrary"; break; - case cmState::OBJECT_LIBRARY: - case cmState::STATIC_LIBRARY: + case cmStateEnums::OBJECT_LIBRARY: + case cmStateEnums::STATIC_LIBRARY: configType += "StaticLibrary"; break; - case cmState::EXECUTABLE: + case cmStateEnums::EXECUTABLE: if (this->NsightTegra && !this->GeneratorTarget->GetPropertyAsBool("ANDROID_GUI")) { // Android executables are .so too. @@ -672,8 +672,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() configType += "Application"; } break; - case cmState::UTILITY: - case cmState::GLOBAL_TARGET: + case cmStateEnums::UTILITY: + case cmStateEnums::GLOBAL_TARGET: if (this->NsightTegra) { // Tegra-Android platform does not understand "Utility". configType += "StaticLibrary"; @@ -681,8 +681,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() configType += "Utility"; } break; - case cmState::UNKNOWN_LIBRARY: - case cmState::INTERFACE_LIBRARY: + case cmStateEnums::UNKNOWN_LIBRARY: + case cmStateEnums::INTERFACE_LIBRARY: break; } } @@ -710,7 +710,7 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues( std::string mfcFlagValue = mfcFlag ? mfcFlag : "0"; std::string useOfMfcValue = "false"; - if (this->GeneratorTarget->GetType() <= cmState::OBJECT_LIBRARY) { + if (this->GeneratorTarget->GetType() <= cmStateEnums::OBJECT_LIBRARY) { if (mfcFlagValue == "1") { useOfMfcValue = "Static"; } else if (mfcFlagValue == "2") { @@ -721,14 +721,15 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues( mfcLine += useOfMfcValue + "\n"; this->WriteString(mfcLine.c_str(), 2); - if ((this->GeneratorTarget->GetType() <= cmState::OBJECT_LIBRARY && + if ((this->GeneratorTarget->GetType() <= cmStateEnums::OBJECT_LIBRARY && this->ClOptions[config]->UsingUnicode()) || this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT") || this->GlobalGenerator->TargetsWindowsPhone() || this->GlobalGenerator->TargetsWindowsStore() || this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_EXTENSIONS")) { this->WriteString("Unicode\n", 2); - } else if (this->GeneratorTarget->GetType() <= cmState::MODULE_LIBRARY && + } else if (this->GeneratorTarget->GetType() <= + cmStateEnums::MODULE_LIBRARY && this->ClOptions[config]->UsingSBCS()) { this->WriteString("NotSet\n", 2); } else { @@ -1351,7 +1352,7 @@ void cmVisualStudio10TargetGenerator::WriteSources( void cmVisualStudio10TargetGenerator::WriteAllSources() { - if (this->GeneratorTarget->GetType() > cmState::UTILITY) { + if (this->GeneratorTarget->GetType() > cmStateEnums::UTILITY) { return; } this->WriteString("\n", 1); @@ -1573,8 +1574,8 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions() { - cmState::TargetType ttype = this->GeneratorTarget->GetType(); - if (ttype > cmState::GLOBAL_TARGET) { + cmStateEnums::TargetType ttype = this->GeneratorTarget->GetType(); + if (ttype > cmStateEnums::GLOBAL_TARGET) { return; } @@ -1585,7 +1586,7 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions() for (std::vector::const_iterator config = this->Configurations.begin(); config != this->Configurations.end(); ++config) { - if (ttype >= cmState::UTILITY) { + if (ttype >= cmStateEnums::UTILITY) { this->WritePlatformConfigTag("IntDir", config->c_str(), 3); *this->BuildFileStream << "$(Platform)\\$(Configuration)\\$(ProjectName)\\" @@ -1598,7 +1599,7 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions() intermediateDir += "/"; std::string outDir; std::string targetNameFull; - if (ttype == cmState::OBJECT_LIBRARY) { + if (ttype == cmStateEnums::OBJECT_LIBRARY) { outDir = intermediateDir; targetNameFull = this->GeneratorTarget->GetName(); targetNameFull += ".lib"; @@ -1645,8 +1646,8 @@ void cmVisualStudio10TargetGenerator::OutputLinkIncremental( } // static libraries and things greater than modules do not need // to set this option - if (this->GeneratorTarget->GetType() == cmState::STATIC_LIBRARY || - this->GeneratorTarget->GetType() > cmState::MODULE_LIBRARY) { + if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY || + this->GeneratorTarget->GetType() > cmStateEnums::MODULE_LIBRARY) { return; } Options& linkOptions = *(this->LinkOptions[configName]); @@ -1767,8 +1768,8 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( if (this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT")) { clOptions.AddFlag("CompileAsWinRT", "true"); // For WinRT components, add the _WINRT_DLL define to produce a lib - if (this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY || - this->GeneratorTarget->GetType() == cmState::MODULE_LIBRARY) { + if (this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY || + this->GeneratorTarget->GetType() == cmStateEnums::MODULE_LIBRARY) { clOptions.AddDefine("_WINRT_DLL"); } } else if (this->GlobalGenerator->TargetsWindowsStore() || @@ -1958,8 +1959,8 @@ void cmVisualStudio10TargetGenerator::WriteMasmOptions( void cmVisualStudio10TargetGenerator::WriteLibOptions( std::string const& config) { - if (this->GeneratorTarget->GetType() != cmState::STATIC_LIBRARY && - this->GeneratorTarget->GetType() != cmState::OBJECT_LIBRARY) { + if (this->GeneratorTarget->GetType() != cmStateEnums::STATIC_LIBRARY && + this->GeneratorTarget->GetType() != cmStateEnums::OBJECT_LIBRARY) { return; } std::string libflags; @@ -1992,9 +1993,9 @@ void cmVisualStudio10TargetGenerator::WriteLibOptions( void cmVisualStudio10TargetGenerator::WriteManifestOptions( std::string const& config) { - if (this->GeneratorTarget->GetType() != cmState::EXECUTABLE && - this->GeneratorTarget->GetType() != cmState::SHARED_LIBRARY && - this->GeneratorTarget->GetType() != cmState::MODULE_LIBRARY) { + if (this->GeneratorTarget->GetType() != cmStateEnums::EXECUTABLE && + this->GeneratorTarget->GetType() != cmStateEnums::SHARED_LIBRARY && + this->GeneratorTarget->GetType() != cmStateEnums::MODULE_LIBRARY) { return; } @@ -2145,9 +2146,9 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions( bool cmVisualStudio10TargetGenerator::ComputeLinkOptions() { - if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE || - this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY || - this->GeneratorTarget->GetType() == cmState::MODULE_LIBRARY) { + if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE || + this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY || + this->GeneratorTarget->GetType() == cmStateEnums::MODULE_LIBRARY) { for (std::vector::const_iterator i = this->Configurations.begin(); i != this->Configurations.end(); ++i) { @@ -2178,10 +2179,10 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( std::string CONFIG = cmSystemTools::UpperCase(config); const char* linkType = "SHARED"; - if (this->GeneratorTarget->GetType() == cmState::MODULE_LIBRARY) { + if (this->GeneratorTarget->GetType() == cmStateEnums::MODULE_LIBRARY) { linkType = "MODULE"; } - if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE) { + if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE) { linkType = "EXE"; } std::string flags; @@ -2258,7 +2259,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( std::string targetNameFull; std::string targetNameImport; std::string targetNamePDB; - if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE) { + if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE) { this->GeneratorTarget->GetExecutableNames(targetName, targetNameFull, targetNameImport, targetNamePDB, config.c_str()); @@ -2274,7 +2275,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( if (this->GeneratorTarget->GetPropertyAsBool("WIN32_EXECUTABLE")) { if (this->GlobalGenerator->TargetsWindowsCE()) { linkOptions.AddFlag("SubSystem", "WindowsCE"); - if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE) { + if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE) { if (this->ClOptions[config]->UsingUnicode()) { linkOptions.AddFlag("EntryPointSymbol", "wWinMainCRTStartup"); } else { @@ -2287,7 +2288,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( } else { if (this->GlobalGenerator->TargetsWindowsCE()) { linkOptions.AddFlag("SubSystem", "WindowsCE"); - if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE) { + if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE) { if (this->ClOptions[config]->UsingUnicode()) { linkOptions.AddFlag("EntryPointSymbol", "mainWCRTStartup"); } else { @@ -2325,7 +2326,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( // A Windows Runtime component uses internal .NET metadata, // so does not have an import library. if (this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT") && - this->GeneratorTarget->GetType() != cmState::EXECUTABLE) { + this->GeneratorTarget->GetType() != cmStateEnums::EXECUTABLE) { linkOptions.AddFlag("GenerateWindowsMetadata", "true"); } else if (this->GlobalGenerator->TargetsWindowsPhone() || this->GlobalGenerator->TargetsWindowsStore()) { @@ -2356,7 +2357,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( "%(IgnoreSpecificDefaultLibraries)"); } - if ((this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY || + if ((this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY || this->GeneratorTarget->IsExecutableWithExports()) && this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) { if (this->GeneratorTarget->GetPropertyAsBool( @@ -2398,8 +2399,8 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( void cmVisualStudio10TargetGenerator::WriteLinkOptions( std::string const& config) { - if (this->GeneratorTarget->GetType() == cmState::STATIC_LIBRARY || - this->GeneratorTarget->GetType() > cmState::MODULE_LIBRARY) { + if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY || + this->GeneratorTarget->GetType() > cmStateEnums::MODULE_LIBRARY) { return; } Options& linkOptions = *(this->LinkOptions[config]); @@ -2432,7 +2433,7 @@ void cmVisualStudio10TargetGenerator::AddLibraries( this->ConvertToWindowsSlash(path); libVec.push_back(path); } else if (!l->Target || - l->Target->GetType() != cmState::INTERFACE_LIBRARY) { + l->Target->GetType() != cmStateEnums::INTERFACE_LIBRARY) { libVec.push_back(l->Value); } } @@ -2496,7 +2497,7 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups() this->WritePlatformConfigTag("ItemDefinitionGroup", i->c_str(), 1); *this->BuildFileStream << "\n"; // output cl compile flags - if (this->GeneratorTarget->GetType() <= cmState::OBJECT_LIBRARY) { + if (this->GeneratorTarget->GetType() <= cmStateEnums::OBJECT_LIBRARY) { this->WriteClOptions(*i, includes); // output rc compile flags this->WriteRCOptions(*i, includes); @@ -2513,7 +2514,7 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups() // output manifest flags this->WriteManifestOptions(*i); if (this->NsightTegra && - this->GeneratorTarget->GetType() == cmState::EXECUTABLE && + this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE && this->GeneratorTarget->GetPropertyAsBool("ANDROID_GUI")) { this->WriteAntBuildOptions(*i); } @@ -2525,7 +2526,7 @@ void cmVisualStudio10TargetGenerator::WriteEvents( std::string const& configName) { bool addedPrelink = false; - if ((this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY || + if ((this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY || this->GeneratorTarget->IsExecutableWithExports()) && this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) { if (this->GeneratorTarget->GetPropertyAsBool( @@ -2592,7 +2593,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences() for (OrderedTargetDependSet::const_iterator i = depends.begin(); i != depends.end(); ++i) { cmGeneratorTarget const* dt = *i; - if (dt->GetType() == cmState::INTERFACE_LIBRARY) { + if (dt->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } // skip fortran targets as they can not be processed by MSBuild @@ -2728,7 +2729,7 @@ void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile() { if ((this->GlobalGenerator->TargetsWindowsStore() || this->GlobalGenerator->TargetsWindowsPhone()) && - (cmState::EXECUTABLE == this->GeneratorTarget->GetType())) { + (cmStateEnums::EXECUTABLE == this->GeneratorTarget->GetType())) { std::string pfxFile; std::vector certificates; this->GeneratorTarget->GetCertificates(certificates, ""); @@ -2853,7 +2854,7 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings() "\n", 2); - if (this->GeneratorTarget->GetType() < cmState::UTILITY) { + if (this->GeneratorTarget->GetType() < cmStateEnums::UTILITY) { isAppContainer = true; } } else if (v == "8.1") { @@ -2865,7 +2866,7 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings() "\n", 2); - if (this->GeneratorTarget->GetType() < cmState::UTILITY) { + if (this->GeneratorTarget->GetType() < cmStateEnums::UTILITY) { isAppContainer = true; } } else if (v == "8.0") { @@ -2878,10 +2879,11 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings() 2); if (isWindowsStore && - this->GeneratorTarget->GetType() < cmState::UTILITY) { + this->GeneratorTarget->GetType() < cmStateEnums::UTILITY) { isAppContainer = true; } else if (isWindowsPhone && - this->GeneratorTarget->GetType() == cmState::EXECUTABLE) { + this->GeneratorTarget->GetType() == + cmStateEnums::EXECUTABLE) { this->WriteString("true\n", 2); this->WriteString("", 2); (*this->BuildFileStream) @@ -2931,7 +2933,7 @@ void cmVisualStudio10TargetGenerator::VerifyNecessaryFiles() { // For Windows and Windows Phone executables, we will assume that if a // manifest is not present that we need to add all the necessary files - if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE) { + if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE) { std::vector manifestSources; this->GeneratorTarget->GetAppManifest(manifestSources, ""); { -- cgit v0.12 From 2fe3e55d53989c909be595b00a4749b75886accf Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 18 Oct 2016 21:28:47 +0200 Subject: cmState: Move CacheEntryType enum to separate namespace Port dependent code to the change. --- Source/CursesDialog/cmCursesBoolWidget.cxx | 2 +- .../CursesDialog/cmCursesCacheEntryComposite.cxx | 10 ++--- Source/CursesDialog/cmCursesDummyWidget.cxx | 2 +- Source/CursesDialog/cmCursesFilePathWidget.cxx | 2 +- Source/CursesDialog/cmCursesMainForm.cxx | 31 ++++++------- Source/CursesDialog/cmCursesMainForm.h | 2 +- Source/CursesDialog/cmCursesOptionsWidget.cxx | 2 +- Source/CursesDialog/cmCursesPathWidget.cxx | 4 +- Source/CursesDialog/cmCursesStringWidget.cxx | 2 +- Source/CursesDialog/cmCursesWidget.h | 4 +- Source/QtDialog/QCMake.cxx | 26 +++++------ Source/cmBuildCommand.cxx | 2 +- Source/cmBuildNameCommand.cxx | 4 +- Source/cmCMakePolicyCommand.cxx | 2 +- Source/cmCPluginAPI.cxx | 12 ++--- Source/cmCTest.cxx | 2 +- Source/cmCacheManager.cxx | 34 +++++++------- Source/cmCacheManager.h | 19 +++++--- Source/cmCoreTryCompile.cxx | 2 +- Source/cmExtraEclipseCDT4Generator.cxx | 5 ++- Source/cmFindBase.cxx | 2 +- Source/cmFindLibraryCommand.cxx | 6 +-- Source/cmFindPackageCommand.cxx | 2 +- Source/cmFindPathCommand.cxx | 7 +-- Source/cmFindProgramCommand.cxx | 6 +-- Source/cmGetFilenameComponentCommand.cxx | 12 ++--- Source/cmGlobalGenerator.cxx | 8 ++-- Source/cmGlobalUnixMakefileGenerator3.cxx | 2 +- Source/cmGlobalVisualStudio7Generator.cxx | 4 +- Source/cmGlobalXCodeGenerator.cxx | 7 +-- Source/cmIncludeExternalMSProjectCommand.cxx | 2 +- Source/cmLoadCacheCommand.cxx | 2 +- Source/cmLocalVisualStudio10Generator.cxx | 2 +- Source/cmLocalVisualStudio7Generator.cxx | 2 +- Source/cmMakefile.cxx | 15 ++++--- Source/cmMakefile.h | 2 +- Source/cmMarkAsAdvancedCommand.cxx | 2 +- Source/cmOptionCommand.cxx | 4 +- Source/cmPolicies.cxx | 2 +- Source/cmProjectCommand.cxx | 6 +-- Source/cmSetCommand.cxx | 9 ++-- Source/cmSiteNameCommand.cxx | 3 +- Source/cmState.cxx | 15 ++++--- Source/cmState.h | 32 ++++++------- Source/cmTarget.cxx | 4 +- Source/cmTryRunCommand.cxx | 11 ++--- Source/cmUtilitySourceCommand.cxx | 4 +- Source/cmake.cxx | 52 +++++++++++----------- Source/cmake.h | 2 +- Source/cmakemain.cxx | 6 +-- 50 files changed, 211 insertions(+), 191 deletions(-) diff --git a/Source/CursesDialog/cmCursesBoolWidget.cxx b/Source/CursesDialog/cmCursesBoolWidget.cxx index 5268a5d..3b81c65 100644 --- a/Source/CursesDialog/cmCursesBoolWidget.cxx +++ b/Source/CursesDialog/cmCursesBoolWidget.cxx @@ -11,7 +11,7 @@ cmCursesBoolWidget::cmCursesBoolWidget(int width, int height, int left, int top) : cmCursesWidget(width, height, left, top) { - this->Type = cmState::BOOL; + this->Type = cmStateEnums::BOOL; set_field_fore(this->Field, A_NORMAL); set_field_back(this->Field, A_STANDOUT); field_opts_off(this->Field, O_STATIC); diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx index 93785e0..46c0d0c 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx @@ -47,7 +47,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( const char* value = cm->GetState()->GetCacheEntryValue(key); assert(value); switch (cm->GetState()->GetCacheEntryType(key)) { - case cmState::BOOL: + case cmStateEnums::BOOL: this->Entry = new cmCursesBoolWidget(this->EntryWidth, 1, 1, 1); if (cmSystemTools::IsOn(value)) { static_cast(this->Entry)->SetValueAsBool(true); @@ -55,15 +55,15 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( static_cast(this->Entry)->SetValueAsBool(false); } break; - case cmState::PATH: + case cmStateEnums::PATH: this->Entry = new cmCursesPathWidget(this->EntryWidth, 1, 1, 1); static_cast(this->Entry)->SetString(value); break; - case cmState::FILEPATH: + case cmStateEnums::FILEPATH: this->Entry = new cmCursesFilePathWidget(this->EntryWidth, 1, 1, 1); static_cast(this->Entry)->SetString(value); break; - case cmState::STRING: { + case cmStateEnums::STRING: { const char* stringsProp = cm->GetState()->GetCacheEntryProperty(key, "STRINGS"); if (stringsProp) { @@ -83,7 +83,7 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( } break; } - case cmState::UNINITIALIZED: + case cmStateEnums::UNINITIALIZED: cmSystemTools::Error("Found an undefined variable: ", key.c_str()); break; default: diff --git a/Source/CursesDialog/cmCursesDummyWidget.cxx b/Source/CursesDialog/cmCursesDummyWidget.cxx index 61d07e2..b5a1daa 100644 --- a/Source/CursesDialog/cmCursesDummyWidget.cxx +++ b/Source/CursesDialog/cmCursesDummyWidget.cxx @@ -9,7 +9,7 @@ cmCursesDummyWidget::cmCursesDummyWidget(int width, int height, int left, int top) : cmCursesWidget(width, height, left, top) { - this->Type = cmState::INTERNAL; + this->Type = cmStateEnums::INTERNAL; } bool cmCursesDummyWidget::HandleInput(int& /*key*/, cmCursesMainForm* /*fm*/, diff --git a/Source/CursesDialog/cmCursesFilePathWidget.cxx b/Source/CursesDialog/cmCursesFilePathWidget.cxx index 670c50f..ee5f2d7 100644 --- a/Source/CursesDialog/cmCursesFilePathWidget.cxx +++ b/Source/CursesDialog/cmCursesFilePathWidget.cxx @@ -9,5 +9,5 @@ cmCursesFilePathWidget::cmCursesFilePathWidget(int width, int height, int left, int top) : cmCursesPathWidget(width, height, left, top) { - this->Type = cmState::FILEPATH; + this->Type = cmStateEnums::FILEPATH; } diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 0c3d29d..0db0200 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -106,10 +106,10 @@ void cmCursesMainForm::InitializeUI() for (std::vector::const_iterator it = cacheKeys.begin(); it != cacheKeys.end(); ++it) { - cmState::CacheEntryType t = + cmStateEnums::CacheEntryType t = this->CMakeInstance->GetState()->GetCacheEntryType(*it); - if (t != cmState::INTERNAL && t != cmState::STATIC && - t != cmState::UNINITIALIZED) { + if (t != cmStateEnums::INTERNAL && t != cmStateEnums::STATIC && + t != cmStateEnums::UNINITIALIZED) { ++count; } } @@ -130,10 +130,10 @@ void cmCursesMainForm::InitializeUI() for (std::vector::const_iterator it = cacheKeys.begin(); it != cacheKeys.end(); ++it) { std::string key = *it; - cmState::CacheEntryType t = + cmStateEnums::CacheEntryType t = this->CMakeInstance->GetState()->GetCacheEntryType(*it); - if (t == cmState::INTERNAL || t == cmState::STATIC || - t == cmState::UNINITIALIZED) { + if (t == cmStateEnums::INTERNAL || t == cmStateEnums::STATIC || + t == cmStateEnums::UNINITIALIZED) { continue; } @@ -148,10 +148,10 @@ void cmCursesMainForm::InitializeUI() for (std::vector::const_iterator it = cacheKeys.begin(); it != cacheKeys.end(); ++it) { std::string key = *it; - cmState::CacheEntryType t = + cmStateEnums::CacheEntryType t = this->CMakeInstance->GetState()->GetCacheEntryType(*it); - if (t == cmState::INTERNAL || t == cmState::STATIC || - t == cmState::UNINITIALIZED) { + if (t == cmStateEnums::INTERNAL || t == cmStateEnums::STATIC || + t == cmStateEnums::UNINITIALIZED) { continue; } @@ -249,8 +249,9 @@ void cmCursesMainForm::Render(int left, int top, int width, int height) cmCursesWidget* cw = reinterpret_cast(field_userptr(currentField)); // If in edit mode, get out of it - if (cw->GetType() == cmState::STRING || cw->GetType() == cmState::PATH || - cw->GetType() == cmState::FILEPATH) { + if (cw->GetType() == cmStateEnums::STRING || + cw->GetType() == cmStateEnums::PATH || + cw->GetType() == cmStateEnums::FILEPATH) { cmCursesStringWidget* sw = static_cast(cw); sw->SetInEdit(false); } @@ -704,7 +705,7 @@ void cmCursesMainForm::FillCacheManagerFromUI() std::string newValue = (*this->Entries)[i]->Entry->GetValue(); std::string fixedOldValue; std::string fixedNewValue; - cmState::CacheEntryType t = + cmStateEnums::CacheEntryType t = this->CMakeInstance->GetState()->GetCacheEntryType(cacheKey); this->FixValue(t, oldValue, fixedOldValue); this->FixValue(t, newValue, fixedNewValue); @@ -720,14 +721,14 @@ void cmCursesMainForm::FillCacheManagerFromUI() } } -void cmCursesMainForm::FixValue(cmState::CacheEntryType type, +void cmCursesMainForm::FixValue(cmStateEnums::CacheEntryType type, const std::string& in, std::string& out) const { out = in.substr(0, in.find_last_not_of(' ') + 1); - if (type == cmState::PATH || type == cmState::FILEPATH) { + if (type == cmStateEnums::PATH || type == cmStateEnums::FILEPATH) { cmSystemTools::ConvertToUnixSlashes(out); } - if (type == cmState::BOOL) { + if (type == cmStateEnums::BOOL) { if (cmSystemTools::IsOff(out.c_str())) { out = "OFF"; } else { diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h index 4bf452d..10ae960 100644 --- a/Source/CursesDialog/cmCursesMainForm.h +++ b/Source/CursesDialog/cmCursesMainForm.h @@ -110,7 +110,7 @@ protected: // cache. void FillCacheManagerFromUI(); // Fix formatting of values to a consistent form. - void FixValue(cmState::CacheEntryType type, const std::string& in, + void FixValue(cmStateEnums::CacheEntryType type, const std::string& in, std::string& out) const; // Re-post the existing fields. Used to toggle between // normal and advanced modes. Render() should be called diff --git a/Source/CursesDialog/cmCursesOptionsWidget.cxx b/Source/CursesDialog/cmCursesOptionsWidget.cxx index e23a82d..1b752a6 100644 --- a/Source/CursesDialog/cmCursesOptionsWidget.cxx +++ b/Source/CursesDialog/cmCursesOptionsWidget.cxx @@ -11,7 +11,7 @@ cmCursesOptionsWidget::cmCursesOptionsWidget(int width, int height, int left, int top) : cmCursesWidget(width, height, left, top) { - this->Type = cmState::BOOL; // this is a bit of a hack + this->Type = cmStateEnums::BOOL; // this is a bit of a hack // there is no option type, and string type causes ccmake to cast // the widget into a string widget at some point. BOOL is safe for // now. diff --git a/Source/CursesDialog/cmCursesPathWidget.cxx b/Source/CursesDialog/cmCursesPathWidget.cxx index d208598..3f96436 100644 --- a/Source/CursesDialog/cmCursesPathWidget.cxx +++ b/Source/CursesDialog/cmCursesPathWidget.cxx @@ -13,7 +13,7 @@ cmCursesPathWidget::cmCursesPathWidget(int width, int height, int left, int top) : cmCursesStringWidget(width, height, left, top) { - this->Type = cmState::PATH; + this->Type = cmStateEnums::PATH; this->Cycle = false; this->CurrentIndex = 0; } @@ -50,7 +50,7 @@ void cmCursesPathWidget::OnTab(cmCursesMainForm* fm, WINDOW* w) std::vector dirs; cmSystemTools::SimpleGlob(glob, dirs, - (this->Type == cmState::PATH ? -1 : 0)); + (this->Type == cmStateEnums::PATH ? -1 : 0)); if (this->CurrentIndex < dirs.size()) { cstr = dirs[this->CurrentIndex]; } diff --git a/Source/CursesDialog/cmCursesStringWidget.cxx b/Source/CursesDialog/cmCursesStringWidget.cxx index f068f67..0f67d23 100644 --- a/Source/CursesDialog/cmCursesStringWidget.cxx +++ b/Source/CursesDialog/cmCursesStringWidget.cxx @@ -21,7 +21,7 @@ cmCursesStringWidget::cmCursesStringWidget(int width, int height, int left, : cmCursesWidget(width, height, left, top) { this->InEdit = false; - this->Type = cmState::STRING; + this->Type = cmStateEnums::STRING; set_field_fore(this->Field, A_NORMAL); set_field_back(this->Field, A_STANDOUT); field_opts_off(this->Field, O_STATIC); diff --git a/Source/CursesDialog/cmCursesWidget.h b/Source/CursesDialog/cmCursesWidget.h index bb26cf6..1ef4ab2 100644 --- a/Source/CursesDialog/cmCursesWidget.h +++ b/Source/CursesDialog/cmCursesWidget.h @@ -41,7 +41,7 @@ public: /** * Get the type of the widget (STRING, PATH etc...) */ - cmState::CacheEntryType GetType() { return this->Type; } + cmStateEnums::CacheEntryType GetType() { return this->Type; } /** * If there are any, print the widget specific commands @@ -62,7 +62,7 @@ protected: cmCursesWidget(const cmCursesWidget& from); void operator=(const cmCursesWidget&); - cmState::CacheEntryType Type; + cmStateEnums::CacheEntryType Type; std::string Value; FIELD* Field; // The page in the main form this widget is in diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index cfb10f3..abeff97 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -196,8 +196,8 @@ void QCMake::setProperties(const QCMakePropertyList& newProps) std::vector cacheKeys = state->GetCacheEntryKeys(); for (std::vector::const_iterator it = cacheKeys.begin(); it != cacheKeys.end(); ++it) { - cmState::CacheEntryType t = state->GetCacheEntryType(*it); - if (t == cmState::INTERNAL || t == cmState::STATIC) { + cmStateEnums::CacheEntryType t = state->GetCacheEntryType(*it); + if (t == cmStateEnums::INTERNAL || t == cmStateEnums::STATIC) { continue; } @@ -232,19 +232,19 @@ void QCMake::setProperties(const QCMakePropertyList& newProps) if (s.Type == QCMakeProperty::BOOL) { this->CMakeInstance->AddCacheEntry( s.Key.toLocal8Bit().data(), s.Value.toBool() ? "ON" : "OFF", - s.Help.toLocal8Bit().data(), cmState::BOOL); + s.Help.toLocal8Bit().data(), cmStateEnums::BOOL); } else if (s.Type == QCMakeProperty::STRING) { this->CMakeInstance->AddCacheEntry( s.Key.toLocal8Bit().data(), s.Value.toString().toLocal8Bit().data(), - s.Help.toLocal8Bit().data(), cmState::STRING); + s.Help.toLocal8Bit().data(), cmStateEnums::STRING); } else if (s.Type == QCMakeProperty::PATH) { this->CMakeInstance->AddCacheEntry( s.Key.toLocal8Bit().data(), s.Value.toString().toLocal8Bit().data(), - s.Help.toLocal8Bit().data(), cmState::PATH); + s.Help.toLocal8Bit().data(), cmStateEnums::PATH); } else if (s.Type == QCMakeProperty::FILEPATH) { this->CMakeInstance->AddCacheEntry( s.Key.toLocal8Bit().data(), s.Value.toString().toLocal8Bit().data(), - s.Help.toLocal8Bit().data(), cmState::FILEPATH); + s.Help.toLocal8Bit().data(), cmStateEnums::FILEPATH); } } @@ -259,9 +259,9 @@ QCMakePropertyList QCMake::properties() const std::vector cacheKeys = state->GetCacheEntryKeys(); for (std::vector::const_iterator i = cacheKeys.begin(); i != cacheKeys.end(); ++i) { - cmState::CacheEntryType t = state->GetCacheEntryType(*i); - if (t == cmState::INTERNAL || t == cmState::STATIC || - t == cmState::UNINITIALIZED) { + cmStateEnums::CacheEntryType t = state->GetCacheEntryType(*i); + if (t == cmStateEnums::INTERNAL || t == cmStateEnums::STATIC || + t == cmStateEnums::UNINITIALIZED) { continue; } @@ -273,14 +273,14 @@ QCMakePropertyList QCMake::properties() const QString::fromLocal8Bit(state->GetCacheEntryProperty(*i, "HELPSTRING")); prop.Value = QString::fromLocal8Bit(cachedValue); prop.Advanced = state->GetCacheEntryPropertyAsBool(*i, "ADVANCED"); - if (t == cmState::BOOL) { + if (t == cmStateEnums::BOOL) { prop.Type = QCMakeProperty::BOOL; prop.Value = cmSystemTools::IsOn(cachedValue); - } else if (t == cmState::PATH) { + } else if (t == cmStateEnums::PATH) { prop.Type = QCMakeProperty::PATH; - } else if (t == cmState::FILEPATH) { + } else if (t == cmStateEnums::FILEPATH) { prop.Type = QCMakeProperty::FILEPATH; - } else if (t == cmState::STRING) { + } else if (t == cmStateEnums::STRING) { prop.Type = QCMakeProperty::STRING; const char* stringsProperty = state->GetCacheEntryProperty(*i, "STRINGS"); diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx index 365a426..8aa4102 100644 --- a/Source/cmBuildCommand.cxx +++ b/Source/cmBuildCommand.cxx @@ -116,6 +116,6 @@ bool cmBuildCommand::TwoArgsSignature(std::vector const& args) this->Makefile->AddCacheDefinition(define, makecommand.c_str(), "Command used to build entire project " "from the command line.", - cmState::STRING); + cmStateEnums::STRING); return true; } diff --git a/Source/cmBuildNameCommand.cxx b/Source/cmBuildNameCommand.cxx index 9134b9a..816147b 100644 --- a/Source/cmBuildNameCommand.cxx +++ b/Source/cmBuildNameCommand.cxx @@ -27,7 +27,7 @@ bool cmBuildNameCommand::InitialPass(std::vector const& args, std::replace(cv.begin(), cv.end(), '(', '_'); std::replace(cv.begin(), cv.end(), ')', '_'); this->Makefile->AddCacheDefinition(args[0], cv.c_str(), "Name of build.", - cmState::STRING); + cmStateEnums::STRING); } return true; } @@ -53,6 +53,6 @@ bool cmBuildNameCommand::InitialPass(std::vector const& args, std::replace(buildname.begin(), buildname.end(), ')', '_'); this->Makefile->AddCacheDefinition(args[0], buildname.c_str(), - "Name of build.", cmState::STRING); + "Name of build.", cmStateEnums::STRING); return true; } diff --git a/Source/cmCMakePolicyCommand.cxx b/Source/cmCMakePolicyCommand.cxx index eea76f2..36ffd7c 100644 --- a/Source/cmCMakePolicyCommand.cxx +++ b/Source/cmCMakePolicyCommand.cxx @@ -79,7 +79,7 @@ bool cmCMakePolicyCommand::HandleSetMode(std::vector const& args) "For backwards compatibility, what version of CMake " "commands and " "syntax should this version of CMake try to support.", - cmState::STRING); + cmStateEnums::STRING); } } return true; diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 98e18ed..155456a 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -75,22 +75,22 @@ void CCONV cmAddCacheDefinition(void* arg, const char* name, const char* value, switch (type) { case CM_CACHE_BOOL: - mf->AddCacheDefinition(name, value, doc, cmState::BOOL); + mf->AddCacheDefinition(name, value, doc, cmStateEnums::BOOL); break; case CM_CACHE_PATH: - mf->AddCacheDefinition(name, value, doc, cmState::PATH); + mf->AddCacheDefinition(name, value, doc, cmStateEnums::PATH); break; case CM_CACHE_FILEPATH: - mf->AddCacheDefinition(name, value, doc, cmState::FILEPATH); + mf->AddCacheDefinition(name, value, doc, cmStateEnums::FILEPATH); break; case CM_CACHE_STRING: - mf->AddCacheDefinition(name, value, doc, cmState::STRING); + mf->AddCacheDefinition(name, value, doc, cmStateEnums::STRING); break; case CM_CACHE_INTERNAL: - mf->AddCacheDefinition(name, value, doc, cmState::INTERNAL); + mf->AddCacheDefinition(name, value, doc, cmStateEnums::INTERNAL); break; case CM_CACHE_STATIC: - mf->AddCacheDefinition(name, value, doc, cmState::STATIC); + mf->AddCacheDefinition(name, value, doc, cmStateEnums::STATIC); break; } } diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 7dc9e33..3a37eeb 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1969,7 +1969,7 @@ bool cmCTest::AddVariableDefinition(const std::string& arg) { std::string name; std::string value; - cmState::CacheEntryType type = cmState::UNINITIALIZED; + cmStateEnums::CacheEntryType type = cmStateEnums::UNINITIALIZED; if (cmake::ParseCacheEntry(arg, name, value, type)) { this->Definitions[name] = value; diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 4b03499..e84012c 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -94,13 +94,13 @@ bool cmCacheManager::LoadCache(const std::string& path, bool internal, // If the entry is not internal to the cache being loaded // or if it is in the list of internal entries to be // imported, load it. - if (internal || (e.Type != cmState::INTERNAL) || + if (internal || (e.Type != cmStateEnums::INTERNAL) || (includes.find(entryKey) != includes.end())) { // If we are loading the cache from another project, // make all loaded entries internal so that it is // not visible in the gui if (!internal) { - e.Type = cmState::INTERNAL; + e.Type = cmStateEnums::INTERNAL; helpString = "DO NOT EDIT, "; helpString += entryKey; helpString += " loaded from external file. " @@ -142,11 +142,11 @@ bool cmCacheManager::LoadCache(const std::string& path, bool internal, this->AddCacheEntry("CMAKE_CACHE_MINOR_VERSION", "0", "Minor version of cmake used to create the " "current loaded cache", - cmState::INTERNAL); + cmStateEnums::INTERNAL); this->AddCacheEntry("CMAKE_CACHE_MAJOR_VERSION", "0", "Major version of cmake used to create the " "current loaded cache", - cmState::INTERNAL); + cmStateEnums::INTERNAL); } // check to make sure the cache directory has not // been moved @@ -178,7 +178,7 @@ bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey, CacheEntry& e) { // All property entries are internal. - if (e.Type != cmState::INTERNAL) { + if (e.Type != cmStateEnums::INTERNAL) { return false; } @@ -192,7 +192,7 @@ bool cmCacheManager::ReadPropertyEntry(std::string const& entryKey, if (it.IsAtEnd()) { // Create an entry and store the property. CacheEntry& ne = this->Cache[key]; - ne.Type = cmState::UNINITIALIZED; + ne.Type = cmStateEnums::UNINITIALIZED; ne.SetProperty(*p, e.Value.c_str()); } else { // Store this property on its entry. @@ -244,17 +244,17 @@ bool cmCacheManager::SaveCache(const std::string& path) this->AddCacheEntry("CMAKE_CACHE_MINOR_VERSION", temp, "Minor version of cmake used to create the " "current loaded cache", - cmState::INTERNAL); + cmStateEnums::INTERNAL); sprintf(temp, "%d", cmVersion::GetMajorVersion()); this->AddCacheEntry("CMAKE_CACHE_MAJOR_VERSION", temp, "Major version of cmake used to create the " "current loaded cache", - cmState::INTERNAL); + cmStateEnums::INTERNAL); sprintf(temp, "%d", cmVersion::GetPatchVersion()); this->AddCacheEntry("CMAKE_CACHE_PATCH_VERSION", temp, "Patch version of cmake used to create the " "current loaded cache", - cmState::INTERNAL); + cmStateEnums::INTERNAL); // Let us store the current working directory so that if somebody // Copies it, he will not be surprised @@ -268,7 +268,7 @@ bool cmCacheManager::SaveCache(const std::string& path) this->AddCacheEntry("CMAKE_CACHEFILE_DIR", currentcwd.c_str(), "This is the directory where this CMakeCache.txt" " was created", - cmState::INTERNAL); + cmStateEnums::INTERNAL); /* clang-format off */ fout << "# This is the CMakeCache file.\n" @@ -301,14 +301,14 @@ bool cmCacheManager::SaveCache(const std::string& path) this->Cache.begin(); i != this->Cache.end(); ++i) { const CacheEntry& ce = (*i).second; - cmState::CacheEntryType t = ce.Type; + cmStateEnums::CacheEntryType t = ce.Type; if (!ce.Initialized) { /* // This should be added in, but is not for now. cmSystemTools::Error("Cache entry \"", (*i).first.c_str(), "\" is uninitialized"); */ - } else if (t != cmState::INTERNAL) { + } else if (t != cmStateEnums::INTERNAL) { // Format is key:type=value if (const char* help = ce.GetProperty("HELPSTRING")) { cmCacheManager::OutputHelpString(fout, help); @@ -334,9 +334,9 @@ bool cmCacheManager::SaveCache(const std::string& path) continue; } - cmState::CacheEntryType t = i.GetType(); + cmStateEnums::CacheEntryType t = i.GetType(); this->WritePropertyEntries(fout, i); - if (t == cmState::INTERNAL) { + if (t == cmStateEnums::INTERNAL) { // Format is key:type=value if (const char* help = i.GetProperty("HELPSTRING")) { this->OutputHelpString(fout, help); @@ -465,7 +465,7 @@ void cmCacheManager::PrintCache(std::ostream& out) const for (std::map::const_iterator i = this->Cache.begin(); i != this->Cache.end(); ++i) { - if ((*i).second.Type != cmState::INTERNAL) { + if ((*i).second.Type != cmStateEnums::INTERNAL) { out << (*i).first << " = " << (*i).second.Value << std::endl; } } @@ -477,7 +477,7 @@ void cmCacheManager::PrintCache(std::ostream& out) const void cmCacheManager::AddCacheEntry(const std::string& key, const char* value, const char* helpString, - cmState::CacheEntryType type) + cmStateEnums::CacheEntryType type) { CacheEntry& e = this->Cache[key]; if (value) { @@ -488,7 +488,7 @@ void cmCacheManager::AddCacheEntry(const std::string& key, const char* value, } e.Type = type; // make sure we only use unix style paths - if (type == cmState::FILEPATH || type == cmState::PATH) { + if (type == cmStateEnums::FILEPATH || type == cmStateEnums::PATH) { if (e.Value.find(';') != e.Value.npos) { std::vector paths; cmSystemTools::ExpandListArgument(e.Value, paths); diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index 16a2e78..90731f5 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -34,7 +34,7 @@ private: struct CacheEntry { std::string Value; - cmState::CacheEntryType Type; + cmStateEnums::CacheEntryType Type; cmPropertyMap Properties; std::vector GetPropertyList() const; const char* GetProperty(const std::string&) const; @@ -44,7 +44,7 @@ private: bool Initialized; CacheEntry() : Value("") - , Type(cmState::UNINITIALIZED) + , Type(cmStateEnums::UNINITIALIZED) , Initialized(false) { } @@ -70,8 +70,14 @@ public: const char* GetValue() const { return this->GetEntry().Value.c_str(); } bool GetValueAsBool() const; void SetValue(const char*); - cmState::CacheEntryType GetType() const { return this->GetEntry().Type; } - void SetType(cmState::CacheEntryType ty) { this->GetEntry().Type = ty; } + cmStateEnums::CacheEntryType GetType() const + { + return this->GetEntry().Type; + } + void SetType(cmStateEnums::CacheEntryType ty) + { + this->GetEntry().Type = ty; + } bool Initialized() { return this->GetEntry().Initialized; } cmCacheManager& Container; std::map::iterator Position; @@ -137,7 +143,7 @@ public: return this->GetCacheIterator(key.c_str()).GetProperty(propName); } - cmState::CacheEntryType GetCacheEntryType(std::string const& key) + cmStateEnums::CacheEntryType GetCacheEntryType(std::string const& key) { return this->GetCacheIterator(key.c_str()).GetType(); } @@ -200,7 +206,8 @@ public: protected: ///! Add an entry into the cache void AddCacheEntry(const std::string& key, const char* value, - const char* helpString, cmState::CacheEntryType type); + const char* helpString, + cmStateEnums::CacheEntryType type); ///! Get a cache entry object for a key CacheEntry* GetCacheEntry(const std::string& key); diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index cafba86..e4a97a1 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -531,7 +531,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv, // set the result var to the return value to indicate success or failure this->Makefile->AddCacheDefinition(argv[0], (res == 0 ? "TRUE" : "FALSE"), "Result of TRY_COMPILE", - cmState::INTERNAL); + cmStateEnums::INTERNAL); if (!outputVariable.empty()) { this->Makefile->AddDefinition(outputVariable, output.c_str()); diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 7535e8c..b50db25 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -230,7 +230,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(std::ostream& out, // in the cache valueToUse = envVarValue; mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(), - cacheEntryName.c_str(), cmState::STRING, true); + cacheEntryName.c_str(), cmStateEnums::STRING, true); mf->GetCMakeInstance()->SaveCache(lg->GetBinaryDirectory()); } else if (!envVarSet && cacheValue != CM_NULLPTR) { // It is already in the cache, but not in the env, so use it from the cache @@ -245,7 +245,8 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(std::ostream& out, if (valueToUse.find(envVarValue) == std::string::npos) { valueToUse = envVarValue; mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(), - cacheEntryName.c_str(), cmState::STRING, true); + cacheEntryName.c_str(), cmStateEnums::STRING, + true); mf->GetCMakeInstance()->SaveCache(lg->GetBinaryDirectory()); } } diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index 982d740..b8b3463 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -308,7 +308,7 @@ bool cmFindBase::CheckForVariableInCache() // this. if (cached && state->GetCacheEntryType(this->VariableName) == - cmState::UNINITIALIZED) { + cmStateEnums::UNINITIALIZED) { this->AlreadyInCacheWithoutMetaInfo = true; } return true; diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index 082350f..2909209 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -26,7 +26,7 @@ bool cmFindLibraryCommand::InitialPass(std::vector const& argsIn, if (this->AlreadyInCacheWithoutMetaInfo) { this->Makefile->AddCacheDefinition(this->VariableName, "", this->VariableDocumentation.c_str(), - cmState::FILEPATH); + cmStateEnums::FILEPATH); } return true; } @@ -52,13 +52,13 @@ bool cmFindLibraryCommand::InitialPass(std::vector const& argsIn, // Save the value in the cache this->Makefile->AddCacheDefinition(this->VariableName, library.c_str(), this->VariableDocumentation.c_str(), - cmState::FILEPATH); + cmStateEnums::FILEPATH); return true; } std::string notfound = this->VariableName + "-NOTFOUND"; this->Makefile->AddCacheDefinition(this->VariableName, notfound.c_str(), this->VariableDocumentation.c_str(), - cmState::FILEPATH); + cmStateEnums::FILEPATH); return true; } diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 554618e..5723999 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -890,7 +890,7 @@ bool cmFindPackageCommand::FindConfig() help += "."; // We force the value since we do not get here if it was already set. this->Makefile->AddCacheDefinition(this->Variable, init.c_str(), - help.c_str(), cmState::PATH, true); + help.c_str(), cmStateEnums::PATH, true); return found; } diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx index 35929fe..7d37185 100644 --- a/Source/cmFindPathCommand.cxx +++ b/Source/cmFindPathCommand.cxx @@ -26,7 +26,8 @@ bool cmFindPathCommand::InitialPass(std::vector const& argsIn, if (this->AlreadyInCacheWithoutMetaInfo) { this->Makefile->AddCacheDefinition( this->VariableName, "", this->VariableDocumentation.c_str(), - (this->IncludeFileInPath ? cmState::FILEPATH : cmState::PATH)); + (this->IncludeFileInPath ? cmStateEnums::FILEPATH + : cmStateEnums::PATH)); } return true; } @@ -35,13 +36,13 @@ bool cmFindPathCommand::InitialPass(std::vector const& argsIn, if (!result.empty()) { this->Makefile->AddCacheDefinition( this->VariableName, result.c_str(), this->VariableDocumentation.c_str(), - (this->IncludeFileInPath) ? cmState::FILEPATH : cmState::PATH); + (this->IncludeFileInPath) ? cmStateEnums::FILEPATH : cmStateEnums::PATH); return true; } this->Makefile->AddCacheDefinition( this->VariableName, (this->VariableName + "-NOTFOUND").c_str(), this->VariableDocumentation.c_str(), - (this->IncludeFileInPath) ? cmState::FILEPATH : cmState::PATH); + (this->IncludeFileInPath) ? cmStateEnums::FILEPATH : cmStateEnums::PATH); return true; } diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx index a6f2518..9886860 100644 --- a/Source/cmFindProgramCommand.cxx +++ b/Source/cmFindProgramCommand.cxx @@ -90,7 +90,7 @@ bool cmFindProgramCommand::InitialPass(std::vector const& argsIn, if (this->AlreadyInCacheWithoutMetaInfo) { this->Makefile->AddCacheDefinition(this->VariableName, "", this->VariableDocumentation.c_str(), - cmState::FILEPATH); + cmStateEnums::FILEPATH); } return true; } @@ -100,13 +100,13 @@ bool cmFindProgramCommand::InitialPass(std::vector const& argsIn, // Save the value in the cache this->Makefile->AddCacheDefinition(this->VariableName, result.c_str(), this->VariableDocumentation.c_str(), - cmState::FILEPATH); + cmStateEnums::FILEPATH); return true; } this->Makefile->AddCacheDefinition( this->VariableName, (this->VariableName + "-NOTFOUND").c_str(), - this->VariableDocumentation.c_str(), cmState::FILEPATH); + this->VariableDocumentation.c_str(), cmStateEnums::FILEPATH); return true; } diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx index 05dbfb4..c183947 100644 --- a/Source/cmGetFilenameComponentCommand.cxx +++ b/Source/cmGetFilenameComponentCommand.cxx @@ -88,13 +88,13 @@ bool cmGetFilenameComponentCommand::InitialPass( if (args.size() >= 4 && args[args.size() - 1] == "CACHE") { if (!programArgs.empty() && !storeArgs.empty()) { - this->Makefile->AddCacheDefinition(storeArgs, programArgs.c_str(), "", - args[2] == "PATH" ? cmState::FILEPATH - : cmState::STRING); + this->Makefile->AddCacheDefinition( + storeArgs, programArgs.c_str(), "", + args[2] == "PATH" ? cmStateEnums::FILEPATH : cmStateEnums::STRING); } - this->Makefile->AddCacheDefinition(args[0], result.c_str(), "", - args[2] == "PATH" ? cmState::FILEPATH - : cmState::STRING); + this->Makefile->AddCacheDefinition( + args[0], result.c_str(), "", + args[2] == "PATH" ? cmStateEnums::FILEPATH : cmStateEnums::STRING); } else { if (!programArgs.empty() && !storeArgs.empty()) { this->Makefile->AddDefinition(storeArgs, programArgs.c_str()); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 58c6a00..efa95a5 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -308,7 +308,7 @@ void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf) makeProgram += "/"; makeProgram += saveFile; mf->AddCacheDefinition("CMAKE_MAKE_PROGRAM", makeProgram.c_str(), - "make program", cmState::FILEPATH); + "make program", cmStateEnums::FILEPATH); } } @@ -1103,7 +1103,7 @@ void cmGlobalGenerator::Configure() sprintf(num, "%d", static_cast(this->Makefiles.size())); this->GetCMakeInstance()->AddCacheEntry("CMAKE_NUMBER_OF_MAKEFILES", num, "number of local generators", - cmState::INTERNAL); + cmStateEnums::INTERNAL); // check for link libraries and include directories containing "NOTFOUND" // and for infinite loops @@ -1886,8 +1886,8 @@ void cmGlobalGenerator::EnableLanguagesFromGenerator(cmGlobalGenerator* gen, this->TryCompileOuterMakefile = mf; const char* make = gen->GetCMakeInstance()->GetCacheDefinition("CMAKE_MAKE_PROGRAM"); - this->GetCMakeInstance()->AddCacheEntry("CMAKE_MAKE_PROGRAM", make, - "make program", cmState::FILEPATH); + this->GetCMakeInstance()->AddCacheEntry( + "CMAKE_MAKE_PROGRAM", make, "make program", cmStateEnums::FILEPATH); // copy the enabled languages this->GetCMakeInstance()->GetState()->SetEnabledLanguages( gen->GetCMakeInstance()->GetState()->GetEnabledLanguages()); diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 615670c..45f8151 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -93,7 +93,7 @@ std::string cmGlobalUnixMakefileGenerator3::GetEditCacheCommand() const if (!editCacheCommand.empty()) { cm->AddCacheEntry("CMAKE_EDIT_COMMAND", editCacheCommand.c_str(), "Path to cache edit program executable.", - cmState::INTERNAL); + cmStateEnums::INTERNAL); } } const char* edit_cmd = cm->GetCacheDefinition("CMAKE_EDIT_COMMAND"); diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 1ffcf07..635d07e 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -101,7 +101,7 @@ void cmGlobalVisualStudio7Generator::EnableLanguage( "Semicolon separated list of supported configuration types, " "only supports Debug, Release, MinSizeRel, and RelWithDebInfo, " "anything else will be ignored.", - cmState::STRING); + cmStateEnums::STRING); } // Create list of configurations requested by user's cache, if any. @@ -118,7 +118,7 @@ void cmGlobalVisualStudio7Generator::EnableLanguage( if (cmSystemTools::GetEnv("CMAKE_MSVCIDE_RUN_PATH", extraPath)) { mf->AddCacheDefinition("CMAKE_MSVCIDE_RUN_PATH", extraPath.c_str(), "Saved environment variable CMAKE_MSVCIDE_RUN_PATH", - cmState::STATIC); + cmStateEnums::STATIC); } } diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 34a01d6..6de4caa 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -257,7 +257,7 @@ void cmGlobalXCodeGenerator::EnableLanguage( "Semicolon separated list of supported configuration types, " "only supports Debug, Release, MinSizeRel, and RelWithDebInfo, " "anything else will be ignored.", - cmState::STRING); + cmStateEnums::STRING); } } mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1"); @@ -2432,8 +2432,9 @@ std::string cmGlobalXCodeGenerator::GetOrCreateId(const std::string& name, return storedGUID; } - this->CMakeInstance->AddCacheEntry( - guidStoreName, id.c_str(), "Stored Xcode object GUID", cmState::INTERNAL); + this->CMakeInstance->AddCacheEntry(guidStoreName, id.c_str(), + "Stored Xcode object GUID", + cmStateEnums::INTERNAL); return id; } diff --git a/Source/cmIncludeExternalMSProjectCommand.cxx b/Source/cmIncludeExternalMSProjectCommand.cxx index 57bf33e..d598722 100644 --- a/Source/cmIncludeExternalMSProjectCommand.cxx +++ b/Source/cmIncludeExternalMSProjectCommand.cxx @@ -66,7 +66,7 @@ bool cmIncludeExternalMSProjectCommand::InitialPass( std::string guidVariable = utility_name + "_GUID_CMAKE"; this->Makefile->GetCMakeInstance()->AddCacheEntry( guidVariable.c_str(), customGuid.c_str(), "Stored GUID", - cmState::INTERNAL); + cmStateEnums::INTERNAL); } // Create a target instance for this utility. diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx index 3428a6c..49db5b0 100644 --- a/Source/cmLoadCacheCommand.cxx +++ b/Source/cmLoadCacheCommand.cxx @@ -140,7 +140,7 @@ void cmLoadCacheCommand::CheckLine(const char* line) // Check one line of the cache file. std::string var; std::string value; - cmState::CacheEntryType type = cmState::UNINITIALIZED; + cmStateEnums::CacheEntryType type = cmStateEnums::UNINITIALIZED; if (cmake::ParseCacheEntry(line, var, value, type)) { // Found a real entry. See if this one was requested. if (this->VariablesToRead.find(var) != this->VariablesToRead.end()) { diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx index 006cdf8..0516bdf 100644 --- a/Source/cmLocalVisualStudio10Generator.cxx +++ b/Source/cmLocalVisualStudio10Generator.cxx @@ -95,7 +95,7 @@ void cmLocalVisualStudio10Generator::ReadAndStoreExternalGUID( // save the GUID in the cache this->GlobalGenerator->GetCMakeInstance()->AddCacheEntry( guidStoreName.c_str(), parser.GUID.c_str(), "Stored GUID", - cmState::INTERNAL); + cmStateEnums::INTERNAL); } const char* cmLocalVisualStudio10Generator::ReportErrorLabel() const diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 1ea56b4..7c32e6c 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -2118,7 +2118,7 @@ void cmLocalVisualStudio7Generator::ReadAndStoreExternalGUID( // save the GUID in the cache this->GlobalGenerator->GetCMakeInstance()->AddCacheEntry( guidStoreName.c_str(), parser.GUID.c_str(), "Stored GUID", - cmState::INTERNAL); + cmStateEnums::INTERNAL); } std::string cmLocalVisualStudio7Generator::GetTargetDirectory( diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 65116d5..5036b0d 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1643,20 +1643,21 @@ void cmMakefile::AddDefinition(const std::string& name, const char* value) void cmMakefile::AddCacheDefinition(const std::string& name, const char* value, const char* doc, - cmState::CacheEntryType type, bool force) + cmStateEnums::CacheEntryType type, + bool force) { const char* existingValue = this->GetState()->GetInitializedCacheValue(name); // must be outside the following if() to keep it alive long enough std::string nvalue; - if (existingValue && - (this->GetState()->GetCacheEntryType(name) == cmState::UNINITIALIZED)) { + if (existingValue && (this->GetState()->GetCacheEntryType(name) == + cmStateEnums::UNINITIALIZED)) { // if this is not a force, then use the value from the cache // if it is a force, then use the value being passed in if (!force) { value = existingValue; } - if (type == cmState::PATH || type == cmState::FILEPATH) { + if (type == cmStateEnums::PATH || type == cmStateEnums::FILEPATH) { std::vector::size_type cc; std::vector files; nvalue = value ? value : ""; @@ -3177,7 +3178,7 @@ int cmMakefile::TryCompile(const std::string& srcdir, // Add this before the user-provided CMake arguments in case // one of the arguments is -DCMAKE_BUILD_TYPE=... cm.AddCacheEntry("CMAKE_BUILD_TYPE", config, "Build configuration", - cmState::STRING); + cmStateEnums::STRING); } } // if cmake args were provided then pass them in @@ -3213,10 +3214,10 @@ int cmMakefile::TryCompile(const std::string& srcdir, gg->EnableLanguagesFromGenerator(this->GetGlobalGenerator(), this); if (this->IsOn("CMAKE_SUPPRESS_DEVELOPER_WARNINGS")) { cm.AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", "TRUE", "", - cmState::INTERNAL); + cmStateEnums::INTERNAL); } else { cm.AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", "FALSE", "", - cmState::INTERNAL); + cmStateEnums::INTERNAL); } if (cm.Configure() != 0) { cmSystemTools::Error( diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 71078ab..e7e8a0b 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -224,7 +224,7 @@ public: void AddDefinition(const std::string& name, const char* value); ///! Add a definition to this makefile and the global cmake cache. void AddCacheDefinition(const std::string& name, const char* value, - const char* doc, cmState::CacheEntryType type, + const char* doc, cmStateEnums::CacheEntryType type, bool force = false); /** diff --git a/Source/cmMarkAsAdvancedCommand.cxx b/Source/cmMarkAsAdvancedCommand.cxx index 5ec1620..8f9e288 100644 --- a/Source/cmMarkAsAdvancedCommand.cxx +++ b/Source/cmMarkAsAdvancedCommand.cxx @@ -26,7 +26,7 @@ bool cmMarkAsAdvancedCommand::InitialPass(std::vector const& args, cmState* state = this->Makefile->GetState(); if (!state->GetCacheEntryValue(variable)) { this->Makefile->GetCMakeInstance()->AddCacheEntry( - variable, CM_NULLPTR, CM_NULLPTR, cmState::UNINITIALIZED); + variable, CM_NULLPTR, CM_NULLPTR, cmStateEnums::UNINITIALIZED); overwrite = true; } if (!state->GetCacheEntryValue(variable)) { diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx index 946a543..0186ef2 100644 --- a/Source/cmOptionCommand.cxx +++ b/Source/cmOptionCommand.cxx @@ -32,7 +32,7 @@ bool cmOptionCommand::InitialPass(std::vector const& args, cmState* state = this->Makefile->GetState(); const char* existingValue = state->GetCacheEntryValue(args[0]); if (existingValue) { - if (state->GetCacheEntryType(args[0]) != cmState::UNINITIALIZED) { + if (state->GetCacheEntryType(args[0]) != cmStateEnums::UNINITIALIZED) { state->SetCacheEntryProperty(args[0], "HELPSTRING", args[1]); return true; } @@ -43,6 +43,6 @@ bool cmOptionCommand::InitialPass(std::vector const& args, } bool init = cmSystemTools::IsOn(initialValue.c_str()); this->Makefile->AddCacheDefinition(args[0], init ? "ON" : "OFF", - args[1].c_str(), cmState::BOOL); + args[1].c_str(), cmStateEnums::BOOL); return true; } diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 3402191..25acb52 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -233,7 +233,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, const char* version) "For backwards compatibility, what version of CMake " "commands and " "syntax should this version of CMake try to support.", - cmState::STRING); + cmStateEnums::STRING); } } } diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index c34a94b..c27da8e 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -19,10 +19,10 @@ bool cmProjectCommand::InitialPass(std::vector const& args, this->Makefile->AddCacheDefinition( bindir, this->Makefile->GetCurrentBinaryDirectory(), - "Value Computed by CMake", cmState::STATIC); + "Value Computed by CMake", cmStateEnums::STATIC); this->Makefile->AddCacheDefinition( srcdir, this->Makefile->GetCurrentSourceDirectory(), - "Value Computed by CMake", cmState::STATIC); + "Value Computed by CMake", cmStateEnums::STATIC); bindir = "PROJECT_BINARY_DIR"; srcdir = "PROJECT_SOURCE_DIR"; @@ -45,7 +45,7 @@ bool cmProjectCommand::InitialPass(std::vector const& args, this->Makefile->AddDefinition("CMAKE_PROJECT_NAME", args[0].c_str()); this->Makefile->AddCacheDefinition("CMAKE_PROJECT_NAME", args[0].c_str(), "Value Computed by CMake", - cmState::STATIC); + cmStateEnums::STATIC); } bool haveVersion = false; diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx index 8ce0b18..65b0e9c 100644 --- a/Source/cmSetCommand.cxx +++ b/Source/cmSetCommand.cxx @@ -64,8 +64,9 @@ bool cmSetCommand::InitialPass(std::vector const& args, bool cache = false; // optional bool force = false; // optional bool parentScope = false; - cmState::CacheEntryType type = cmState::STRING; // required if cache - const char* docstring = CM_NULLPTR; // required if cache + cmStateEnums::CacheEntryType type = + cmStateEnums::STRING; // required if cache + const char* docstring = CM_NULLPTR; // required if cache unsigned int ignoreLastArgs = 0; // look for PARENT_SCOPE argument @@ -115,12 +116,12 @@ bool cmSetCommand::InitialPass(std::vector const& args, cmState* state = this->Makefile->GetState(); const char* existingValue = state->GetCacheEntryValue(variable); if (existingValue && - (state->GetCacheEntryType(variable) != cmState::UNINITIALIZED)) { + (state->GetCacheEntryType(variable) != cmStateEnums::UNINITIALIZED)) { // if the set is trying to CACHE the value but the value // is already in the cache and the type is not internal // then leave now without setting any definitions in the cache // or the makefile - if (cache && type != cmState::INTERNAL && !force) { + if (cache && type != cmStateEnums::INTERNAL && !force) { return true; } } diff --git a/Source/cmSiteNameCommand.cxx b/Source/cmSiteNameCommand.cxx index dbd3ed9..7664eca 100644 --- a/Source/cmSiteNameCommand.cxx +++ b/Source/cmSiteNameCommand.cxx @@ -68,7 +68,8 @@ bool cmSiteNameCommand::InitialPass(std::vector const& args, #endif this->Makefile->AddCacheDefinition( args[0], siteName.c_str(), - "Name of the computer/site where compile is being run", cmState::STRING); + "Name of the computer/site where compile is being run", + cmStateEnums::STRING); return true; } diff --git a/Source/cmState.cxx b/Source/cmState.cxx index cdadbda..a52374f 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -147,7 +147,7 @@ const char* cmCacheEntryTypes[] = { "BOOL", "PATH", "FILEPATH", "STRING", "INTERNAL", "STATIC", "UNINITIALIZED", CM_NULLPTR }; -const char* cmState::CacheEntryTypeToString(cmState::CacheEntryType type) +const char* cmState::CacheEntryTypeToString(cmStateEnums::CacheEntryType type) { if (type > 6) { return cmCacheEntryTypes[6]; @@ -155,16 +155,16 @@ const char* cmState::CacheEntryTypeToString(cmState::CacheEntryType type) return cmCacheEntryTypes[type]; } -cmState::CacheEntryType cmState::StringToCacheEntryType(const char* s) +cmStateEnums::CacheEntryType cmState::StringToCacheEntryType(const char* s) { int i = 0; while (cmCacheEntryTypes[i]) { if (strcmp(s, cmCacheEntryTypes[i]) == 0) { - return static_cast(i); + return static_cast(i); } ++i; } - return STRING; + return cmStateEnums::STRING; } bool cmState::IsCacheEntryType(std::string const& key) @@ -219,7 +219,7 @@ const char* cmState::GetInitializedCacheValue(std::string const& key) const return this->CacheManager->GetInitializedCacheValue(key); } -cmState::CacheEntryType cmState::GetCacheEntryType( +cmStateEnums::CacheEntryType cmState::GetCacheEntryType( std::string const& key) const { cmCacheManager::CacheIterator it = @@ -279,7 +279,7 @@ bool cmState::GetCacheEntryPropertyAsBool(std::string const& key, void cmState::AddCacheEntry(const std::string& key, const char* value, const char* helpString, - cmState::CacheEntryType type) + cmStateEnums::CacheEntryType type) { this->CacheManager->AddCacheEntry(key, value, helpString, type); } @@ -1806,7 +1806,8 @@ static bool ParseEntryWithoutType(const std::string& entry, std::string& var, } bool cmState::ParseCacheEntry(const std::string& entry, std::string& var, - std::string& value, CacheEntryType& type) + std::string& value, + cmStateEnums::CacheEntryType& type) { // input line is: key:type=value static cmsys::RegularExpression reg( diff --git a/Source/cmState.h b/Source/cmState.h index 521870d..fdbbc98 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -56,6 +56,16 @@ enum TargetType INTERFACE_LIBRARY, UNKNOWN_LIBRARY }; +enum CacheEntryType +{ + BOOL = 0, + PATH, + FILEPATH, + STRING, + INTERNAL, + STATIC, + UNINITIALIZED +}; } class cmState @@ -214,18 +224,8 @@ public: Snapshot CreatePolicyScopeSnapshot(Snapshot originSnapshot); Snapshot Pop(Snapshot originSnapshot); - enum CacheEntryType - { - BOOL = 0, - PATH, - FILEPATH, - STRING, - INTERNAL, - STATIC, - UNINITIALIZED - }; - static CacheEntryType StringToCacheEntryType(const char*); - static const char* CacheEntryTypeToString(CacheEntryType); + static cmStateEnums::CacheEntryType StringToCacheEntryType(const char*); + static const char* CacheEntryTypeToString(cmStateEnums::CacheEntryType); static bool IsCacheEntryType(std::string const& key); bool LoadCache(const std::string& path, bool internal, @@ -239,7 +239,7 @@ public: std::vector GetCacheEntryKeys() const; const char* GetCacheEntryValue(std::string const& key) const; const char* GetInitializedCacheValue(std::string const& key) const; - CacheEntryType GetCacheEntryType(std::string const& key) const; + cmStateEnums::CacheEntryType GetCacheEntryType(std::string const& key) const; void SetCacheEntryValue(std::string const& key, std::string const& value); void SetCacheValue(std::string const& key, std::string const& value); @@ -264,7 +264,8 @@ public: ///! Break up a line like VAR:type="value" into var, type and value static bool ParseCacheEntry(const std::string& entry, std::string& var, - std::string& value, CacheEntryType& type); + std::string& value, + cmStateEnums::CacheEntryType& type); Snapshot Reset(); // Define a property @@ -328,7 +329,8 @@ public: private: friend class cmake; void AddCacheEntry(const std::string& key, const char* value, - const char* helpString, CacheEntryType type); + const char* helpString, + cmStateEnums::CacheEntryType type); std::map PropertyDefinitions; std::vector EnabledLanguages; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 5753dd8..2527366 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -635,7 +635,7 @@ void cmTarget::ClearDependencyInformation(cmMakefile& mf, depname += "_LIB_DEPENDS"; if (this->RecordDependencies) { mf.AddCacheDefinition(depname, "", "Dependencies for target", - cmState::STATIC); + cmStateEnums::STATIC); } else { if (mf.GetDefinition(depname)) { std::string message = "Target "; @@ -773,7 +773,7 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, const std::string& lib, dependencies += lib; dependencies += ";"; mf.AddCacheDefinition(targetEntry, dependencies.c_str(), - "Dependencies for the target", cmState::STATIC); + "Dependencies for the target", cmStateEnums::STATIC); } } diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index 5c9e41a..b248489 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -189,7 +189,8 @@ void cmTryRunCommand::RunExecutable(const std::string& runArgs, strcpy(retChar, "FAILED_TO_RUN"); } this->Makefile->AddCacheDefinition(this->RunResultVariable, retChar, - "Result of TRY_RUN", cmState::INTERNAL); + "Result of TRY_RUN", + cmStateEnums::INTERNAL); } /* This is only used when cross compiling. Instead of running the @@ -231,7 +232,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, comment += detailsString; this->Makefile->AddCacheDefinition(this->RunResultVariable, "PLEASE_FILL_OUT-FAILED_TO_RUN", - comment.c_str(), cmState::STRING); + comment.c_str(), cmStateEnums::STRING); cmState* state = this->Makefile->GetState(); const char* existingValue = @@ -254,9 +255,9 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, "would have printed on stdout and stderr on its target platform.\n"; comment += detailsString; - this->Makefile->AddCacheDefinition(internalRunOutputName, - "PLEASE_FILL_OUT-NOTFOUND", - comment.c_str(), cmState::STRING); + this->Makefile->AddCacheDefinition( + internalRunOutputName, "PLEASE_FILL_OUT-NOTFOUND", comment.c_str(), + cmStateEnums::STRING); cmState* state = this->Makefile->GetState(); const char* existing = state->GetCacheEntryValue(internalRunOutputName); if (existing) { diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx index 08ea21e..8f25cbb 100644 --- a/Source/cmUtilitySourceCommand.cxx +++ b/Source/cmUtilitySourceCommand.cxx @@ -98,13 +98,13 @@ bool cmUtilitySourceCommand::InitialPass(std::vector const& args, // Enter the value into the cache. this->Makefile->AddCacheDefinition(cacheEntry, utilityExecutable.c_str(), "Path to an internal program.", - cmState::FILEPATH); + cmStateEnums::FILEPATH); // add a value into the cache that maps from the // full path to the name of the project cmSystemTools::ConvertToUnixSlashes(utilityExecutable); this->Makefile->AddCacheDefinition(utilityExecutable, utilityName.c_str(), "Executable to project name.", - cmState::INTERNAL); + cmStateEnums::INTERNAL); return true; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 5936d77..b50c8bd 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -315,7 +315,7 @@ bool cmake::SetCacheArgs(const std::vector& args) } } std::string var, value; - cmState::CacheEntryType type = cmState::UNINITIALIZED; + cmStateEnums::CacheEntryType type = cmStateEnums::UNINITIALIZED; if (cmState::ParseCacheEntry(entry, var, value, type)) { // The value is transformed if it is a filepath for example, so // we can't compare whether the value is already in the cache until @@ -410,8 +410,8 @@ bool cmake::SetCacheArgs(const std::vector& args) std::vector cacheKeys = this->State->GetCacheEntryKeys(); for (std::vector::const_iterator it = cacheKeys.begin(); it != cacheKeys.end(); ++it) { - cmState::CacheEntryType t = this->State->GetCacheEntryType(*it); - if (t != cmState::STATIC) { + cmStateEnums::CacheEntryType t = this->State->GetCacheEntryType(*it); + if (t != cmStateEnums::STATIC) { if (regex.find(it->c_str())) { entriesToDelete.push_back(*it); } @@ -859,14 +859,14 @@ int cmake::AddCMakePaths() // Save the value in the cache this->AddCacheEntry("CMAKE_COMMAND", cmSystemTools::GetCMakeCommand().c_str(), - "Path to CMake executable.", cmState::INTERNAL); + "Path to CMake executable.", cmStateEnums::INTERNAL); #ifdef CMAKE_BUILD_WITH_CMAKE - this->AddCacheEntry("CMAKE_CTEST_COMMAND", - cmSystemTools::GetCTestCommand().c_str(), - "Path to ctest program executable.", cmState::INTERNAL); - this->AddCacheEntry("CMAKE_CPACK_COMMAND", - cmSystemTools::GetCPackCommand().c_str(), - "Path to cpack program executable.", cmState::INTERNAL); + this->AddCacheEntry( + "CMAKE_CTEST_COMMAND", cmSystemTools::GetCTestCommand().c_str(), + "Path to ctest program executable.", cmStateEnums::INTERNAL); + this->AddCacheEntry( + "CMAKE_CPACK_COMMAND", cmSystemTools::GetCPackCommand().c_str(), + "Path to cpack program executable.", cmStateEnums::INTERNAL); #endif if (!cmSystemTools::FileExists( (cmSystemTools::GetCMakeRoot() + "/Modules/CMake.cmake").c_str())) { @@ -879,7 +879,7 @@ int cmake::AddCMakePaths() return 0; } this->AddCacheEntry("CMAKE_ROOT", cmSystemTools::GetCMakeRoot().c_str(), - "Path to CMake installation.", cmState::INTERNAL); + "Path to CMake installation.", cmStateEnums::INTERNAL); return 1; } @@ -1147,7 +1147,7 @@ struct SaveCacheEntry std::string key; std::string value; std::string help; - cmState::CacheEntryType type; + cmStateEnums::CacheEntryType type; }; int cmake::HandleDeleteCacheVariables(const std::string& var) @@ -1291,7 +1291,7 @@ int cmake::ActualConfigure() "CMAKE_HOME_DIRECTORY", this->GetHomeDirectory(), "Source directory with the top level CMakeLists.txt file for this " "project", - cmState::INTERNAL); + cmStateEnums::INTERNAL); } // no generator specified on the command line @@ -1338,11 +1338,11 @@ int cmake::ActualConfigure() if (!this->State->GetInitializedCacheValue("CMAKE_GENERATOR")) { this->AddCacheEntry("CMAKE_GENERATOR", this->GlobalGenerator->GetName().c_str(), - "Name of generator.", cmState::INTERNAL); + "Name of generator.", cmStateEnums::INTERNAL); this->AddCacheEntry("CMAKE_EXTRA_GENERATOR", this->GlobalGenerator->GetExtraGeneratorName().c_str(), "Name of external makefile project generator.", - cmState::INTERNAL); + cmStateEnums::INTERNAL); } if (const char* platformName = @@ -1362,7 +1362,7 @@ int cmake::ActualConfigure() } else { this->AddCacheEntry("CMAKE_GENERATOR_PLATFORM", this->GeneratorPlatform.c_str(), - "Name of generator platform.", cmState::INTERNAL); + "Name of generator platform.", cmStateEnums::INTERNAL); } if (const char* tsName = @@ -1382,7 +1382,7 @@ int cmake::ActualConfigure() } else { this->AddCacheEntry("CMAKE_GENERATOR_TOOLSET", this->GeneratorToolset.c_str(), - "Name of generator toolset.", cmState::INTERNAL); + "Name of generator toolset.", cmStateEnums::INTERNAL); } // reset any system configuration information, except for when we are @@ -1411,13 +1411,14 @@ int cmake::ActualConfigure() if (!this->State->GetInitializedCacheValue("LIBRARY_OUTPUT_PATH")) { this->AddCacheEntry( "LIBRARY_OUTPUT_PATH", "", - "Single output directory for building all libraries.", cmState::PATH); + "Single output directory for building all libraries.", + cmStateEnums::PATH); } if (!this->State->GetInitializedCacheValue("EXECUTABLE_OUTPUT_PATH")) { this->AddCacheEntry( "EXECUTABLE_OUTPUT_PATH", "", "Single output directory for building all executables.", - cmState::PATH); + cmStateEnums::PATH); } } @@ -1640,7 +1641,7 @@ void cmake::AddCacheEntry(const std::string& key, const char* value, const char* helpString, int type) { this->State->AddCacheEntry(key, value, helpString, - cmState::CacheEntryType(type)); + cmStateEnums::CacheEntryType(type)); this->UnwatchUnusedCli(key); } @@ -1694,7 +1695,8 @@ void cmake::AddDefaultGenerators() } bool cmake::ParseCacheEntry(const std::string& entry, std::string& var, - std::string& value, cmState::CacheEntryType& type) + std::string& value, + cmStateEnums::CacheEntryType& type) { return cmState::ParseCacheEntry(entry, var, value, type); } @@ -2464,7 +2466,7 @@ void cmake::SetSuppressDevWarnings(bool b) this->AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", value.c_str(), "Suppress Warnings that are meant for" " the author of the CMakeLists.txt files.", - cmState::INTERNAL); + cmStateEnums::INTERNAL); } bool cmake::GetSuppressDeprecatedWarnings() const @@ -2488,7 +2490,7 @@ void cmake::SetSuppressDeprecatedWarnings(bool b) this->AddCacheEntry("CMAKE_WARN_DEPRECATED", value.c_str(), "Whether to issue warnings for deprecated " "functionality.", - cmState::INTERNAL); + cmStateEnums::INTERNAL); } bool cmake::GetDevWarningsAsErrors() const @@ -2512,7 +2514,7 @@ void cmake::SetDevWarningsAsErrors(bool b) this->AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_ERRORS", value.c_str(), "Suppress errors that are meant for" " the author of the CMakeLists.txt files.", - cmState::INTERNAL); + cmStateEnums::INTERNAL); } bool cmake::GetDeprecatedWarningsAsErrors() const @@ -2536,5 +2538,5 @@ void cmake::SetDeprecatedWarningsAsErrors(bool b) this->AddCacheEntry("CMAKE_ERROR_DEPRECATED", value.c_str(), "Whether to issue deprecation errors for macros" " and functions.", - cmState::INTERNAL); + cmStateEnums::INTERNAL); } diff --git a/Source/cmake.h b/Source/cmake.h index 865748b..cff753f 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -161,7 +161,7 @@ public: ///! Break up a line like VAR:type="value" into var, type and value static bool ParseCacheEntry(const std::string& entry, std::string& var, std::string& value, - cmState::CacheEntryType& type); + cmStateEnums::CacheEntryType& type); int LoadCache(); bool LoadCache(const std::string& path); diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 0d1f1ce..d1159c3 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -292,9 +292,9 @@ int do_cmake(int ac, char const* const* av) std::vector keys = cm.GetState()->GetCacheEntryKeys(); for (std::vector::const_iterator it = keys.begin(); it != keys.end(); ++it) { - cmState::CacheEntryType t = cm.GetState()->GetCacheEntryType(*it); - if (t != cmState::INTERNAL && t != cmState::STATIC && - t != cmState::UNINITIALIZED) { + cmStateEnums::CacheEntryType t = cm.GetState()->GetCacheEntryType(*it); + if (t != cmStateEnums::INTERNAL && t != cmStateEnums::STATIC && + t != cmStateEnums::UNINITIALIZED) { const char* advancedProp = cm.GetState()->GetCacheEntryProperty(*it, "ADVANCED"); if (list_all_cached || !advancedProp) { -- cgit v0.12 From 34bcec39c68b82148635cec94a2f7d49d40edf75 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 18 Oct 2016 21:28:47 +0200 Subject: cmState: Move Directory class to separate namespace Leave behind a typedef to avoid porting dependent code in this commit. --- Source/cmState.cxx | 92 +++++++++++++++++------------------ Source/cmState.h | 138 +++++++++++++++++++++++++++-------------------------- 2 files changed, 115 insertions(+), 115 deletions(-) diff --git a/Source/cmState.cxx b/Source/cmState.cxx index a52374f..31aac63 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -676,7 +676,7 @@ const char* cmState::GetBinaryDirectory() const return this->BinaryDirectory.c_str(); } -void cmState::Directory::ComputeRelativePathTopSource() +void cmStateDirectory::ComputeRelativePathTopSource() { // Relative path conversion inside the source tree is not used to // construct relative paths passed to build tools so it is safe to use @@ -707,7 +707,7 @@ void cmState::Directory::ComputeRelativePathTopSource() this->DirectoryState->RelativePathTopSource = result; } -void cmState::Directory::ComputeRelativePathTopBinary() +void cmStateDirectory::ComputeRelativePathTopBinary() { cmState::Snapshot snapshot = this->Snapshot_; std::vector snapshots; @@ -948,12 +948,12 @@ cmStateEnums::SnapshotType cmState::Snapshot::GetType() const return this->Position->SnapshotType; } -const char* cmState::Directory::GetCurrentSource() const +const char* cmStateDirectory::GetCurrentSource() const { return this->DirectoryState->Location.c_str(); } -void cmState::Directory::SetCurrentSource(std::string const& dir) +void cmStateDirectory::SetCurrentSource(std::string const& dir) { std::string& loc = this->DirectoryState->Location; loc = dir; @@ -965,12 +965,12 @@ void cmState::Directory::SetCurrentSource(std::string const& dir) this->Snapshot_.SetDefinition("CMAKE_CURRENT_SOURCE_DIR", loc); } -const char* cmState::Directory::GetCurrentBinary() const +const char* cmStateDirectory::GetCurrentBinary() const { return this->DirectoryState->OutputLocation.c_str(); } -void cmState::Directory::SetCurrentBinary(std::string const& dir) +void cmStateDirectory::SetCurrentBinary(std::string const& dir) { std::string& loc = this->DirectoryState->OutputLocation; loc = dir; @@ -987,22 +987,22 @@ void cmState::Snapshot::SetListFile(const std::string& listfile) *this->Position->ExecutionListFile = listfile; } -const char* cmState::Directory::GetRelativePathTopSource() const +const char* cmStateDirectory::GetRelativePathTopSource() const { return this->DirectoryState->RelativePathTopSource.c_str(); } -const char* cmState::Directory::GetRelativePathTopBinary() const +const char* cmStateDirectory::GetRelativePathTopBinary() const { return this->DirectoryState->RelativePathTopBinary.c_str(); } -void cmState::Directory::SetRelativePathTopSource(const char* dir) +void cmStateDirectory::SetRelativePathTopSource(const char* dir) { this->DirectoryState->RelativePathTopSource = dir; } -void cmState::Directory::SetRelativePathTopBinary(const char* dir) +void cmStateDirectory::SetRelativePathTopBinary(const char* dir) { this->DirectoryState->RelativePathTopBinary = dir; } @@ -1342,9 +1342,9 @@ cmState* cmState::Snapshot::GetState() const return this->State; } -cmState::Directory cmState::Snapshot::GetDirectory() const +cmStateDirectory cmState::Snapshot::GetDirectory() const { - return Directory(this->Position->BuildSystemDirectory, *this); + return cmStateDirectory(this->Position->BuildSystemDirectory, *this); } void cmState::Snapshot::SetProjectName(const std::string& name) @@ -1369,7 +1369,7 @@ void cmState::Snapshot::InitializeFromParent_ForSubdirsCommand() this->SetDefinition("CMAKE_CURRENT_BINARY_DIR", currentBinDir); } -cmState::Directory::Directory( +cmStateDirectory::cmStateDirectory( cmLinkedTree::iterator iter, const cmState::Snapshot& snapshot) : DirectoryState(iter) @@ -1450,15 +1450,14 @@ void ClearContent(T& content, U& backtraces, V& endContentPosition) endContentPosition = content.size(); } -cmStringRange cmState::Directory::GetIncludeDirectoriesEntries() const +cmStringRange cmStateDirectory::GetIncludeDirectoriesEntries() const { return GetPropertyContent( this->DirectoryState->IncludeDirectories, this->Snapshot_.Position->IncludeDirectoryPosition); } -cmBacktraceRange cmState::Directory::GetIncludeDirectoriesEntryBacktraces() - const +cmBacktraceRange cmStateDirectory::GetIncludeDirectoriesEntryBacktraces() const { return GetPropertyBacktraces( this->DirectoryState->IncludeDirectories, @@ -1466,7 +1465,7 @@ cmBacktraceRange cmState::Directory::GetIncludeDirectoriesEntryBacktraces() this->Snapshot_.Position->IncludeDirectoryPosition); } -void cmState::Directory::AppendIncludeDirectoriesEntry( +void cmStateDirectory::AppendIncludeDirectoriesEntry( const std::string& vec, const cmListFileBacktrace& lfbt) { AppendEntry(this->DirectoryState->IncludeDirectories, @@ -1474,7 +1473,7 @@ void cmState::Directory::AppendIncludeDirectoriesEntry( this->Snapshot_.Position->IncludeDirectoryPosition, vec, lfbt); } -void cmState::Directory::PrependIncludeDirectoriesEntry( +void cmStateDirectory::PrependIncludeDirectoriesEntry( const std::string& vec, const cmListFileBacktrace& lfbt) { std::vector::iterator entryEnd = @@ -1502,30 +1501,29 @@ void cmState::Directory::PrependIncludeDirectoriesEntry( this->DirectoryState->IncludeDirectories.size(); } -void cmState::Directory::SetIncludeDirectories(const std::string& vec, - const cmListFileBacktrace& lfbt) +void cmStateDirectory::SetIncludeDirectories(const std::string& vec, + const cmListFileBacktrace& lfbt) { SetContent(this->DirectoryState->IncludeDirectories, this->DirectoryState->IncludeDirectoryBacktraces, this->Snapshot_.Position->IncludeDirectoryPosition, vec, lfbt); } -void cmState::Directory::ClearIncludeDirectories() +void cmStateDirectory::ClearIncludeDirectories() { ClearContent(this->DirectoryState->IncludeDirectories, this->DirectoryState->IncludeDirectoryBacktraces, this->Snapshot_.Position->IncludeDirectoryPosition); } -cmStringRange cmState::Directory::GetCompileDefinitionsEntries() const +cmStringRange cmStateDirectory::GetCompileDefinitionsEntries() const { return GetPropertyContent( this->DirectoryState->CompileDefinitions, this->Snapshot_.Position->CompileDefinitionsPosition); } -cmBacktraceRange cmState::Directory::GetCompileDefinitionsEntryBacktraces() - const +cmBacktraceRange cmStateDirectory::GetCompileDefinitionsEntryBacktraces() const { return GetPropertyBacktraces( this->DirectoryState->CompileDefinitions, @@ -1533,7 +1531,7 @@ cmBacktraceRange cmState::Directory::GetCompileDefinitionsEntryBacktraces() this->Snapshot_.Position->CompileDefinitionsPosition); } -void cmState::Directory::AppendCompileDefinitionsEntry( +void cmStateDirectory::AppendCompileDefinitionsEntry( const std::string& vec, const cmListFileBacktrace& lfbt) { AppendEntry(this->DirectoryState->CompileDefinitions, @@ -1541,28 +1539,28 @@ void cmState::Directory::AppendCompileDefinitionsEntry( this->Snapshot_.Position->CompileDefinitionsPosition, vec, lfbt); } -void cmState::Directory::SetCompileDefinitions(const std::string& vec, - const cmListFileBacktrace& lfbt) +void cmStateDirectory::SetCompileDefinitions(const std::string& vec, + const cmListFileBacktrace& lfbt) { SetContent(this->DirectoryState->CompileDefinitions, this->DirectoryState->CompileDefinitionsBacktraces, this->Snapshot_.Position->CompileDefinitionsPosition, vec, lfbt); } -void cmState::Directory::ClearCompileDefinitions() +void cmStateDirectory::ClearCompileDefinitions() { ClearContent(this->DirectoryState->CompileDefinitions, this->DirectoryState->CompileDefinitionsBacktraces, this->Snapshot_.Position->CompileDefinitionsPosition); } -cmStringRange cmState::Directory::GetCompileOptionsEntries() const +cmStringRange cmStateDirectory::GetCompileOptionsEntries() const { return GetPropertyContent(this->DirectoryState->CompileOptions, this->Snapshot_.Position->CompileOptionsPosition); } -cmBacktraceRange cmState::Directory::GetCompileOptionsEntryBacktraces() const +cmBacktraceRange cmStateDirectory::GetCompileOptionsEntryBacktraces() const { return GetPropertyBacktraces( this->DirectoryState->CompileOptions, @@ -1570,7 +1568,7 @@ cmBacktraceRange cmState::Directory::GetCompileOptionsEntryBacktraces() const this->Snapshot_.Position->CompileOptionsPosition); } -void cmState::Directory::AppendCompileOptionsEntry( +void cmStateDirectory::AppendCompileOptionsEntry( const std::string& vec, const cmListFileBacktrace& lfbt) { AppendEntry(this->DirectoryState->CompileOptions, @@ -1578,15 +1576,15 @@ void cmState::Directory::AppendCompileOptionsEntry( this->Snapshot_.Position->CompileOptionsPosition, vec, lfbt); } -void cmState::Directory::SetCompileOptions(const std::string& vec, - const cmListFileBacktrace& lfbt) +void cmStateDirectory::SetCompileOptions(const std::string& vec, + const cmListFileBacktrace& lfbt) { SetContent(this->DirectoryState->CompileOptions, this->DirectoryState->CompileOptionsBacktraces, this->Snapshot_.Position->CompileOptionsPosition, vec, lfbt); } -void cmState::Directory::ClearCompileOptions() +void cmStateDirectory::ClearCompileOptions() { ClearContent(this->DirectoryState->CompileOptions, this->DirectoryState->CompileOptionsBacktraces, @@ -1599,9 +1597,8 @@ bool cmState::Snapshot::StrictWeakOrder::operator()( return lhs.Position.StrictWeakOrdered(rhs.Position); } -void cmState::Directory::SetProperty(const std::string& prop, - const char* value, - cmListFileBacktrace const& lfbt) +void cmStateDirectory::SetProperty(const std::string& prop, const char* value, + cmListFileBacktrace const& lfbt) { if (prop == "INCLUDE_DIRECTORIES") { if (!value) { @@ -1631,9 +1628,9 @@ void cmState::Directory::SetProperty(const std::string& prop, this->DirectoryState->Properties.SetProperty(prop, value); } -void cmState::Directory::AppendProperty(const std::string& prop, - const char* value, bool asString, - cmListFileBacktrace const& lfbt) +void cmStateDirectory::AppendProperty(const std::string& prop, + const char* value, bool asString, + cmListFileBacktrace const& lfbt) { if (prop == "INCLUDE_DIRECTORIES") { this->AppendIncludeDirectoriesEntry(value, lfbt); @@ -1651,15 +1648,15 @@ void cmState::Directory::AppendProperty(const std::string& prop, this->DirectoryState->Properties.AppendProperty(prop, value, asString); } -const char* cmState::Directory::GetProperty(const std::string& prop) const +const char* cmStateDirectory::GetProperty(const std::string& prop) const { const bool chain = this->Snapshot_.State->IsPropertyChained(prop, cmProperty::DIRECTORY); return this->GetProperty(prop, chain); } -const char* cmState::Directory::GetProperty(const std::string& prop, - bool chain) const +const char* cmStateDirectory::GetProperty(const std::string& prop, + bool chain) const { static std::string output; output = ""; @@ -1733,7 +1730,8 @@ const char* cmState::Directory::GetProperty(const std::string& prop, const char* retVal = this->DirectoryState->Properties.GetPropertyValue(prop); if (!retVal && chain) { - Snapshot parentSnapshot = this->Snapshot_.GetBuildsystemDirectoryParent(); + cmState::Snapshot parentSnapshot = + this->Snapshot_.GetBuildsystemDirectoryParent(); if (parentSnapshot.IsValid()) { return parentSnapshot.GetDirectory().GetProperty(prop, chain); } @@ -1743,12 +1741,12 @@ const char* cmState::Directory::GetProperty(const std::string& prop, return retVal; } -bool cmState::Directory::GetPropertyAsBool(const std::string& prop) const +bool cmStateDirectory::GetPropertyAsBool(const std::string& prop) const { return cmSystemTools::IsOn(this->GetProperty(prop)); } -std::vector cmState::Directory::GetPropertyKeys() const +std::vector cmStateDirectory::GetPropertyKeys() const { std::vector keys; keys.reserve(this->DirectoryState->Properties.size()); @@ -1760,7 +1758,7 @@ std::vector cmState::Directory::GetPropertyKeys() const return keys; } -void cmState::Directory::AddNormalTargetName(std::string const& name) +void cmStateDirectory::AddNormalTargetName(std::string const& name) { this->DirectoryState->NormalTargetNames.push_back(name); } diff --git a/Source/cmState.h b/Source/cmState.h index fdbbc98..843a5cf 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -68,6 +68,8 @@ enum CacheEntryType }; } +class cmStateDirectory; + class cmState { @@ -75,7 +77,7 @@ public: cmState(); ~cmState(); - class Directory; + typedef cmStateDirectory Directory; class Snapshot { @@ -112,7 +114,7 @@ public: cmState* GetState() const; - Directory GetDirectory() const; + cmStateDirectory GetDirectory() const; void SetProjectName(std::string const& name); std::string GetProjectName() const; @@ -134,7 +136,7 @@ public: friend bool operator!=(const cmState::Snapshot& lhs, const cmState::Snapshot& rhs); friend class cmState; - friend class Directory; + friend class cmStateDirectory; friend struct StrictWeakOrder; void InitializeFromParent(); @@ -143,71 +145,6 @@ public: cmStateDetail::PositionType Position; }; - class Directory - { - Directory(cmLinkedTree< - cmStateDetail::BuildsystemDirectoryStateType>::iterator iter, - Snapshot const& snapshot); - - public: - const char* GetCurrentSource() const; - void SetCurrentSource(std::string const& dir); - const char* GetCurrentBinary() const; - void SetCurrentBinary(std::string const& dir); - - const char* GetRelativePathTopSource() const; - const char* GetRelativePathTopBinary() const; - void SetRelativePathTopSource(const char* dir); - void SetRelativePathTopBinary(const char* dir); - - cmStringRange GetIncludeDirectoriesEntries() const; - cmBacktraceRange GetIncludeDirectoriesEntryBacktraces() const; - void AppendIncludeDirectoriesEntry(std::string const& vec, - cmListFileBacktrace const& lfbt); - void PrependIncludeDirectoriesEntry(std::string const& vec, - cmListFileBacktrace const& lfbt); - void SetIncludeDirectories(std::string const& vec, - cmListFileBacktrace const& lfbt); - void ClearIncludeDirectories(); - - cmStringRange GetCompileDefinitionsEntries() const; - cmBacktraceRange GetCompileDefinitionsEntryBacktraces() const; - void AppendCompileDefinitionsEntry(std::string const& vec, - cmListFileBacktrace const& lfbt); - void SetCompileDefinitions(std::string const& vec, - cmListFileBacktrace const& lfbt); - void ClearCompileDefinitions(); - - cmStringRange GetCompileOptionsEntries() const; - cmBacktraceRange GetCompileOptionsEntryBacktraces() const; - void AppendCompileOptionsEntry(std::string const& vec, - cmListFileBacktrace const& lfbt); - void SetCompileOptions(std::string const& vec, - cmListFileBacktrace const& lfbt); - void ClearCompileOptions(); - - void SetProperty(const std::string& prop, const char* value, - cmListFileBacktrace const& lfbt); - void AppendProperty(const std::string& prop, const char* value, - bool asString, cmListFileBacktrace const& lfbt); - const char* GetProperty(const std::string& prop) const; - const char* GetProperty(const std::string& prop, bool chain) const; - bool GetPropertyAsBool(const std::string& prop) const; - std::vector GetPropertyKeys() const; - - void AddNormalTargetName(std::string const& name); - - private: - void ComputeRelativePathTopSource(); - void ComputeRelativePathTopBinary(); - - private: - cmLinkedTree::iterator - DirectoryState; - Snapshot Snapshot_; - friend class Snapshot; - }; - static const char* GetTargetTypeName(cmStateEnums::TargetType targetType); Snapshot CreateBaseSnapshot(); @@ -358,6 +295,71 @@ private: bool MSYSShell; }; +class cmStateDirectory +{ + cmStateDirectory( + cmLinkedTree::iterator iter, + cmState::Snapshot const& snapshot); + +public: + const char* GetCurrentSource() const; + void SetCurrentSource(std::string const& dir); + const char* GetCurrentBinary() const; + void SetCurrentBinary(std::string const& dir); + + const char* GetRelativePathTopSource() const; + const char* GetRelativePathTopBinary() const; + void SetRelativePathTopSource(const char* dir); + void SetRelativePathTopBinary(const char* dir); + + cmStringRange GetIncludeDirectoriesEntries() const; + cmBacktraceRange GetIncludeDirectoriesEntryBacktraces() const; + void AppendIncludeDirectoriesEntry(std::string const& vec, + cmListFileBacktrace const& lfbt); + void PrependIncludeDirectoriesEntry(std::string const& vec, + cmListFileBacktrace const& lfbt); + void SetIncludeDirectories(std::string const& vec, + cmListFileBacktrace const& lfbt); + void ClearIncludeDirectories(); + + cmStringRange GetCompileDefinitionsEntries() const; + cmBacktraceRange GetCompileDefinitionsEntryBacktraces() const; + void AppendCompileDefinitionsEntry(std::string const& vec, + cmListFileBacktrace const& lfbt); + void SetCompileDefinitions(std::string const& vec, + cmListFileBacktrace const& lfbt); + void ClearCompileDefinitions(); + + cmStringRange GetCompileOptionsEntries() const; + cmBacktraceRange GetCompileOptionsEntryBacktraces() const; + void AppendCompileOptionsEntry(std::string const& vec, + cmListFileBacktrace const& lfbt); + void SetCompileOptions(std::string const& vec, + cmListFileBacktrace const& lfbt); + void ClearCompileOptions(); + + void SetProperty(const std::string& prop, const char* value, + cmListFileBacktrace const& lfbt); + void AppendProperty(const std::string& prop, const char* value, + bool asString, cmListFileBacktrace const& lfbt); + const char* GetProperty(const std::string& prop) const; + const char* GetProperty(const std::string& prop, bool chain) const; + bool GetPropertyAsBool(const std::string& prop) const; + std::vector GetPropertyKeys() const; + + void AddNormalTargetName(std::string const& name); + +private: + void ComputeRelativePathTopSource(); + void ComputeRelativePathTopBinary(); + +private: + cmLinkedTree::iterator + DirectoryState; + cmState::Snapshot Snapshot_; + friend class cmState::Snapshot; +}; + bool operator==(const cmState::Snapshot& lhs, const cmState::Snapshot& rhs); bool operator!=(const cmState::Snapshot& lhs, const cmState::Snapshot& rhs); -- cgit v0.12 From 17d27893e6fdc70a39a35cad468f332f968e44e7 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 18 Oct 2016 21:28:47 +0200 Subject: cmState: Port dependent code to new cmStateDirectory name --- Source/cmGlobalGenerator.cxx | 4 ++-- Source/cmGlobalGenerator.h | 4 ++-- Source/cmGlobalNinjaGenerator.cxx | 2 +- Source/cmGlobalNinjaGenerator.h | 2 +- Source/cmLinkLineComputer.cxx | 2 +- Source/cmLinkLineComputer.h | 4 ++-- Source/cmMSVC60LinkLineComputer.cxx | 2 +- Source/cmMSVC60LinkLineComputer.h | 2 +- Source/cmMakefileTargetGenerator.cxx | 6 +++--- Source/cmMakefileTargetGenerator.h | 2 +- Source/cmNinjaLinkLineComputer.cxx | 2 +- Source/cmNinjaLinkLineComputer.h | 2 +- Source/cmOutputConverter.cxx | 2 +- Source/cmOutputConverter.h | 2 +- 14 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index efa95a5..24a3277 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1415,13 +1415,13 @@ cmGlobalGenerator::CreateQtAutoGeneratorsTargets() } cmLinkLineComputer* cmGlobalGenerator::CreateLinkLineComputer( - cmOutputConverter* outputConverter, cmState::Directory stateDir) const + cmOutputConverter* outputConverter, cmStateDirectory stateDir) const { return new cmLinkLineComputer(outputConverter, stateDir); } cmLinkLineComputer* cmGlobalGenerator::CreateMSVC60LinkLineComputer( - cmOutputConverter* outputConverter, cmState::Directory stateDir) const + cmOutputConverter* outputConverter, cmStateDirectory stateDir) const { return new cmMSVC60LinkLineComputer(outputConverter, stateDir); } diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index c3498e0..0f483db 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -108,10 +108,10 @@ public: virtual void Generate(); virtual cmLinkLineComputer* CreateLinkLineComputer( - cmOutputConverter* outputConverter, cmState::Directory stateDir) const; + cmOutputConverter* outputConverter, cmStateDirectory stateDir) const; cmLinkLineComputer* CreateMSVC60LinkLineComputer( - cmOutputConverter* outputConverter, cmState::Directory stateDir) const; + cmOutputConverter* outputConverter, cmStateDirectory stateDir) const; /** * Set/Get and Clear the enabled languages. diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 98654c5..a84baca 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -66,7 +66,7 @@ void cmGlobalNinjaGenerator::WriteComment(std::ostream& os, } cmLinkLineComputer* cmGlobalNinjaGenerator::CreateLinkLineComputer( - cmOutputConverter* outputConverter, cmState::Directory /* stateDir */) const + cmOutputConverter* outputConverter, cmStateDirectory /* stateDir */) const { return new cmNinjaLinkLineComputer( outputConverter, diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 6b77a2b..d4a14e2 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -72,7 +72,7 @@ public: cmLinkLineComputer* CreateLinkLineComputer( cmOutputConverter* outputConverter, - cmState::Directory stateDir) const CM_OVERRIDE; + cmStateDirectory stateDir) const CM_OVERRIDE; /** * Write the given @a comment to the output stream @a os. It diff --git a/Source/cmLinkLineComputer.cxx b/Source/cmLinkLineComputer.cxx index 5fc861b..f6d5e70 100644 --- a/Source/cmLinkLineComputer.cxx +++ b/Source/cmLinkLineComputer.cxx @@ -7,7 +7,7 @@ #include "cmOutputConverter.h" cmLinkLineComputer::cmLinkLineComputer(cmOutputConverter* outputConverter, - cmState::Directory stateDir) + cmStateDirectory stateDir) : StateDir(stateDir) , OutputConverter(outputConverter) , ForResponse(false) diff --git a/Source/cmLinkLineComputer.h b/Source/cmLinkLineComputer.h index 1fb9b24..59e7357 100644 --- a/Source/cmLinkLineComputer.h +++ b/Source/cmLinkLineComputer.h @@ -13,7 +13,7 @@ class cmLinkLineComputer { public: cmLinkLineComputer(cmOutputConverter* outputConverter, - cmState::Directory stateDir); + cmStateDirectory stateDir); virtual ~cmLinkLineComputer(); void SetUseWatcomQuote(bool useWatcomQuote); @@ -39,7 +39,7 @@ private: std::string ConvertToOutputFormat(std::string const& input); std::string ConvertToOutputForExisting(std::string const& input); - cmState::Directory StateDir; + cmStateDirectory StateDir; cmOutputConverter* OutputConverter; bool ForResponse; diff --git a/Source/cmMSVC60LinkLineComputer.cxx b/Source/cmMSVC60LinkLineComputer.cxx index 2b6df2a..9308d91 100644 --- a/Source/cmMSVC60LinkLineComputer.cxx +++ b/Source/cmMSVC60LinkLineComputer.cxx @@ -6,7 +6,7 @@ #include "cmSystemTools.h" cmMSVC60LinkLineComputer::cmMSVC60LinkLineComputer( - cmOutputConverter* outputConverter, cmState::Directory stateDir) + cmOutputConverter* outputConverter, cmStateDirectory stateDir) : cmLinkLineComputer(outputConverter, stateDir) { } diff --git a/Source/cmMSVC60LinkLineComputer.h b/Source/cmMSVC60LinkLineComputer.h index ca9da31..381b8a2 100644 --- a/Source/cmMSVC60LinkLineComputer.h +++ b/Source/cmMSVC60LinkLineComputer.h @@ -10,7 +10,7 @@ class cmMSVC60LinkLineComputer : public cmLinkLineComputer { public: cmMSVC60LinkLineComputer(cmOutputConverter* outputConverter, - cmState::Directory stateDir); + cmStateDirectory stateDir); std::string ConvertToLinkReference(std::string const& input) const CM_OVERRIDE; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index f0502bf..97c430f 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1232,7 +1232,7 @@ class cmMakefileTargetGeneratorObjectStrings public: cmMakefileTargetGeneratorObjectStrings(std::vector& strings, cmOutputConverter* outputConverter, - cmState::Directory stateDir, + cmStateDirectory stateDir, std::string::size_type limit) : Strings(strings) , OutputConverter(outputConverter) @@ -1277,7 +1277,7 @@ private: std::vector& Strings; cmOutputConverter* OutputConverter; - cmState::Directory StateDir; + cmStateDirectory StateDir; std::string::size_type LengthLimit; std::string CurrentString; std::string NextObject; @@ -1553,7 +1553,7 @@ std::string cmMakefileTargetGenerator::CreateResponseFile( } cmLinkLineComputer* cmMakefileTargetGenerator::CreateLinkLineComputer( - cmOutputConverter* outputConverter, cmState::Directory stateDir) + cmOutputConverter* outputConverter, cmStateDirectory stateDir) { if (this->Makefile->IsOn("MSVC60")) { return this->GlobalGenerator->CreateMSVC60LinkLineComputer(outputConverter, diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index 4c61011..e44f64a 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -141,7 +141,7 @@ protected: std::vector& makefile_depends); cmLinkLineComputer* CreateLinkLineComputer( - cmOutputConverter* outputConverter, cmState::Directory stateDir); + cmOutputConverter* outputConverter, cmStateDirectory stateDir); /** Create a response file with the given set of options. Returns the relative path from the target build working directory to the diff --git a/Source/cmNinjaLinkLineComputer.cxx b/Source/cmNinjaLinkLineComputer.cxx index 3dcb20b..fa9df6d 100644 --- a/Source/cmNinjaLinkLineComputer.cxx +++ b/Source/cmNinjaLinkLineComputer.cxx @@ -5,7 +5,7 @@ #include "cmGlobalNinjaGenerator.h" cmNinjaLinkLineComputer::cmNinjaLinkLineComputer( - cmOutputConverter* outputConverter, cmState::Directory stateDir, + cmOutputConverter* outputConverter, cmStateDirectory stateDir, cmGlobalNinjaGenerator const* gg) : cmLinkLineComputer(outputConverter, stateDir) , GG(gg) diff --git a/Source/cmNinjaLinkLineComputer.h b/Source/cmNinjaLinkLineComputer.h index a108568..daecea4 100644 --- a/Source/cmNinjaLinkLineComputer.h +++ b/Source/cmNinjaLinkLineComputer.h @@ -13,7 +13,7 @@ class cmNinjaLinkLineComputer : public cmLinkLineComputer { public: cmNinjaLinkLineComputer(cmOutputConverter* outputConverter, - cmState::Directory stateDir, + cmStateDirectory stateDir, cmGlobalNinjaGenerator const* gg); std::string ConvertToLinkReference(std::string const& input) const diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index 84a433c..a1228e5 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -78,7 +78,7 @@ static bool cmOutputConverterNotAbove(const char* a, const char* b) bool cmOutputConverter::ContainedInDirectory(std::string const& local_path, std::string const& remote_path, - cmState::Directory directory) + cmStateDirectory directory) { const std::string relativePathTopBinary = directory.GetRelativePathTopBinary(); diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h index 71cacab..9e745ec 100644 --- a/Source/cmOutputConverter.h +++ b/Source/cmOutputConverter.h @@ -92,7 +92,7 @@ public: static bool ContainedInDirectory(std::string const& local_path, std::string const& remote_path, - cmState::Directory directory); + cmStateDirectory directory); /** * Convert the given remote path to a relative path with respect to -- cgit v0.12 From a9bf981a4c0ee3aece0b162ba7ebc76ad99330eb Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 18 Oct 2016 21:28:47 +0200 Subject: cmState: Move Snapshot type to separate namespace Leave behind a typedef to avoid porting dependent code in this commit. --- Source/cmState.cxx | 172 ++++++++++++++++++++++++++-------------------------- Source/cmState.h | 174 +++++++++++++++++++++++++++-------------------------- 2 files changed, 174 insertions(+), 172 deletions(-) diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 31aac63..32fe66c 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -96,7 +96,7 @@ struct cmStateDetail::BuildsystemDirectoryStateType cmPropertyMap Properties; - std::vector Children; + std::vector Children; }; cmState::cmState() @@ -304,7 +304,7 @@ void cmState::RemoveCacheEntryProperty(std::string const& key, .SetProperty(propertyName, (void*)CM_NULLPTR); } -cmState::Snapshot cmState::Reset() +cmStateSnapshot cmState::Reset() { this->GlobalProperties.clear(); this->PropertyDefinitions.clear(); @@ -360,7 +360,7 @@ cmState::Snapshot cmState::Reset() this->DefineProperty("RULE_LAUNCH_LINK", cmProperty::TARGET, "", "", true); this->DefineProperty("RULE_LAUNCH_CUSTOM", cmProperty::TARGET, "", "", true); - return Snapshot(this, pos); + return cmStateSnapshot(this, pos); } void cmState::DefineProperty(const std::string& name, @@ -682,8 +682,8 @@ void cmStateDirectory::ComputeRelativePathTopSource() // construct relative paths passed to build tools so it is safe to use // even when the source is a network path. - cmState::Snapshot snapshot = this->Snapshot_; - std::vector snapshots; + cmStateSnapshot snapshot = this->Snapshot_; + std::vector snapshots; snapshots.push_back(snapshot); while (true) { snapshot = snapshot.GetBuildsystemDirectoryParent(); @@ -696,8 +696,7 @@ void cmStateDirectory::ComputeRelativePathTopSource() std::string result = snapshots.front().GetDirectory().GetCurrentSource(); - for (std::vector::const_iterator it = - snapshots.begin() + 1; + for (std::vector::const_iterator it = snapshots.begin() + 1; it != snapshots.end(); ++it) { std::string currentSource = it->GetDirectory().GetCurrentSource(); if (cmSystemTools::IsSubDirectory(result, currentSource)) { @@ -709,8 +708,8 @@ void cmStateDirectory::ComputeRelativePathTopSource() void cmStateDirectory::ComputeRelativePathTopBinary() { - cmState::Snapshot snapshot = this->Snapshot_; - std::vector snapshots; + cmStateSnapshot snapshot = this->Snapshot_; + std::vector snapshots; snapshots.push_back(snapshot); while (true) { snapshot = snapshot.GetBuildsystemDirectoryParent(); @@ -723,8 +722,7 @@ void cmStateDirectory::ComputeRelativePathTopBinary() std::string result = snapshots.front().GetDirectory().GetCurrentBinary(); - for (std::vector::const_iterator it = - snapshots.begin() + 1; + for (std::vector::const_iterator it = snapshots.begin() + 1; it != snapshots.end(); ++it) { std::string currentBinary = it->GetDirectory().GetCurrentBinary(); if (cmSystemTools::IsSubDirectory(result, currentBinary)) { @@ -742,7 +740,7 @@ void cmStateDirectory::ComputeRelativePathTopBinary() } } -cmState::Snapshot cmState::CreateBaseSnapshot() +cmStateSnapshot cmState::CreateBaseSnapshot() { cmStateDetail::PositionType pos = this->SnapshotData.Push(this->SnapshotData.Root()); @@ -767,11 +765,11 @@ cmState::Snapshot cmState::CreateBaseSnapshot() assert(pos->Vars.IsValid()); pos->Parent = this->VarTree.Root(); pos->Root = this->VarTree.Root(); - return cmState::Snapshot(this, pos); + return cmStateSnapshot(this, pos); } -cmState::Snapshot cmState::CreateBuildsystemDirectorySnapshot( - Snapshot originSnapshot) +cmStateSnapshot cmState::CreateBuildsystemDirectorySnapshot( + cmStateSnapshot originSnapshot) { assert(originSnapshot.IsValid()); cmStateDetail::PositionType pos = @@ -796,7 +794,7 @@ cmState::Snapshot cmState::CreateBuildsystemDirectorySnapshot( pos->Root = origin; pos->Vars = this->VarTree.Push(origin); - cmState::Snapshot snapshot = cmState::Snapshot(this, pos); + cmStateSnapshot snapshot = cmStateSnapshot(this, pos); originSnapshot.Position->BuildSystemDirectory->Children.push_back(snapshot); snapshot.SetDefaultDefinitions(); snapshot.InitializeFromParent(); @@ -804,8 +802,8 @@ cmState::Snapshot cmState::CreateBuildsystemDirectorySnapshot( return snapshot; } -cmState::Snapshot cmState::CreateFunctionCallSnapshot( - cmState::Snapshot originSnapshot, std::string const& fileName) +cmStateSnapshot cmState::CreateFunctionCallSnapshot( + cmStateSnapshot originSnapshot, std::string const& fileName) { cmStateDetail::PositionType pos = this->SnapshotData.Push(originSnapshot.Position, *originSnapshot.Position); @@ -820,11 +818,11 @@ cmState::Snapshot cmState::CreateFunctionCallSnapshot( cmLinkedTree::iterator origin = originSnapshot.Position->Vars; pos->Parent = origin; pos->Vars = this->VarTree.Push(origin); - return cmState::Snapshot(this, pos); + return cmStateSnapshot(this, pos); } -cmState::Snapshot cmState::CreateMacroCallSnapshot( - cmState::Snapshot originSnapshot, std::string const& fileName) +cmStateSnapshot cmState::CreateMacroCallSnapshot( + cmStateSnapshot originSnapshot, std::string const& fileName) { cmStateDetail::PositionType pos = this->SnapshotData.Push(originSnapshot.Position, *originSnapshot.Position); @@ -835,11 +833,11 @@ cmState::Snapshot cmState::CreateMacroCallSnapshot( assert(originSnapshot.Position->Vars.IsValid()); pos->BuildSystemDirectory->DirectoryEnd = pos; pos->PolicyScope = originSnapshot.Position->Policies; - return cmState::Snapshot(this, pos); + return cmStateSnapshot(this, pos); } -cmState::Snapshot cmState::CreateIncludeFileSnapshot( - cmState::Snapshot originSnapshot, const std::string& fileName) +cmStateSnapshot cmState::CreateIncludeFileSnapshot( + cmStateSnapshot originSnapshot, const std::string& fileName) { cmStateDetail::PositionType pos = this->SnapshotData.Push(originSnapshot.Position, *originSnapshot.Position); @@ -850,11 +848,11 @@ cmState::Snapshot cmState::CreateIncludeFileSnapshot( assert(originSnapshot.Position->Vars.IsValid()); pos->BuildSystemDirectory->DirectoryEnd = pos; pos->PolicyScope = originSnapshot.Position->Policies; - return cmState::Snapshot(this, pos); + return cmStateSnapshot(this, pos); } -cmState::Snapshot cmState::CreateVariableScopeSnapshot( - cmState::Snapshot originSnapshot) +cmStateSnapshot cmState::CreateVariableScopeSnapshot( + cmStateSnapshot originSnapshot) { cmStateDetail::PositionType pos = this->SnapshotData.Push(originSnapshot.Position, *originSnapshot.Position); @@ -868,11 +866,11 @@ cmState::Snapshot cmState::CreateVariableScopeSnapshot( pos->Parent = origin; pos->Vars = this->VarTree.Push(origin); assert(pos->Vars.IsValid()); - return cmState::Snapshot(this, pos); + return cmStateSnapshot(this, pos); } -cmState::Snapshot cmState::CreateInlineListFileSnapshot( - cmState::Snapshot originSnapshot, const std::string& fileName) +cmStateSnapshot cmState::CreateInlineListFileSnapshot( + cmStateSnapshot originSnapshot, const std::string& fileName) { cmStateDetail::PositionType pos = this->SnapshotData.Push(originSnapshot.Position, *originSnapshot.Position); @@ -882,11 +880,11 @@ cmState::Snapshot cmState::CreateInlineListFileSnapshot( originSnapshot.Position->ExecutionListFile, fileName); pos->BuildSystemDirectory->DirectoryEnd = pos; pos->PolicyScope = originSnapshot.Position->Policies; - return cmState::Snapshot(this, pos); + return cmStateSnapshot(this, pos); } -cmState::Snapshot cmState::CreatePolicyScopeSnapshot( - cmState::Snapshot originSnapshot) +cmStateSnapshot cmState::CreatePolicyScopeSnapshot( + cmStateSnapshot originSnapshot) { cmStateDetail::PositionType pos = this->SnapshotData.Push(originSnapshot.Position, *originSnapshot.Position); @@ -894,10 +892,10 @@ cmState::Snapshot cmState::CreatePolicyScopeSnapshot( pos->Keep = false; pos->BuildSystemDirectory->DirectoryEnd = pos; pos->PolicyScope = originSnapshot.Position->Policies; - return cmState::Snapshot(this, pos); + return cmStateSnapshot(this, pos); } -cmState::Snapshot cmState::Pop(cmState::Snapshot originSnapshot) +cmStateSnapshot cmState::Pop(cmStateSnapshot originSnapshot) { cmStateDetail::PositionType pos = originSnapshot.Position; cmStateDetail::PositionType prevPos = pos; @@ -922,28 +920,28 @@ cmState::Snapshot cmState::Pop(cmState::Snapshot originSnapshot) this->SnapshotData.Pop(pos); } - return Snapshot(this, prevPos); + return cmStateSnapshot(this, prevPos); } -cmState::Snapshot::Snapshot(cmState* state) +cmStateSnapshot::cmStateSnapshot(cmState* state) : State(state) , Position() { } -std::vector cmState::Snapshot::GetChildren() +std::vector cmStateSnapshot::GetChildren() { return this->Position->BuildSystemDirectory->Children; } -cmState::Snapshot::Snapshot(cmState* state, - cmStateDetail::PositionType position) +cmStateSnapshot::cmStateSnapshot(cmState* state, + cmStateDetail::PositionType position) : State(state) , Position(position) { } -cmStateEnums::SnapshotType cmState::Snapshot::GetType() const +cmStateEnums::SnapshotType cmStateSnapshot::GetType() const { return this->Position->SnapshotType; } @@ -982,7 +980,7 @@ void cmStateDirectory::SetCurrentBinary(std::string const& dir) this->Snapshot_.SetDefinition("CMAKE_CURRENT_BINARY_DIR", loc); } -void cmState::Snapshot::SetListFile(const std::string& listfile) +void cmStateSnapshot::SetListFile(const std::string& listfile) { *this->Position->ExecutionListFile = listfile; } @@ -1007,39 +1005,39 @@ void cmStateDirectory::SetRelativePathTopBinary(const char* dir) this->DirectoryState->RelativePathTopBinary = dir; } -std::string cmState::Snapshot::GetExecutionListFile() const +std::string cmStateSnapshot::GetExecutionListFile() const { return *this->Position->ExecutionListFile; } -bool cmState::Snapshot::IsValid() const +bool cmStateSnapshot::IsValid() const { return this->State && this->Position.IsValid() ? this->Position != this->State->SnapshotData.Root() : false; } -cmState::Snapshot cmState::Snapshot::GetBuildsystemDirectoryParent() const +cmStateSnapshot cmStateSnapshot::GetBuildsystemDirectoryParent() const { - Snapshot snapshot; + cmStateSnapshot snapshot; if (!this->State || this->Position == this->State->SnapshotData.Root()) { return snapshot; } cmStateDetail::PositionType parentPos = this->Position->DirectoryParent; if (parentPos != this->State->SnapshotData.Root()) { - snapshot = - Snapshot(this->State, parentPos->BuildSystemDirectory->DirectoryEnd); + snapshot = cmStateSnapshot(this->State, + parentPos->BuildSystemDirectory->DirectoryEnd); } return snapshot; } -cmState::Snapshot cmState::Snapshot::GetCallStackParent() const +cmStateSnapshot cmStateSnapshot::GetCallStackParent() const { assert(this->State); assert(this->Position != this->State->SnapshotData.Root()); - Snapshot snapshot; + cmStateSnapshot snapshot; cmStateDetail::PositionType parentPos = this->Position; while (parentPos->SnapshotType == cmStateEnums::PolicyScopeType || parentPos->SnapshotType == cmStateEnums::VariableScopeType) { @@ -1060,11 +1058,11 @@ cmState::Snapshot cmState::Snapshot::GetCallStackParent() const return snapshot; } - snapshot = Snapshot(this->State, parentPos); + snapshot = cmStateSnapshot(this->State, parentPos); return snapshot; } -cmState::Snapshot cmState::Snapshot::GetCallStackBottom() const +cmStateSnapshot cmStateSnapshot::GetCallStackBottom() const { assert(this->State); assert(this->Position != this->State->SnapshotData.Root()); @@ -1075,17 +1073,17 @@ cmState::Snapshot cmState::Snapshot::GetCallStackBottom() const pos != this->State->SnapshotData.Root()) { ++pos; } - return Snapshot(this->State, pos); + return cmStateSnapshot(this->State, pos); } -void cmState::Snapshot::PushPolicy(cmPolicies::PolicyMap entry, bool weak) +void cmStateSnapshot::PushPolicy(cmPolicies::PolicyMap entry, bool weak) { cmStateDetail::PositionType pos = this->Position; pos->Policies = this->State->PolicyStack.Push( pos->Policies, cmStateDetail::PolicyStackEntry(entry, weak)); } -bool cmState::Snapshot::PopPolicy() +bool cmStateSnapshot::PopPolicy() { cmStateDetail::PositionType pos = this->Position; if (pos->Policies == pos->PolicyScope) { @@ -1095,13 +1093,13 @@ bool cmState::Snapshot::PopPolicy() return true; } -bool cmState::Snapshot::CanPopPolicyScope() +bool cmStateSnapshot::CanPopPolicyScope() { return this->Position->Policies == this->Position->PolicyScope; } -void cmState::Snapshot::SetPolicy(cmPolicies::PolicyID id, - cmPolicies::PolicyStatus status) +void cmStateSnapshot::SetPolicy(cmPolicies::PolicyID id, + cmPolicies::PolicyStatus status) { // Update the policy stack from the top to the top-most strong entry. bool previous_was_weak = true; @@ -1113,7 +1111,7 @@ void cmState::Snapshot::SetPolicy(cmPolicies::PolicyID id, } } -cmPolicies::PolicyStatus cmState::Snapshot::GetPolicy( +cmPolicies::PolicyStatus cmStateSnapshot::GetPolicy( cmPolicies::PolicyID id) const { cmPolicies::PolicyStatus status = cmPolicies::GetPolicyStatus(id); @@ -1148,49 +1146,49 @@ cmPolicies::PolicyStatus cmState::Snapshot::GetPolicy( return status; } -bool cmState::Snapshot::HasDefinedPolicyCMP0011() +bool cmStateSnapshot::HasDefinedPolicyCMP0011() { return !this->Position->Policies->IsEmpty(); } -const char* cmState::Snapshot::GetDefinition(std::string const& name) const +const char* cmStateSnapshot::GetDefinition(std::string const& name) const { assert(this->Position->Vars.IsValid()); return cmDefinitions::Get(name, this->Position->Vars, this->Position->Root); } -bool cmState::Snapshot::IsInitialized(std::string const& name) const +bool cmStateSnapshot::IsInitialized(std::string const& name) const { return cmDefinitions::HasKey(name, this->Position->Vars, this->Position->Root); } -void cmState::Snapshot::SetDefinition(std::string const& name, - std::string const& value) +void cmStateSnapshot::SetDefinition(std::string const& name, + std::string const& value) { this->Position->Vars->Set(name, value.c_str()); } -void cmState::Snapshot::RemoveDefinition(std::string const& name) +void cmStateSnapshot::RemoveDefinition(std::string const& name) { this->Position->Vars->Set(name, CM_NULLPTR); } -std::vector cmState::Snapshot::UnusedKeys() const +std::vector cmStateSnapshot::UnusedKeys() const { return this->Position->Vars->UnusedKeys(); } -std::vector cmState::Snapshot::ClosureKeys() const +std::vector cmStateSnapshot::ClosureKeys() const { return cmDefinitions::ClosureKeys(this->Position->Vars, this->Position->Root); } -bool cmState::Snapshot::RaiseScope(std::string const& var, const char* varDef) +bool cmStateSnapshot::RaiseScope(std::string const& var, const char* varDef) { if (this->Position->ScopeParent == this->Position->DirectoryParent) { - Snapshot parentDir = this->GetBuildsystemDirectoryParent(); + cmStateSnapshot parentDir = this->GetBuildsystemDirectoryParent(); if (!parentDir.IsValid()) { return false; } @@ -1241,7 +1239,7 @@ void InitializeContentFromParent(T& parentContent, T& thisContent, contentEndPosition = thisContent.size(); } -void cmState::Snapshot::SetDefaultDefinitions() +void cmStateSnapshot::SetDefaultDefinitions() { /* Up to CMake 2.4 here only WIN32, UNIX and APPLE were set. With CMake must separate between target and host platform. In most cases @@ -1296,7 +1294,7 @@ void cmState::Snapshot::SetDefaultDefinitions() "INCLUDE_REGULAR_EXPRESSION", "^.*$"); } -void cmState::Snapshot::SetDirectoryDefinitions() +void cmStateSnapshot::SetDirectoryDefinitions() { this->SetDefinition("CMAKE_SOURCE_DIR", this->State->GetSourceDirectory()); this->SetDefinition("CMAKE_CURRENT_SOURCE_DIR", @@ -1306,7 +1304,7 @@ void cmState::Snapshot::SetDirectoryDefinitions() this->State->GetBinaryDirectory()); } -void cmState::Snapshot::InitializeFromParent() +void cmStateSnapshot::InitializeFromParent() { cmStateDetail::PositionType parent = this->Position->DirectoryParent; assert(this->Position->Vars.IsValid()); @@ -1337,27 +1335,27 @@ void cmState::Snapshot::InitializeFromParent() this->Position->CompileOptionsPosition); } -cmState* cmState::Snapshot::GetState() const +cmState* cmStateSnapshot::GetState() const { return this->State; } -cmStateDirectory cmState::Snapshot::GetDirectory() const +cmStateDirectory cmStateSnapshot::GetDirectory() const { return cmStateDirectory(this->Position->BuildSystemDirectory, *this); } -void cmState::Snapshot::SetProjectName(const std::string& name) +void cmStateSnapshot::SetProjectName(const std::string& name) { this->Position->BuildSystemDirectory->ProjectName = name; } -std::string cmState::Snapshot::GetProjectName() const +std::string cmStateSnapshot::GetProjectName() const { return this->Position->BuildSystemDirectory->ProjectName; } -void cmState::Snapshot::InitializeFromParent_ForSubdirsCommand() +void cmStateSnapshot::InitializeFromParent_ForSubdirsCommand() { std::string currentSrcDir = this->GetDefinition("CMAKE_CURRENT_SOURCE_DIR"); std::string currentBinDir = this->GetDefinition("CMAKE_CURRENT_BINARY_DIR"); @@ -1371,7 +1369,7 @@ void cmState::Snapshot::InitializeFromParent_ForSubdirsCommand() cmStateDirectory::cmStateDirectory( cmLinkedTree::iterator iter, - const cmState::Snapshot& snapshot) + const cmStateSnapshot& snapshot) : DirectoryState(iter) , Snapshot_(snapshot) { @@ -1591,8 +1589,8 @@ void cmStateDirectory::ClearCompileOptions() this->Snapshot_.Position->CompileOptionsPosition); } -bool cmState::Snapshot::StrictWeakOrder::operator()( - const cmState::Snapshot& lhs, const cmState::Snapshot& rhs) const +bool cmStateSnapshot::StrictWeakOrder::operator()( + const cmStateSnapshot& lhs, const cmStateSnapshot& rhs) const { return lhs.Position.StrictWeakOrdered(rhs.Position); } @@ -1661,7 +1659,7 @@ const char* cmStateDirectory::GetProperty(const std::string& prop, static std::string output; output = ""; if (prop == "PARENT_DIRECTORY") { - cmState::Snapshot parent = this->Snapshot_.GetBuildsystemDirectoryParent(); + cmStateSnapshot parent = this->Snapshot_.GetBuildsystemDirectoryParent(); if (parent.IsValid()) { return parent.GetDirectory().GetCurrentSource(); } @@ -1677,9 +1675,9 @@ const char* cmStateDirectory::GetProperty(const std::string& prop, } if (prop == kSUBDIRECTORIES) { std::vector child_dirs; - std::vector const& children = + std::vector const& children = this->DirectoryState->Children; - for (std::vector::const_iterator ci = children.begin(); + for (std::vector::const_iterator ci = children.begin(); ci != children.end(); ++ci) { child_dirs.push_back(ci->GetDirectory().GetCurrentSource()); } @@ -1693,7 +1691,7 @@ const char* cmStateDirectory::GetProperty(const std::string& prop, if (prop == "LISTFILE_STACK") { std::vector listFiles; - cmState::Snapshot snp = this->Snapshot_; + cmStateSnapshot snp = this->Snapshot_; while (snp.IsValid()) { listFiles.push_back(snp.GetExecutionListFile()); snp = snp.GetCallStackParent(); @@ -1730,7 +1728,7 @@ const char* cmStateDirectory::GetProperty(const std::string& prop, const char* retVal = this->DirectoryState->Properties.GetPropertyValue(prop); if (!retVal && chain) { - cmState::Snapshot parentSnapshot = + cmStateSnapshot parentSnapshot = this->Snapshot_.GetBuildsystemDirectoryParent(); if (parentSnapshot.IsValid()) { return parentSnapshot.GetDirectory().GetProperty(prop, chain); @@ -1763,12 +1761,12 @@ void cmStateDirectory::AddNormalTargetName(std::string const& name) this->DirectoryState->NormalTargetNames.push_back(name); } -bool operator==(const cmState::Snapshot& lhs, const cmState::Snapshot& rhs) +bool operator==(const cmStateSnapshot& lhs, const cmStateSnapshot& rhs) { return lhs.Position == rhs.Position; } -bool operator!=(const cmState::Snapshot& lhs, const cmState::Snapshot& rhs) +bool operator!=(const cmStateSnapshot& lhs, const cmStateSnapshot& rhs) { return lhs.Position != rhs.Position; } diff --git a/Source/cmState.h b/Source/cmState.h index 843a5cf..82eec3f 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -69,97 +69,35 @@ enum CacheEntryType } class cmStateDirectory; +class cmStateSnapshot; class cmState { + friend class cmStateSnapshot; public: cmState(); ~cmState(); + typedef cmStateSnapshot Snapshot; typedef cmStateDirectory Directory; - class Snapshot - { - public: - Snapshot(cmState* state = CM_NULLPTR); - Snapshot(cmState* state, cmStateDetail::PositionType position); - - const char* GetDefinition(std::string const& name) const; - bool IsInitialized(std::string const& name) const; - void SetDefinition(std::string const& name, std::string const& value); - void RemoveDefinition(std::string const& name); - std::vector UnusedKeys() const; - std::vector ClosureKeys() const; - bool RaiseScope(std::string const& var, const char* varDef); - - void SetListFile(std::string const& listfile); - - std::string GetExecutionListFile() const; - - std::vector GetChildren(); - - bool IsValid() const; - Snapshot GetBuildsystemDirectoryParent() const; - Snapshot GetCallStackParent() const; - Snapshot GetCallStackBottom() const; - cmStateEnums::SnapshotType GetType() const; - - void SetPolicy(cmPolicies::PolicyID id, cmPolicies::PolicyStatus status); - cmPolicies::PolicyStatus GetPolicy(cmPolicies::PolicyID id) const; - bool HasDefinedPolicyCMP0011(); - void PushPolicy(cmPolicies::PolicyMap entry, bool weak); - bool PopPolicy(); - bool CanPopPolicyScope(); - - cmState* GetState() const; - - cmStateDirectory GetDirectory() const; - - void SetProjectName(std::string const& name); - std::string GetProjectName() const; - - void InitializeFromParent_ForSubdirsCommand(); - - struct StrictWeakOrder - { - bool operator()(const cmState::Snapshot& lhs, - const cmState::Snapshot& rhs) const; - }; - - void SetDirectoryDefinitions(); - void SetDefaultDefinitions(); - - private: - friend bool operator==(const cmState::Snapshot& lhs, - const cmState::Snapshot& rhs); - friend bool operator!=(const cmState::Snapshot& lhs, - const cmState::Snapshot& rhs); - friend class cmState; - friend class cmStateDirectory; - friend struct StrictWeakOrder; - - void InitializeFromParent(); - - cmState* State; - cmStateDetail::PositionType Position; - }; - static const char* GetTargetTypeName(cmStateEnums::TargetType targetType); - Snapshot CreateBaseSnapshot(); - Snapshot CreateBuildsystemDirectorySnapshot(Snapshot originSnapshot); - Snapshot CreateFunctionCallSnapshot(Snapshot originSnapshot, - std::string const& fileName); - Snapshot CreateMacroCallSnapshot(Snapshot originSnapshot, - std::string const& fileName); - Snapshot CreateIncludeFileSnapshot(Snapshot originSnapshot, - std::string const& fileName); - Snapshot CreateVariableScopeSnapshot(Snapshot originSnapshot); - Snapshot CreateInlineListFileSnapshot(Snapshot originSnapshot, - std::string const& fileName); - Snapshot CreatePolicyScopeSnapshot(Snapshot originSnapshot); - Snapshot Pop(Snapshot originSnapshot); + cmStateSnapshot CreateBaseSnapshot(); + cmStateSnapshot CreateBuildsystemDirectorySnapshot( + cmStateSnapshot originSnapshot); + cmStateSnapshot CreateFunctionCallSnapshot(cmStateSnapshot originSnapshot, + std::string const& fileName); + cmStateSnapshot CreateMacroCallSnapshot(cmStateSnapshot originSnapshot, + std::string const& fileName); + cmStateSnapshot CreateIncludeFileSnapshot(cmStateSnapshot originSnapshot, + std::string const& fileName); + cmStateSnapshot CreateVariableScopeSnapshot(cmStateSnapshot originSnapshot); + cmStateSnapshot CreateInlineListFileSnapshot(cmStateSnapshot originSnapshot, + std::string const& fileName); + cmStateSnapshot CreatePolicyScopeSnapshot(cmStateSnapshot originSnapshot); + cmStateSnapshot Pop(cmStateSnapshot originSnapshot); static cmStateEnums::CacheEntryType StringToCacheEntryType(const char*); static const char* CacheEntryTypeToString(cmStateEnums::CacheEntryType); @@ -204,7 +142,7 @@ public: std::string& value, cmStateEnums::CacheEntryType& type); - Snapshot Reset(); + cmStateSnapshot Reset(); // Define a property void DefineProperty(const std::string& name, cmProperty::ScopeType scope, const char* ShortDescription, @@ -295,11 +233,77 @@ private: bool MSYSShell; }; +class cmStateSnapshot +{ +public: + cmStateSnapshot(cmState* state = CM_NULLPTR); + cmStateSnapshot(cmState* state, cmStateDetail::PositionType position); + + const char* GetDefinition(std::string const& name) const; + bool IsInitialized(std::string const& name) const; + void SetDefinition(std::string const& name, std::string const& value); + void RemoveDefinition(std::string const& name); + std::vector UnusedKeys() const; + std::vector ClosureKeys() const; + bool RaiseScope(std::string const& var, const char* varDef); + + void SetListFile(std::string const& listfile); + + std::string GetExecutionListFile() const; + + std::vector GetChildren(); + + bool IsValid() const; + cmStateSnapshot GetBuildsystemDirectoryParent() const; + cmStateSnapshot GetCallStackParent() const; + cmStateSnapshot GetCallStackBottom() const; + cmStateEnums::SnapshotType GetType() const; + + void SetPolicy(cmPolicies::PolicyID id, cmPolicies::PolicyStatus status); + cmPolicies::PolicyStatus GetPolicy(cmPolicies::PolicyID id) const; + bool HasDefinedPolicyCMP0011(); + void PushPolicy(cmPolicies::PolicyMap entry, bool weak); + bool PopPolicy(); + bool CanPopPolicyScope(); + + cmState* GetState() const; + + cmStateDirectory GetDirectory() const; + + void SetProjectName(std::string const& name); + std::string GetProjectName() const; + + void InitializeFromParent_ForSubdirsCommand(); + + struct StrictWeakOrder + { + bool operator()(const cmStateSnapshot& lhs, + const cmStateSnapshot& rhs) const; + }; + + void SetDirectoryDefinitions(); + void SetDefaultDefinitions(); + +private: + friend bool operator==(const cmStateSnapshot& lhs, + const cmStateSnapshot& rhs); + friend bool operator!=(const cmStateSnapshot& lhs, + const cmStateSnapshot& rhs); + friend class cmState; + friend class cmStateDirectory; + friend struct StrictWeakOrder; + + void InitializeFromParent(); + + cmState* State; + cmStateDetail::PositionType Position; +}; + class cmStateDirectory { cmStateDirectory( cmLinkedTree::iterator iter, - cmState::Snapshot const& snapshot); + cmStateSnapshot const& snapshot); public: const char* GetCurrentSource() const; @@ -356,11 +360,11 @@ private: private: cmLinkedTree::iterator DirectoryState; - cmState::Snapshot Snapshot_; - friend class cmState::Snapshot; + cmStateSnapshot Snapshot_; + friend class cmStateSnapshot; }; -bool operator==(const cmState::Snapshot& lhs, const cmState::Snapshot& rhs); -bool operator!=(const cmState::Snapshot& lhs, const cmState::Snapshot& rhs); +bool operator==(const cmStateSnapshot& lhs, const cmStateSnapshot& rhs); +bool operator!=(const cmStateSnapshot& lhs, const cmStateSnapshot& rhs); #endif -- cgit v0.12 From cde6eb6249cd3211cb3391860221ec32f985e53b Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 18 Oct 2016 21:28:48 +0200 Subject: cmState: Port dependent code to new cmStateSnapshot name --- Source/CTest/cmCTestScriptHandler.cxx | 2 +- Source/cmGlobalGenerator.cxx | 14 +++++++------- Source/cmGlobalGenerator.h | 4 ++-- Source/cmGlobalNinjaGenerator.cxx | 7 +++---- Source/cmGlobalUnixMakefileGenerator3.cxx | 11 +++++------ Source/cmGlobalUnixMakefileGenerator3.h | 4 ++-- Source/cmListFileCache.cxx | 6 +++--- Source/cmListFileCache.h | 10 +++++----- Source/cmLocalGenerator.cxx | 10 +++++----- Source/cmLocalGenerator.h | 4 ++-- Source/cmMakefile.cxx | 12 ++++++------ Source/cmMakefile.h | 6 +++--- Source/cmOutputConverter.cxx | 2 +- Source/cmOutputConverter.h | 4 ++-- Source/cmQtAutoGenerators.cxx | 2 +- Source/cmake.cxx | 4 ++-- Source/cmake.h | 9 +++------ Source/cmcmd.cxx | 2 +- 18 files changed, 54 insertions(+), 59 deletions(-) diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 8848a70..e9980d0 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -280,7 +280,7 @@ void cmCTestScriptHandler::CreateCMake() this->CMake->AddCMakePaths(); this->GlobalGenerator = new cmGlobalGenerator(this->CMake); - cmState::Snapshot snapshot = this->CMake->GetCurrentSnapshot(); + cmStateSnapshot snapshot = this->CMake->GetCurrentSnapshot(); std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); snapshot.GetDirectory().SetCurrentSource(cwd); snapshot.GetDirectory().SetCurrentBinary(cwd); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 24a3277..313b65a 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1062,7 +1062,7 @@ void cmGlobalGenerator::Configure() this->FirstTimeProgress = 0.0f; this->ClearGeneratorMembers(); - cmState::Snapshot snapshot = this->CMakeInstance->GetCurrentSnapshot(); + cmStateSnapshot snapshot = this->CMakeInstance->GetCurrentSnapshot(); snapshot.GetDirectory().SetCurrentSource( this->CMakeInstance->GetHomeDirectory()); @@ -1909,10 +1909,10 @@ void cmGlobalGenerator::SetConfiguredFilesPath(cmGlobalGenerator* gen) } } -bool cmGlobalGenerator::IsExcluded(cmState::Snapshot const& rootSnp, - cmState::Snapshot const& snp_) const +bool cmGlobalGenerator::IsExcluded(cmStateSnapshot const& rootSnp, + cmStateSnapshot const& snp_) const { - cmState::Snapshot snp = snp_; + cmStateSnapshot snp = snp_; while (snp.IsValid()) { if (snp == rootSnp) { // No directory excludes itself. @@ -1933,8 +1933,8 @@ bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root, { assert(gen); - cmState::Snapshot rootSnp = root->GetStateSnapshot(); - cmState::Snapshot snp = gen->GetStateSnapshot(); + cmStateSnapshot rootSnp = root->GetStateSnapshot(); + cmStateSnapshot snp = gen->GetStateSnapshot(); return this->IsExcluded(rootSnp, snp); } @@ -1974,7 +1974,7 @@ void cmGlobalGenerator::FillProjectMap() unsigned int i; for (i = 0; i < this->LocalGenerators.size(); ++i) { // for each local generator add all projects - cmState::Snapshot snp = this->LocalGenerators[i]->GetStateSnapshot(); + cmStateSnapshot snp = this->LocalGenerators[i]->GetStateSnapshot(); std::string name; do { std::string snpProjName = snp.GetProjectName(); diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 0f483db..959fe32 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -410,8 +410,8 @@ protected: // has been populated. void FillProjectMap(); void CheckTargetProperties(); - bool IsExcluded(cmState::Snapshot const& root, - cmState::Snapshot const& snp) const; + bool IsExcluded(cmStateSnapshot const& root, + cmStateSnapshot const& snp) const; bool IsExcluded(cmLocalGenerator* root, cmLocalGenerator* gen) const; bool IsExcluded(cmLocalGenerator* root, cmGeneratorTarget* target) const; virtual void InitializeProgressMarks() {} diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index a84baca..7015669 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -1116,9 +1116,9 @@ void cmGlobalNinjaGenerator::WriteFolderTargets(std::ostream& os) // The directory-level rule should depend on the directory-level // rules of the subdirectories. - std::vector const& children = + std::vector const& children = lg->GetStateSnapshot().GetChildren(); - for (std::vector::const_iterator stateIt = + for (std::vector::const_iterator stateIt = children.begin(); stateIt != children.end(); ++stateIt) { targetsPerFolder[currentSourceFolder].push_back( @@ -1667,8 +1667,7 @@ bool cmGlobalNinjaGenerator::WriteDyndepFile( { // Setup path conversions. { - cmState::Snapshot snapshot = - this->GetCMakeInstance()->GetCurrentSnapshot(); + cmStateSnapshot snapshot = this->GetCMakeInstance()->GetCurrentSnapshot(); snapshot.GetDirectory().SetCurrentSource(dir_cur_src); snapshot.GetDirectory().SetCurrentBinary(dir_cur_bld); snapshot.GetDirectory().SetRelativePathTopSource(dir_top_src.c_str()); diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 45f8151..3433d75 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -436,9 +436,8 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRule2( // The directory-level rule should depend on the directory-level // rules of the subdirectories. - std::vector children = - lg->GetStateSnapshot().GetChildren(); - for (std::vector::const_iterator ci = children.begin(); + std::vector children = lg->GetStateSnapshot().GetChildren(); + for (std::vector::const_iterator ci = children.begin(); ci != children.end(); ++ci) { std::string subdir = ci->GetDirectory().GetCurrentBinary(); subdir += "/"; @@ -507,7 +506,7 @@ void cmGlobalUnixMakefileGenerator3::GenerateBuildCommand( if (!this->Makefiles.empty()) { mf = this->Makefiles[0]; } else { - cmState::Snapshot snapshot = this->CMakeInstance->GetCurrentSnapshot(); + cmStateSnapshot snapshot = this->CMakeInstance->GetCurrentSnapshot(); snapshot.GetDirectory().SetCurrentSource( this->CMakeInstance->GetHomeDirectory()); snapshot.GetDirectory().SetCurrentBinary( @@ -817,8 +816,8 @@ void cmGlobalUnixMakefileGenerator3::InitializeProgressMarks() continue; } - cmState::Snapshot csnp = lg->GetStateSnapshot(); - cmState::Snapshot tsnp = tlg->GetStateSnapshot(); + cmStateSnapshot csnp = lg->GetStateSnapshot(); + cmStateSnapshot tsnp = tlg->GetStateSnapshot(); // Consider the directory containing the target and all its // parents until something excludes the target. diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index 1019d86..a1127f9 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -248,8 +248,8 @@ private: const char* GetBuildIgnoreErrorsFlag() const CM_OVERRIDE { return "-i"; } std::string GetEditCacheCommand() const CM_OVERRIDE; - std::map, - cmState::Snapshot::StrictWeakOrder> + std::map, + cmStateSnapshot::StrictWeakOrder> DirectoryTargetsMap; void InitializeProgressMarks() CM_OVERRIDE; }; diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 5e6273c..c8744d4 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -298,7 +298,7 @@ struct cmListFileBacktrace::Entry : public cmListFileContext unsigned int RefCount; }; -cmListFileBacktrace::cmListFileBacktrace(cmState::Snapshot bottom, Entry* up, +cmListFileBacktrace::cmListFileBacktrace(cmStateSnapshot bottom, Entry* up, cmListFileContext const& lfc) : Bottom(bottom) , Cur(new Entry(lfc, up)) @@ -307,7 +307,7 @@ cmListFileBacktrace::cmListFileBacktrace(cmState::Snapshot bottom, Entry* up, this->Cur->Ref(); } -cmListFileBacktrace::cmListFileBacktrace(cmState::Snapshot bottom, Entry* cur) +cmListFileBacktrace::cmListFileBacktrace(cmStateSnapshot bottom, Entry* cur) : Bottom(bottom) , Cur(cur) { @@ -323,7 +323,7 @@ cmListFileBacktrace::cmListFileBacktrace() { } -cmListFileBacktrace::cmListFileBacktrace(cmState::Snapshot snapshot) +cmListFileBacktrace::cmListFileBacktrace(cmStateSnapshot snapshot) : Bottom(snapshot.GetCallStackBottom()) , Cur(CM_NULLPTR) { diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h index fd779c7..83aac51 100644 --- a/Source/cmListFileCache.h +++ b/Source/cmListFileCache.h @@ -113,14 +113,14 @@ public: // Construct an empty backtrace whose bottom sits in the directory // indicated by the given valid snapshot. - cmListFileBacktrace(cmState::Snapshot snapshot); + cmListFileBacktrace(cmStateSnapshot snapshot); // Backtraces may be copied and assigned as values. cmListFileBacktrace(cmListFileBacktrace const& r); cmListFileBacktrace& operator=(cmListFileBacktrace const& r); ~cmListFileBacktrace(); - cmState::Snapshot GetBottom() const { return this->Bottom; } + cmStateSnapshot GetBottom() const { return this->Bottom; } // Get a backtrace with the given file scope added to the top. // May not be called until after construction with a valid snapshot. @@ -147,11 +147,11 @@ public: private: struct Entry; - cmState::Snapshot Bottom; + cmStateSnapshot Bottom; Entry* Cur; - cmListFileBacktrace(cmState::Snapshot bottom, Entry* up, + cmListFileBacktrace(cmStateSnapshot bottom, Entry* up, cmListFileContext const& lfc); - cmListFileBacktrace(cmState::Snapshot bottom, Entry* cur); + cmListFileBacktrace(cmStateSnapshot bottom, Entry* cur); }; struct cmListFile diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index b6fb3e6..d90094b 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -249,7 +249,7 @@ void cmLocalGenerator::GenerateTestFiles() (*gi)->Compute(this); (*gi)->Generate(fout, config, configurationTypes); } - typedef std::vector vec_t; + typedef std::vector vec_t; vec_t const& children = this->Makefile->GetStateSnapshot().GetChildren(); std::string parentBinDir = this->GetCurrentBinaryDirectory(); for (vec_t::const_iterator i = children.begin(); i != children.end(); ++i) { @@ -446,12 +446,12 @@ void cmLocalGenerator::GenerateInstallRules() this->GenerateTargetInstallRules(fout, config, configurationTypes); // Include install scripts from subdirectories. - std::vector children = + std::vector children = this->Makefile->GetStateSnapshot().GetChildren(); if (!children.empty()) { fout << "if(NOT CMAKE_INSTALL_LOCAL_ONLY)\n"; fout << " # Include the install script for each subdirectory.\n"; - for (std::vector::const_iterator ci = children.begin(); + for (std::vector::const_iterator ci = children.begin(); ci != children.end(); ++ci) { if (!ci->GetDirectory().GetPropertyAsBool("EXCLUDE_FROM_ALL")) { std::string odir = ci->GetDirectory().GetCurrentBinary(); @@ -563,7 +563,7 @@ cmState* cmLocalGenerator::GetState() const return this->GlobalGenerator->GetCMakeInstance()->GetState(); } -cmState::Snapshot cmLocalGenerator::GetStateSnapshot() const +cmStateSnapshot cmLocalGenerator::GetStateSnapshot() const { return this->Makefile->GetStateSnapshot(); } @@ -1868,7 +1868,7 @@ const char* cmLocalGenerator::GetFeature(const std::string& feature, featureName += "_"; featureName += cmSystemTools::UpperCase(config); } - cmState::Snapshot snp = this->StateSnapshot; + cmStateSnapshot snp = this->StateSnapshot; while (snp.IsValid()) { if (const char* value = snp.GetDirectory().GetProperty(featureName)) { return value; diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 055e1a9..1cea655 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -92,7 +92,7 @@ public: cmGeneratorTarget& tgt) const; cmState* GetState() const; - cmState::Snapshot GetStateSnapshot() const; + cmStateSnapshot GetStateSnapshot() const; void AddArchitectureFlags(std::string& flags, cmGeneratorTarget const* target, @@ -337,7 +337,7 @@ protected: virtual bool CheckDefinition(std::string const& define) const; cmMakefile* Makefile; - cmState::Snapshot StateSnapshot; + cmStateSnapshot StateSnapshot; cmListFileBacktrace DirectoryBacktrace; cmGlobalGenerator* GlobalGenerator; std::map UniqueObjectNamesMap; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 5036b0d..47cb246 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -45,7 +45,7 @@ class cmMessenger; // default is not to be building executables cmMakefile::cmMakefile(cmGlobalGenerator* globalGenerator, - cmState::Snapshot const& snapshot) + cmStateSnapshot const& snapshot) : GlobalGenerator(globalGenerator) , StateSnapshot(snapshot) , Backtrace(snapshot) @@ -1356,7 +1356,7 @@ private: cmMakefile* Makefile; cmGlobalGenerator* GG; cmMakefile* CurrentMakefile; - cmState::Snapshot Snapshot; + cmStateSnapshot Snapshot; bool ReportError; }; @@ -1538,7 +1538,7 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath, return; } - cmState::Snapshot newSnapshot = + cmStateSnapshot newSnapshot = this->GetState()->CreateBuildsystemDirectorySnapshot(this->StateSnapshot); newSnapshot.GetDirectory().SetCurrentSource(srcPath); @@ -3621,7 +3621,7 @@ void cmMakefile::AddCMakeDependFilesFromUser() std::string cmMakefile::FormatListFileStack() const { std::vector listFiles; - cmState::Snapshot snp = this->StateSnapshot; + cmStateSnapshot snp = this->StateSnapshot; while (snp.IsValid()) { listFiles.push_back(snp.GetExecutionListFile()); snp = snp.GetCallStackParent(); @@ -3918,7 +3918,7 @@ void cmMakefile::StoreMatches(cmsys::RegularExpression& re) this->MarkVariableAsUsed(nMatchesVariable); } -cmState::Snapshot cmMakefile::GetStateSnapshot() const +cmStateSnapshot cmMakefile::GetStateSnapshot() const { return this->StateSnapshot; } @@ -3999,7 +3999,7 @@ void cmMakefile::PopPolicy() void cmMakefile::PopSnapshot(bool reportError) { - // cmState::Snapshot manages nested policy scopes within it. + // cmStateSnapshot manages nested policy scopes within it. // Since the scope corresponding to the snapshot is closing, // reject any still-open nested policy scopes with an error. while (!this->StateSnapshot.CanPopPolicyScope()) { diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index e7e8a0b..8ac0e33 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -70,7 +70,7 @@ public: * Construct an empty makefile. */ cmMakefile(cmGlobalGenerator* globalGenerator, - const cmState::Snapshot& snapshot); + const cmStateSnapshot& snapshot); /** * Destructor. @@ -753,7 +753,7 @@ public: void ClearMatches(); void StoreMatches(cmsys::RegularExpression& re); - cmState::Snapshot GetStateSnapshot() const; + cmStateSnapshot GetStateSnapshot() const; const char* GetDefineFlagsCMP0059() const; @@ -829,7 +829,7 @@ private: cmMakefile(const cmMakefile& mf); cmMakefile& operator=(const cmMakefile& mf); - cmState::Snapshot StateSnapshot; + cmStateSnapshot StateSnapshot; cmListFileBacktrace Backtrace; void ReadListFile(cmListFile const& listFile, diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index a1228e5..c219fdf 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -11,7 +11,7 @@ #include #include -cmOutputConverter::cmOutputConverter(cmState::Snapshot snapshot) +cmOutputConverter::cmOutputConverter(cmStateSnapshot snapshot) : StateSnapshot(snapshot) , LinkScriptShell(false) { diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h index 9e745ec..2a81dab 100644 --- a/Source/cmOutputConverter.h +++ b/Source/cmOutputConverter.h @@ -13,7 +13,7 @@ class cmOutputConverter { public: - cmOutputConverter(cmState::Snapshot snapshot); + cmOutputConverter(cmStateSnapshot snapshot); enum OutputFormat { @@ -125,7 +125,7 @@ private: static std::string Shell__GetArgument(const char* in, int flags); private: - cmState::Snapshot StateSnapshot; + cmStateSnapshot StateSnapshot; bool LinkScriptShell; }; diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index b66257c..3c2b148 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -165,7 +165,7 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory, cm.GetCurrentSnapshot().SetDefaultDefinitions(); cmGlobalGenerator gg(&cm); - cmState::Snapshot snapshot = cm.GetCurrentSnapshot(); + cmStateSnapshot snapshot = cm.GetCurrentSnapshot(); snapshot.GetDirectory().SetCurrentBinary(targetDirectory); snapshot.GetDirectory().SetCurrentSource(targetDirectory); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index b50c8bd..388984f 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -481,7 +481,7 @@ void cmake::ReadListFile(const std::vector& args, std::string homeOutputDir = this->GetHomeOutputDirectory(); this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory()); this->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory()); - cmState::Snapshot snapshot = this->GetCurrentSnapshot(); + cmStateSnapshot snapshot = this->GetCurrentSnapshot(); snapshot.GetDirectory().SetCurrentBinary( cmSystemTools::GetCurrentWorkingDirectory()); snapshot.GetDirectory().SetCurrentSource( @@ -517,7 +517,7 @@ bool cmake::FindPackage(const std::vector& args) cmGlobalGenerator* gg = new cmGlobalGenerator(this); this->SetGlobalGenerator(gg); - cmState::Snapshot snapshot = this->GetCurrentSnapshot(); + cmStateSnapshot snapshot = this->GetCurrentSnapshot(); snapshot.GetDirectory().SetCurrentBinary( cmSystemTools::GetCurrentWorkingDirectory()); snapshot.GetDirectory().SetCurrentSource( diff --git a/Source/cmake.h b/Source/cmake.h index cff753f..0a577ad 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -407,14 +407,11 @@ public: void WatchUnusedCli(const std::string& var); cmState* GetState() const { return this->State; } - void SetCurrentSnapshot(cmState::Snapshot snapshot) + void SetCurrentSnapshot(cmStateSnapshot snapshot) { this->CurrentSnapshot = snapshot; } - cmState::Snapshot GetCurrentSnapshot() const - { - return this->CurrentSnapshot; - } + cmStateSnapshot GetCurrentSnapshot() const { return this->CurrentSnapshot; } protected: void RunCheckForUnusedVariables(); @@ -490,7 +487,7 @@ private: InstalledFilesMap InstalledFiles; cmState* State; - cmState::Snapshot CurrentSnapshot; + cmStateSnapshot CurrentSnapshot; cmMessenger* Messenger; std::vector TraceOnlyThisSources; diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 4387bf6..912acdb 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -760,7 +760,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) cm.GetCurrentSnapshot().SetDefaultDefinitions(); if (cmGlobalGenerator* ggd = cm.CreateGlobalGenerator(gen)) { cm.SetGlobalGenerator(ggd); - cmState::Snapshot snapshot = cm.GetCurrentSnapshot(); + cmStateSnapshot snapshot = cm.GetCurrentSnapshot(); snapshot.GetDirectory().SetCurrentBinary(startOutDir); snapshot.GetDirectory().SetCurrentSource(startDir); CM_AUTO_PTR mf(new cmMakefile(ggd, snapshot)); -- cgit v0.12 From 34433c88e259493a22c59558e1ee052251f2c149 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 18 Oct 2016 21:28:48 +0200 Subject: cmState: Remove compatibility typedefs --- Source/cmState.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/Source/cmState.h b/Source/cmState.h index 82eec3f..c7cf756 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -79,9 +79,6 @@ public: cmState(); ~cmState(); - typedef cmStateSnapshot Snapshot; - typedef cmStateDirectory Directory; - static const char* GetTargetTypeName(cmStateEnums::TargetType targetType); cmStateSnapshot CreateBaseSnapshot(); -- cgit v0.12 From 27be1d815298ebf343823ff99baa35484da92a85 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 18 Oct 2016 21:28:48 +0200 Subject: cmState: Move extracted declarations to a separate file --- Source/cmState.h | 46 +----------------------------------------- Source/cmStateTypes.h | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 45 deletions(-) create mode 100644 Source/cmStateTypes.h diff --git a/Source/cmState.h b/Source/cmState.h index c7cf756..938c90b 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -12,6 +12,7 @@ #include "cmProperty.h" #include "cmPropertyDefinitionMap.h" #include "cmPropertyMap.h" +#include "cmStateTypes.h" #include #include @@ -23,51 +24,6 @@ class cmCommand; class cmListFileBacktrace; class cmPropertyDefinition; -namespace cmStateDetail { -struct BuildsystemDirectoryStateType; -struct SnapshotDataType; -struct PolicyStackEntry; -typedef cmLinkedTree::iterator PositionType; -} - -namespace cmStateEnums { - -enum SnapshotType -{ - BaseType, - BuildsystemDirectoryType, - FunctionCallType, - MacroCallType, - IncludeFileType, - InlineListFileType, - PolicyScopeType, - VariableScopeType -}; - -enum TargetType -{ - EXECUTABLE, - STATIC_LIBRARY, - SHARED_LIBRARY, - MODULE_LIBRARY, - OBJECT_LIBRARY, - UTILITY, - GLOBAL_TARGET, - INTERFACE_LIBRARY, - UNKNOWN_LIBRARY -}; -enum CacheEntryType -{ - BOOL = 0, - PATH, - FILEPATH, - STRING, - INTERNAL, - STATIC, - UNINITIALIZED -}; -} - class cmStateDirectory; class cmStateSnapshot; diff --git a/Source/cmStateTypes.h b/Source/cmStateTypes.h new file mode 100644 index 0000000..75f9e60 --- /dev/null +++ b/Source/cmStateTypes.h @@ -0,0 +1,55 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ + +#ifndef cmStateTypes_h +#define cmStateTypes_h + +#include "cmLinkedTree.h" + +namespace cmStateDetail { +struct BuildsystemDirectoryStateType; +struct SnapshotDataType; +struct PolicyStackEntry; +typedef cmLinkedTree::iterator PositionType; +} + +namespace cmStateEnums { + +enum SnapshotType +{ + BaseType, + BuildsystemDirectoryType, + FunctionCallType, + MacroCallType, + IncludeFileType, + InlineListFileType, + PolicyScopeType, + VariableScopeType +}; + +enum TargetType +{ + EXECUTABLE, + STATIC_LIBRARY, + SHARED_LIBRARY, + MODULE_LIBRARY, + OBJECT_LIBRARY, + UTILITY, + GLOBAL_TARGET, + INTERFACE_LIBRARY, + UNKNOWN_LIBRARY +}; + +enum CacheEntryType +{ + BOOL = 0, + PATH, + FILEPATH, + STRING, + INTERNAL, + STATIC, + UNINITIALIZED +}; +} + +#endif -- cgit v0.12 From a91eaf387287a201d421e90d78bcae8836cc6042 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 18 Oct 2016 21:28:48 +0200 Subject: cmState: Port dependents to new cmStateTypes header --- Source/CMakeLists.txt | 1 + Source/CPack/cmCPackGenerator.cxx | 2 +- Source/CPack/cpack.cxx | 2 +- Source/CTest/cmCTestLaunch.cxx | 2 +- Source/CTest/cmCTestScriptHandler.cxx | 2 +- Source/CTest/cmCTestSubmitHandler.cxx | 2 +- Source/CTest/cmCTestTestHandler.cxx | 2 +- Source/CursesDialog/cmCursesBoolWidget.cxx | 2 +- Source/CursesDialog/cmCursesCacheEntryComposite.cxx | 2 +- Source/CursesDialog/cmCursesDummyWidget.cxx | 2 +- Source/CursesDialog/cmCursesFilePathWidget.cxx | 2 +- Source/CursesDialog/cmCursesMainForm.cxx | 2 +- Source/CursesDialog/cmCursesMainForm.h | 2 +- Source/CursesDialog/cmCursesOptionsWidget.cxx | 2 +- Source/CursesDialog/cmCursesPathWidget.cxx | 2 +- Source/CursesDialog/cmCursesStringWidget.cxx | 2 +- Source/CursesDialog/cmCursesWidget.h | 2 +- Source/cmAddLibraryCommand.cxx | 2 +- Source/cmCTest.cxx | 2 +- Source/cmCommonTargetGenerator.cxx | 2 +- Source/cmComputeLinkDepends.cxx | 2 +- Source/cmComputeLinkInformation.cxx | 2 +- Source/cmComputeTargetDepends.cxx | 2 +- Source/cmCustomCommandGenerator.cxx | 2 +- Source/cmDefinePropertyCommand.cxx | 2 +- Source/cmExportBuildFileGenerator.cxx | 2 +- Source/cmExportFileGenerator.cxx | 2 +- Source/cmExportInstallFileGenerator.cxx | 2 +- Source/cmExportTryCompileFileGenerator.cxx | 2 +- Source/cmExtraCodeBlocksGenerator.cxx | 2 +- Source/cmExtraCodeLiteGenerator.cxx | 2 +- Source/cmExtraEclipseCDT4Generator.cxx | 2 +- Source/cmExtraKateGenerator.cxx | 2 +- Source/cmExtraSublimeTextGenerator.cxx | 2 +- Source/cmFindBase.cxx | 2 +- Source/cmGeneratorExpressionNode.cxx | 2 +- Source/cmGeneratorTarget.h | 2 +- Source/cmGetCMakePropertyCommand.cxx | 2 +- Source/cmGetPropertyCommand.cxx | 2 +- Source/cmGlobalGenerator.cxx | 2 +- Source/cmGlobalKdevelopGenerator.cxx | 2 +- Source/cmGlobalNinjaGenerator.cxx | 2 +- Source/cmGlobalUnixMakefileGenerator3.h | 2 +- Source/cmGlobalWatcomWMakeGenerator.cxx | 2 +- Source/cmGraphVizWriter.h | 2 +- Source/cmInstallTargetGenerator.cxx | 2 +- Source/cmLocalGenerator.h | 2 +- Source/cmLocalNinjaGenerator.cxx | 2 +- Source/cmLocalUnixMakefileGenerator3.cxx | 2 +- Source/cmMakefile.cxx | 2 +- Source/cmMakefileLibraryTargetGenerator.cxx | 2 +- Source/cmMakefileTargetGenerator.cxx | 2 +- Source/cmNinjaNormalTargetGenerator.cxx | 2 +- Source/cmNinjaTargetGenerator.cxx | 2 +- Source/cmNinjaUtilityTargetGenerator.cxx | 2 +- Source/cmPolicies.cxx | 2 +- Source/cmQtAutoGeneratorInitializer.cxx | 2 +- Source/cmQtAutoGenerators.cxx | 2 +- Source/cmSourceFile.cxx | 2 +- Source/cmTarget.h | 2 +- Source/cmTest.cxx | 2 +- Source/cmTestGenerator.cxx | 2 +- 62 files changed, 62 insertions(+), 61 deletions(-) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 71892ba..3124f81 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -360,6 +360,7 @@ set(SRCS cmSourceGroup.h cmState.cxx cmState.h + cmStateTypes.h cmSystemTools.cxx cmSystemTools.h cmTarget.cxx diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index d4135ce..09b9c0d 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -8,7 +8,7 @@ #include "cmGeneratedFileStream.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmXMLSafe.h" #include "cm_auto_ptr.hxx" #include "cmake.h" diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index a3281ab..e3adf6b 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -9,7 +9,7 @@ #include "cmDocumentationEntry.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTypeMacro.h" #include "cm_auto_ptr.hxx" diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index e5c50b2..224681a 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -7,7 +7,7 @@ #include "cmGeneratedFileStream.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmXMLWriter.h" #include "cmake.h" diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index e9980d0..fa816a6 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -21,7 +21,7 @@ #include "cmGeneratedFileStream.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmake.h" diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 06cd77f..a114755 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -7,7 +7,7 @@ #include "cmCTestScriptHandler.h" #include "cmCurl.h" #include "cmGeneratedFileStream.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmXMLParser.h" #include "cmake.h" diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 0d0237f..09efafb 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -9,7 +9,7 @@ #include "cmGeneratedFileStream.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmXMLWriter.h" #include "cm_auto_ptr.hxx" diff --git a/Source/CursesDialog/cmCursesBoolWidget.cxx b/Source/CursesDialog/cmCursesBoolWidget.cxx index 3b81c65..80a5b5b 100644 --- a/Source/CursesDialog/cmCursesBoolWidget.cxx +++ b/Source/CursesDialog/cmCursesBoolWidget.cxx @@ -3,7 +3,7 @@ #include "cmCursesBoolWidget.h" #include "cmCursesWidget.h" -#include "cmState.h" +#include "cmStateTypes.h" #include diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx index 46c0d0c..5d29942 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx @@ -9,7 +9,7 @@ #include "cmCursesPathWidget.h" #include "cmCursesStringWidget.h" #include "cmCursesWidget.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmake.h" diff --git a/Source/CursesDialog/cmCursesDummyWidget.cxx b/Source/CursesDialog/cmCursesDummyWidget.cxx index b5a1daa..da0478a 100644 --- a/Source/CursesDialog/cmCursesDummyWidget.cxx +++ b/Source/CursesDialog/cmCursesDummyWidget.cxx @@ -3,7 +3,7 @@ #include "cmCursesDummyWidget.h" #include "cmCursesWidget.h" -#include "cmState.h" +#include "cmStateTypes.h" cmCursesDummyWidget::cmCursesDummyWidget(int width, int height, int left, int top) diff --git a/Source/CursesDialog/cmCursesFilePathWidget.cxx b/Source/CursesDialog/cmCursesFilePathWidget.cxx index ee5f2d7..518da4f 100644 --- a/Source/CursesDialog/cmCursesFilePathWidget.cxx +++ b/Source/CursesDialog/cmCursesFilePathWidget.cxx @@ -3,7 +3,7 @@ #include "cmCursesFilePathWidget.h" #include "cmCursesPathWidget.h" -#include "cmState.h" +#include "cmStateTypes.h" cmCursesFilePathWidget::cmCursesFilePathWidget(int width, int height, int left, int top) diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 0db0200..e8e70df 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -11,7 +11,7 @@ #include "cmCursesStandardIncludes.h" #include "cmCursesStringWidget.h" #include "cmCursesWidget.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmVersion.h" #include "cmake.h" diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h index 10ae960..d891ea0 100644 --- a/Source/CursesDialog/cmCursesMainForm.h +++ b/Source/CursesDialog/cmCursesMainForm.h @@ -7,7 +7,7 @@ #include "cmCursesForm.h" #include "cmCursesStandardIncludes.h" -#include "cmState.h" +#include "cmStateTypes.h" #include #include diff --git a/Source/CursesDialog/cmCursesOptionsWidget.cxx b/Source/CursesDialog/cmCursesOptionsWidget.cxx index 1b752a6..d26a98f 100644 --- a/Source/CursesDialog/cmCursesOptionsWidget.cxx +++ b/Source/CursesDialog/cmCursesOptionsWidget.cxx @@ -3,7 +3,7 @@ #include "cmCursesOptionsWidget.h" #include "cmCursesWidget.h" -#include "cmState.h" +#include "cmStateTypes.h" #define ctrl(z) ((z)&037) diff --git a/Source/CursesDialog/cmCursesPathWidget.cxx b/Source/CursesDialog/cmCursesPathWidget.cxx index 3f96436..05c3279 100644 --- a/Source/CursesDialog/cmCursesPathWidget.cxx +++ b/Source/CursesDialog/cmCursesPathWidget.cxx @@ -4,7 +4,7 @@ #include "cmCursesMainForm.h" #include "cmCursesStringWidget.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include diff --git a/Source/CursesDialog/cmCursesStringWidget.cxx b/Source/CursesDialog/cmCursesStringWidget.cxx index 0f67d23..eabc642 100644 --- a/Source/CursesDialog/cmCursesStringWidget.cxx +++ b/Source/CursesDialog/cmCursesStringWidget.cxx @@ -6,7 +6,7 @@ #include "cmCursesMainForm.h" #include "cmCursesStandardIncludes.h" #include "cmCursesWidget.h" -#include "cmState.h" +#include "cmStateTypes.h" #include #include diff --git a/Source/CursesDialog/cmCursesWidget.h b/Source/CursesDialog/cmCursesWidget.h index 1ef4ab2..d226dd7 100644 --- a/Source/CursesDialog/cmCursesWidget.h +++ b/Source/CursesDialog/cmCursesWidget.h @@ -6,7 +6,7 @@ #include // IWYU pragma: keep #include "cmCursesStandardIncludes.h" -#include "cmState.h" +#include "cmStateTypes.h" #include diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx index d1281d4..3cde147 100644 --- a/Source/cmAddLibraryCommand.cxx +++ b/Source/cmAddLibraryCommand.cxx @@ -2,7 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmAddLibraryCommand.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmake.h" // cmLibraryCommand diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 3a37eeb..502a709 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -20,7 +20,7 @@ #include "cmGeneratedFileStream.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmVersion.h" #include "cmVersionConfig.h" diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index 72556b8..4d900b6 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -17,7 +17,7 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmSourceFile.h" -#include "cmState.h" +#include "cmStateTypes.h" cmCommonTargetGenerator::cmCommonTargetGenerator(cmGeneratorTarget* gt) : GeneratorTarget(gt) diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 804d900..3e2cf18 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -8,7 +8,7 @@ #include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" #include "cmake.h" diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 565eb15..16bbadb 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -11,7 +11,7 @@ #include "cmOrderDirectories.h" #include "cmOutputConverter.h" #include "cmPolicies.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" #include "cmake.h" diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 4cc4edf..70ed31e 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -10,7 +10,7 @@ #include "cmMakefile.h" #include "cmPolicies.h" #include "cmSourceFile.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" #include "cmTargetDepend.h" diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index 5cb1104..2125f1b 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -9,7 +9,7 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmOutputConverter.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cm_auto_ptr.hxx" diff --git a/Source/cmDefinePropertyCommand.cxx b/Source/cmDefinePropertyCommand.cxx index 8800363..99db478 100644 --- a/Source/cmDefinePropertyCommand.cxx +++ b/Source/cmDefinePropertyCommand.cxx @@ -2,7 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmDefinePropertyCommand.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmake.h" bool cmDefinePropertyCommand::InitialPass(std::vector const& args, diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index e5f7a55..0c25268 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -9,7 +9,7 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmPolicies.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" #include "cmTargetExport.h" diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 3cd72a8..6c21eaf 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -11,7 +11,7 @@ #include "cmMakefile.h" #include "cmOutputConverter.h" #include "cmPolicies.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" #include "cmTargetExport.h" diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 92c3bf1..64ea3c8 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -14,7 +14,7 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmPolicies.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" #include "cmTargetExport.h" diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx index a262e14..cd0a7e6 100644 --- a/Source/cmExportTryCompileFileGenerator.cxx +++ b/Source/cmExportTryCompileFileGenerator.cxx @@ -8,7 +8,7 @@ #include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" #include "cm_auto_ptr.hxx" diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index b91cae9..41fc428 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -9,7 +9,7 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmSourceFile.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmXMLWriter.h" #include "cmake.h" diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index 90d41fe..6f48935 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -8,7 +8,7 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmSourceFile.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmXMLWriter.h" #include "cmake.h" diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index b50db25..d20e386 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -11,7 +11,7 @@ #include "cmOutputConverter.h" #include "cmSourceFile.h" #include "cmSourceGroup.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmXMLWriter.h" #include "cmake.h" diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx index 3f09469..3730433 100644 --- a/Source/cmExtraKateGenerator.cxx +++ b/Source/cmExtraKateGenerator.cxx @@ -8,7 +8,7 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmSourceFile.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index 9a83c49..5d35f13 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -8,7 +8,7 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmSourceFile.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index b8b3463..66433f9 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -3,7 +3,7 @@ #include "cmFindBase.h" #include "cmAlgorithms.h" -#include "cmState.h" +#include "cmStateTypes.h" cmFindBase::cmFindBase() { diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index f34b2d6..86d7dcf 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -15,7 +15,7 @@ #include "cmOutputConverter.h" #include "cmPolicies.h" #include "cmSourceFile.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" #include "cm_auto_ptr.hxx" diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 625c28e..3805bfc 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -8,7 +8,7 @@ #include "cmLinkItem.h" #include "cmListFileCache.h" #include "cmPolicies.h" -#include "cmState.h" +#include "cmStateTypes.h" #include #include diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx index 11373b7..e5949f0 100644 --- a/Source/cmGetCMakePropertyCommand.cxx +++ b/Source/cmGetCMakePropertyCommand.cxx @@ -4,7 +4,7 @@ #include "cmAlgorithms.h" #include "cmGlobalGenerator.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmake.h" // cmGetCMakePropertyCommand diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 39445dd..c44445a 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -5,7 +5,7 @@ #include "cmGlobalGenerator.h" #include "cmPropertyDefinition.h" #include "cmSourceFile.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmTargetPropertyComputer.h" #include "cmTest.h" #include "cmake.h" diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 313b65a..fd3734b 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -28,7 +28,7 @@ #include "cmPolicies.h" #include "cmQtAutoGeneratorInitializer.h" #include "cmSourceFile.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmVersion.h" #include "cmake.h" diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx index 1881b7a..75209c3 100644 --- a/Source/cmGlobalKdevelopGenerator.cxx +++ b/Source/cmGlobalKdevelopGenerator.cxx @@ -8,7 +8,7 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmSourceFile.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" #include "cmXMLWriter.h" diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 7015669..b90428d 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -13,7 +13,7 @@ #include "cmMakefile.h" #include "cmNinjaLinkLineComputer.h" #include "cmOutputConverter.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" #include "cmTargetDepend.h" diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h index a1127f9..843e5dc 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.h +++ b/Source/cmGlobalUnixMakefileGenerator3.h @@ -8,7 +8,7 @@ #include "cmGeneratorTarget.h" #include "cmGlobalCommonGenerator.h" #include "cmGlobalGeneratorFactory.h" -#include "cmState.h" +#include "cmStateTypes.h" #include #include diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx index 94cdb38..f97bb75 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.cxx +++ b/Source/cmGlobalWatcomWMakeGenerator.cxx @@ -4,7 +4,7 @@ #include "cmDocumentationEntry.h" #include "cmMakefile.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmake.h" cmGlobalWatcomWMakeGenerator::cmGlobalWatcomWMakeGenerator(cmake* cm) diff --git a/Source/cmGraphVizWriter.h b/Source/cmGraphVizWriter.h index 8d5515b..1ff07ab 100644 --- a/Source/cmGraphVizWriter.h +++ b/Source/cmGraphVizWriter.h @@ -5,7 +5,7 @@ #include // IWYU pragma: keep -#include "cmState.h" +#include "cmStateTypes.h" #include #include diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index ed3be3f..f1df073 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -9,7 +9,7 @@ #include "cmInstallType.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" #include "cm_auto_ptr.hxx" diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 1cea655..6314aff 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -9,7 +9,7 @@ #include "cmOutputConverter.h" #include "cmPolicies.h" #include "cmRulePlaceholderExpander.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmake.h" #include diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 232e1dc..8789530 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -12,7 +12,7 @@ #include "cmNinjaTargetGenerator.h" #include "cmRulePlaceholderExpander.h" #include "cmSourceFile.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmake.h" diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 5b90f99..eda604d 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -16,7 +16,7 @@ #include "cmOutputConverter.h" #include "cmRulePlaceholderExpander.h" #include "cmSourceFile.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmVersion.h" #include "cmake.h" diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 47cb246..28912c3 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -17,7 +17,7 @@ #include "cmListFileCache.h" #include "cmSourceFile.h" #include "cmSourceFileLocation.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTest.h" #include "cmVersion.h" diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 5bf2f51..cfe1e83 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -12,7 +12,7 @@ #include "cmOSXBundleGenerator.h" #include "cmOutputConverter.h" #include "cmRulePlaceholderExpander.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmake.h" diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 97c430f..4a8924f 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -20,7 +20,7 @@ #include "cmOutputConverter.h" #include "cmRulePlaceholderExpander.h" #include "cmSourceFile.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cm_auto_ptr.hxx" #include "cmake.h" diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index dd903d6..d5d3e90 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -17,7 +17,7 @@ #include "cmOutputConverter.h" #include "cmRulePlaceholderExpander.h" #include "cmSourceFile.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmake.h" diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 6552832..76fe047 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -16,7 +16,7 @@ #include "cmOutputConverter.h" #include "cmRulePlaceholderExpander.h" #include "cmSourceFile.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmake.h" diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx index 7de185a..500ff4a 100644 --- a/Source/cmNinjaUtilityTargetGenerator.cxx +++ b/Source/cmNinjaUtilityTargetGenerator.cxx @@ -12,7 +12,7 @@ #include "cmNinjaTypes.h" #include "cmOutputConverter.h" #include "cmSourceFile.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmake.h" diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 25acb52..41bee8b 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -2,7 +2,7 @@ #include "cmAlgorithms.h" #include "cmMakefile.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmVersion.h" #include "cmake.h" diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx index 5246a67..b04c7ca 100644 --- a/Source/cmQtAutoGeneratorInitializer.cxx +++ b/Source/cmQtAutoGeneratorInitializer.cxx @@ -12,7 +12,7 @@ #include "cmOutputConverter.h" #include "cmSourceFile.h" #include "cmSourceFileLocation.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" #include "cmake.h" diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 3c2b148..dca0f69 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -7,7 +7,7 @@ #include "cmGlobalGenerator.h" #include "cmMakefile.h" #include "cmOutputConverter.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cm_auto_ptr.hxx" #include "cmake.h" diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 5d37578..ba24ff2 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -6,7 +6,7 @@ #include "cmGlobalGenerator.h" #include "cmMakefile.h" #include "cmProperty.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmake.h" diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 6a7c8f0..929e204 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -10,7 +10,7 @@ #include "cmListFileCache.h" #include "cmPolicies.h" #include "cmPropertyMap.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmTargetLinkLibraryType.h" #include diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx index 4d0cbaa..f55dc83 100644 --- a/Source/cmTest.cxx +++ b/Source/cmTest.cxx @@ -4,7 +4,7 @@ #include "cmMakefile.h" #include "cmProperty.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" cmTest::cmTest(cmMakefile* mf) diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index 301660e..843f7b1 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -8,7 +8,7 @@ #include "cmOutputConverter.h" #include "cmProperty.h" #include "cmPropertyMap.h" -#include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTest.h" #include "cm_auto_ptr.hxx" -- cgit v0.12 From e0a84904eb38e145c3a4d4e4ef5d7aceb3c2d196 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 18 Oct 2016 21:28:49 +0200 Subject: cmState: Split auxiliary classes into separate files Port dependents to the new locations as needed. Leave behind a cmState.h include in cmListFileCache to reduce noise. It is removed in a following commit. --- Source/CMakeLists.txt | 4 + Source/cmCommonTargetGenerator.cxx | 1 + Source/cmDependsFortran.cxx | 1 + Source/cmGlobalGenerator.h | 3 +- Source/cmGlobalUnixMakefileGenerator3.cxx | 2 + Source/cmLinkLineComputer.cxx | 1 + Source/cmLinkLineComputer.h | 2 +- Source/cmListFileCache.h | 1 + Source/cmLocalGenerator.cxx | 2 + Source/cmLocalUnixMakefileGenerator3.cxx | 2 + Source/cmMakefile.cxx | 2 + Source/cmMakefile.h | 2 +- Source/cmOutputConverter.cxx | 2 + Source/cmOutputConverter.h | 2 +- Source/cmQtAutoGenerators.cxx | 2 + Source/cmState.cxx | 994 +----------------------------- Source/cmState.h | 135 ---- Source/cmStateDirectory.cxx | 518 ++++++++++++++++ Source/cmStateDirectory.h | 82 +++ Source/cmStatePrivate.h | 94 +++ Source/cmStateSnapshot.cxx | 415 +++++++++++++ Source/cmStateSnapshot.h | 88 +++ Source/cmake.h | 2 +- Source/cmcmd.cxx | 2 +- bootstrap | 2 + 25 files changed, 1228 insertions(+), 1133 deletions(-) create mode 100644 Source/cmStateDirectory.cxx create mode 100644 Source/cmStateDirectory.h create mode 100644 Source/cmStatePrivate.h create mode 100644 Source/cmStateSnapshot.cxx create mode 100644 Source/cmStateSnapshot.h diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 3124f81..2b8c17c 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -360,6 +360,10 @@ set(SRCS cmSourceGroup.h cmState.cxx cmState.h + cmStateDirectory.cxx + cmStateDirectory.h + cmStateSnapshot.cxx + cmStateSnapshot.h cmStateTypes.h cmSystemTools.cxx cmSystemTools.h diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index 4d900b6..95b95c1 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -17,6 +17,7 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmSourceFile.h" +#include "cmStateDirectory.h" #include "cmStateTypes.h" cmCommonTargetGenerator::cmCommonTargetGenerator(cmGeneratorTarget* gt) diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index aaa9d3a..c8723d0 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -7,6 +7,7 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmOutputConverter.h" +#include "cmStateDirectory.h" #include "cmSystemTools.h" #include diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 959fe32..9cc6724 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -6,7 +6,8 @@ #include #include "cmExportSetMap.h" -#include "cmState.h" +#include "cmStateDirectory.h" +#include "cmStateSnapshot.h" #include "cmSystemTools.h" #include "cmTarget.h" #include "cmTargetDepend.h" diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 3433d75..17d49e8 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -12,6 +12,8 @@ #include "cmMakefile.h" #include "cmMakefileTargetGenerator.h" #include "cmOutputConverter.h" +#include "cmState.h" +#include "cmStateDirectory.h" #include "cmSystemTools.h" #include "cmTarget.h" #include "cmTargetDepend.h" diff --git a/Source/cmLinkLineComputer.cxx b/Source/cmLinkLineComputer.cxx index f6d5e70..c271246 100644 --- a/Source/cmLinkLineComputer.cxx +++ b/Source/cmLinkLineComputer.cxx @@ -5,6 +5,7 @@ #include "cmComputeLinkInformation.h" #include "cmGeneratorTarget.h" #include "cmOutputConverter.h" +#include "cmStateDirectory.h" cmLinkLineComputer::cmLinkLineComputer(cmOutputConverter* outputConverter, cmStateDirectory stateDir) diff --git a/Source/cmLinkLineComputer.h b/Source/cmLinkLineComputer.h index 59e7357..6bbb69e 100644 --- a/Source/cmLinkLineComputer.h +++ b/Source/cmLinkLineComputer.h @@ -4,7 +4,7 @@ #ifndef cmLinkLineComputer_h #define cmLinkLineComputer_h -#include "cmState.h" +#include "cmStateDirectory.h" class cmComputeLinkInformation; class cmOutputConverter; diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h index 83aac51..9af00b2 100644 --- a/Source/cmListFileCache.h +++ b/Source/cmListFileCache.h @@ -10,6 +10,7 @@ #include #include "cmState.h" +#include "cmStateSnapshot.h" /** \class cmListFileCache * \brief A class to cache list file contents. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index d90094b..4aecb1d 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -16,6 +16,8 @@ #include "cmMakefile.h" #include "cmRulePlaceholderExpander.h" #include "cmSourceFile.h" +#include "cmState.h" +#include "cmStateDirectory.h" #include "cmSystemTools.h" #include "cmTarget.h" #include "cmTestGenerator.h" diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index eda604d..4f81ef1 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -16,6 +16,8 @@ #include "cmOutputConverter.h" #include "cmRulePlaceholderExpander.h" #include "cmSourceFile.h" +#include "cmState.h" +#include "cmStateDirectory.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmVersion.h" diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 28912c3..00c0e82 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -17,6 +17,8 @@ #include "cmListFileCache.h" #include "cmSourceFile.h" #include "cmSourceFileLocation.h" +#include "cmState.h" +#include "cmStateDirectory.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTest.h" diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 8ac0e33..b61e81b 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -9,7 +9,7 @@ #include "cmListFileCache.h" #include "cmNewLineStyle.h" #include "cmPolicies.h" -#include "cmState.h" +#include "cmStateSnapshot.h" #include "cmTarget.h" #include "cmTargetLinkLibraryType.h" #include "cmake.h" diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index c219fdf..445ad0b 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -3,6 +3,8 @@ #include "cmOutputConverter.h" #include "cmAlgorithms.h" +#include "cmState.h" +#include "cmStateDirectory.h" #include "cmSystemTools.h" #include diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h index 2a81dab..dabb091 100644 --- a/Source/cmOutputConverter.h +++ b/Source/cmOutputConverter.h @@ -5,7 +5,7 @@ #include // IWYU pragma: keep -#include "cmState.h" +#include "cmStateSnapshot.h" #include #include diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index dca0f69..f56f575 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -7,6 +7,8 @@ #include "cmGlobalGenerator.h" #include "cmMakefile.h" #include "cmOutputConverter.h" +#include "cmState.h" +#include "cmStateDirectory.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cm_auto_ptr.hxx" diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 32fe66c..0d1eb3e 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -2,6 +2,8 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmState.h" +#include "cmStatePrivate.h" + #include "cmAlgorithms.h" #include "cmCacheManager.h" #include "cmCommand.h" @@ -9,7 +11,6 @@ #include "cmListFileCache.h" #include "cmSystemTools.h" #include "cmTypeMacro.h" -#include "cmVersion.h" #include "cmake.h" #include @@ -20,85 +21,6 @@ #include #include -static std::string const kBINARY_DIR = "BINARY_DIR"; -static std::string const kBUILDSYSTEM_TARGETS = "BUILDSYSTEM_TARGETS"; -static std::string const kSOURCE_DIR = "SOURCE_DIR"; -static std::string const kSUBDIRECTORIES = "SUBDIRECTORIES"; - -struct cmStateDetail::SnapshotDataType -{ - cmStateDetail::PositionType ScopeParent; - cmStateDetail::PositionType DirectoryParent; - cmLinkedTree::iterator Policies; - cmLinkedTree::iterator PolicyRoot; - cmLinkedTree::iterator PolicyScope; - cmStateEnums::SnapshotType SnapshotType; - bool Keep; - cmLinkedTree::iterator ExecutionListFile; - cmLinkedTree::iterator - BuildSystemDirectory; - cmLinkedTree::iterator Vars; - cmLinkedTree::iterator Root; - cmLinkedTree::iterator Parent; - std::vector::size_type IncludeDirectoryPosition; - std::vector::size_type CompileDefinitionsPosition; - std::vector::size_type CompileOptionsPosition; -}; - -struct cmStateDetail::PolicyStackEntry : public cmPolicies::PolicyMap -{ - typedef cmPolicies::PolicyMap derived; - PolicyStackEntry(bool w = false) - : derived() - , Weak(w) - { - } - PolicyStackEntry(derived const& d, bool w) - : derived(d) - , Weak(w) - { - } - PolicyStackEntry(PolicyStackEntry const& r) - : derived(r) - , Weak(r.Weak) - { - } - bool Weak; -}; - -struct cmStateDetail::BuildsystemDirectoryStateType -{ - cmStateDetail::PositionType DirectoryEnd; - - std::string Location; - std::string OutputLocation; - - // The top-most directories for relative path conversion. Both the - // source and destination location of a relative path conversion - // must be underneath one of these directories (both under source or - // both under binary) in order for the relative path to be evaluated - // safely by the build tools. - std::string RelativePathTopSource; - std::string RelativePathTopBinary; - - std::vector IncludeDirectories; - std::vector IncludeDirectoryBacktraces; - - std::vector CompileDefinitions; - std::vector CompileDefinitionsBacktraces; - - std::vector CompileOptions; - std::vector CompileOptionsBacktraces; - - std::vector NormalTargetNames; - - std::string ProjectName; - - cmPropertyMap Properties; - - std::vector Children; -}; - cmState::cmState() : IsInTryCompile(false) , WindowsShell(false) @@ -676,70 +598,6 @@ const char* cmState::GetBinaryDirectory() const return this->BinaryDirectory.c_str(); } -void cmStateDirectory::ComputeRelativePathTopSource() -{ - // Relative path conversion inside the source tree is not used to - // construct relative paths passed to build tools so it is safe to use - // even when the source is a network path. - - cmStateSnapshot snapshot = this->Snapshot_; - std::vector snapshots; - snapshots.push_back(snapshot); - while (true) { - snapshot = snapshot.GetBuildsystemDirectoryParent(); - if (snapshot.IsValid()) { - snapshots.push_back(snapshot); - } else { - break; - } - } - - std::string result = snapshots.front().GetDirectory().GetCurrentSource(); - - for (std::vector::const_iterator it = snapshots.begin() + 1; - it != snapshots.end(); ++it) { - std::string currentSource = it->GetDirectory().GetCurrentSource(); - if (cmSystemTools::IsSubDirectory(result, currentSource)) { - result = currentSource; - } - } - this->DirectoryState->RelativePathTopSource = result; -} - -void cmStateDirectory::ComputeRelativePathTopBinary() -{ - cmStateSnapshot snapshot = this->Snapshot_; - std::vector snapshots; - snapshots.push_back(snapshot); - while (true) { - snapshot = snapshot.GetBuildsystemDirectoryParent(); - if (snapshot.IsValid()) { - snapshots.push_back(snapshot); - } else { - break; - } - } - - std::string result = snapshots.front().GetDirectory().GetCurrentBinary(); - - for (std::vector::const_iterator it = snapshots.begin() + 1; - it != snapshots.end(); ++it) { - std::string currentBinary = it->GetDirectory().GetCurrentBinary(); - if (cmSystemTools::IsSubDirectory(result, currentBinary)) { - result = currentBinary; - } - } - - // The current working directory on Windows cannot be a network - // path. Therefore relative paths cannot work when the binary tree - // is a network path. - if (result.size() < 2 || result.substr(0, 2) != "//") { - this->DirectoryState->RelativePathTopBinary = result; - } else { - this->DirectoryState->RelativePathTopBinary = ""; - } -} - cmStateSnapshot cmState::CreateBaseSnapshot() { cmStateDetail::PositionType pos = @@ -923,854 +781,6 @@ cmStateSnapshot cmState::Pop(cmStateSnapshot originSnapshot) return cmStateSnapshot(this, prevPos); } -cmStateSnapshot::cmStateSnapshot(cmState* state) - : State(state) - , Position() -{ -} - -std::vector cmStateSnapshot::GetChildren() -{ - return this->Position->BuildSystemDirectory->Children; -} - -cmStateSnapshot::cmStateSnapshot(cmState* state, - cmStateDetail::PositionType position) - : State(state) - , Position(position) -{ -} - -cmStateEnums::SnapshotType cmStateSnapshot::GetType() const -{ - return this->Position->SnapshotType; -} - -const char* cmStateDirectory::GetCurrentSource() const -{ - return this->DirectoryState->Location.c_str(); -} - -void cmStateDirectory::SetCurrentSource(std::string const& dir) -{ - std::string& loc = this->DirectoryState->Location; - loc = dir; - cmSystemTools::ConvertToUnixSlashes(loc); - loc = cmSystemTools::CollapseFullPath(loc); - - this->ComputeRelativePathTopSource(); - - this->Snapshot_.SetDefinition("CMAKE_CURRENT_SOURCE_DIR", loc); -} - -const char* cmStateDirectory::GetCurrentBinary() const -{ - return this->DirectoryState->OutputLocation.c_str(); -} - -void cmStateDirectory::SetCurrentBinary(std::string const& dir) -{ - std::string& loc = this->DirectoryState->OutputLocation; - loc = dir; - cmSystemTools::ConvertToUnixSlashes(loc); - loc = cmSystemTools::CollapseFullPath(loc); - - this->ComputeRelativePathTopBinary(); - - this->Snapshot_.SetDefinition("CMAKE_CURRENT_BINARY_DIR", loc); -} - -void cmStateSnapshot::SetListFile(const std::string& listfile) -{ - *this->Position->ExecutionListFile = listfile; -} - -const char* cmStateDirectory::GetRelativePathTopSource() const -{ - return this->DirectoryState->RelativePathTopSource.c_str(); -} - -const char* cmStateDirectory::GetRelativePathTopBinary() const -{ - return this->DirectoryState->RelativePathTopBinary.c_str(); -} - -void cmStateDirectory::SetRelativePathTopSource(const char* dir) -{ - this->DirectoryState->RelativePathTopSource = dir; -} - -void cmStateDirectory::SetRelativePathTopBinary(const char* dir) -{ - this->DirectoryState->RelativePathTopBinary = dir; -} - -std::string cmStateSnapshot::GetExecutionListFile() const -{ - return *this->Position->ExecutionListFile; -} - -bool cmStateSnapshot::IsValid() const -{ - return this->State && this->Position.IsValid() - ? this->Position != this->State->SnapshotData.Root() - : false; -} - -cmStateSnapshot cmStateSnapshot::GetBuildsystemDirectoryParent() const -{ - cmStateSnapshot snapshot; - if (!this->State || this->Position == this->State->SnapshotData.Root()) { - return snapshot; - } - cmStateDetail::PositionType parentPos = this->Position->DirectoryParent; - if (parentPos != this->State->SnapshotData.Root()) { - snapshot = cmStateSnapshot(this->State, - parentPos->BuildSystemDirectory->DirectoryEnd); - } - - return snapshot; -} - -cmStateSnapshot cmStateSnapshot::GetCallStackParent() const -{ - assert(this->State); - assert(this->Position != this->State->SnapshotData.Root()); - - cmStateSnapshot snapshot; - cmStateDetail::PositionType parentPos = this->Position; - while (parentPos->SnapshotType == cmStateEnums::PolicyScopeType || - parentPos->SnapshotType == cmStateEnums::VariableScopeType) { - ++parentPos; - } - if (parentPos->SnapshotType == cmStateEnums::BuildsystemDirectoryType || - parentPos->SnapshotType == cmStateEnums::BaseType) { - return snapshot; - } - - ++parentPos; - while (parentPos->SnapshotType == cmStateEnums::PolicyScopeType || - parentPos->SnapshotType == cmStateEnums::VariableScopeType) { - ++parentPos; - } - - if (parentPos == this->State->SnapshotData.Root()) { - return snapshot; - } - - snapshot = cmStateSnapshot(this->State, parentPos); - return snapshot; -} - -cmStateSnapshot cmStateSnapshot::GetCallStackBottom() const -{ - assert(this->State); - assert(this->Position != this->State->SnapshotData.Root()); - - cmStateDetail::PositionType pos = this->Position; - while (pos->SnapshotType != cmStateEnums::BaseType && - pos->SnapshotType != cmStateEnums::BuildsystemDirectoryType && - pos != this->State->SnapshotData.Root()) { - ++pos; - } - return cmStateSnapshot(this->State, pos); -} - -void cmStateSnapshot::PushPolicy(cmPolicies::PolicyMap entry, bool weak) -{ - cmStateDetail::PositionType pos = this->Position; - pos->Policies = this->State->PolicyStack.Push( - pos->Policies, cmStateDetail::PolicyStackEntry(entry, weak)); -} - -bool cmStateSnapshot::PopPolicy() -{ - cmStateDetail::PositionType pos = this->Position; - if (pos->Policies == pos->PolicyScope) { - return false; - } - pos->Policies = this->State->PolicyStack.Pop(pos->Policies); - return true; -} - -bool cmStateSnapshot::CanPopPolicyScope() -{ - return this->Position->Policies == this->Position->PolicyScope; -} - -void cmStateSnapshot::SetPolicy(cmPolicies::PolicyID id, - cmPolicies::PolicyStatus status) -{ - // Update the policy stack from the top to the top-most strong entry. - bool previous_was_weak = true; - for (cmLinkedTree::iterator psi = - this->Position->Policies; - previous_was_weak && psi != this->Position->PolicyRoot; ++psi) { - psi->Set(id, status); - previous_was_weak = psi->Weak; - } -} - -cmPolicies::PolicyStatus cmStateSnapshot::GetPolicy( - cmPolicies::PolicyID id) const -{ - cmPolicies::PolicyStatus status = cmPolicies::GetPolicyStatus(id); - - if (status == cmPolicies::REQUIRED_ALWAYS || - status == cmPolicies::REQUIRED_IF_USED) { - return status; - } - - cmLinkedTree::iterator dir = - this->Position->BuildSystemDirectory; - - while (true) { - assert(dir.IsValid()); - cmLinkedTree::iterator leaf = - dir->DirectoryEnd->Policies; - cmLinkedTree::iterator root = - dir->DirectoryEnd->PolicyRoot; - for (; leaf != root; ++leaf) { - if (leaf->IsDefined(id)) { - status = leaf->Get(id); - return status; - } - } - cmStateDetail::PositionType e = dir->DirectoryEnd; - cmStateDetail::PositionType p = e->DirectoryParent; - if (p == this->State->SnapshotData.Root()) { - break; - } - dir = p->BuildSystemDirectory; - } - return status; -} - -bool cmStateSnapshot::HasDefinedPolicyCMP0011() -{ - return !this->Position->Policies->IsEmpty(); -} - -const char* cmStateSnapshot::GetDefinition(std::string const& name) const -{ - assert(this->Position->Vars.IsValid()); - return cmDefinitions::Get(name, this->Position->Vars, this->Position->Root); -} - -bool cmStateSnapshot::IsInitialized(std::string const& name) const -{ - return cmDefinitions::HasKey(name, this->Position->Vars, - this->Position->Root); -} - -void cmStateSnapshot::SetDefinition(std::string const& name, - std::string const& value) -{ - this->Position->Vars->Set(name, value.c_str()); -} - -void cmStateSnapshot::RemoveDefinition(std::string const& name) -{ - this->Position->Vars->Set(name, CM_NULLPTR); -} - -std::vector cmStateSnapshot::UnusedKeys() const -{ - return this->Position->Vars->UnusedKeys(); -} - -std::vector cmStateSnapshot::ClosureKeys() const -{ - return cmDefinitions::ClosureKeys(this->Position->Vars, - this->Position->Root); -} - -bool cmStateSnapshot::RaiseScope(std::string const& var, const char* varDef) -{ - if (this->Position->ScopeParent == this->Position->DirectoryParent) { - cmStateSnapshot parentDir = this->GetBuildsystemDirectoryParent(); - if (!parentDir.IsValid()) { - return false; - } - // Update the definition in the parent directory top scope. This - // directory's scope was initialized by the closure of the parent - // scope, so we do not need to localize the definition first. - if (varDef) { - parentDir.SetDefinition(var, varDef); - } else { - parentDir.RemoveDefinition(var); - } - return true; - } - // First localize the definition in the current scope. - cmDefinitions::Raise(var, this->Position->Vars, this->Position->Root); - - // Now update the definition in the parent scope. - this->Position->Parent->Set(var, varDef); - return true; -} - -static const std::string cmPropertySentinal = std::string(); - -template -void InitializeContentFromParent(T& parentContent, T& thisContent, - U& parentBacktraces, U& thisBacktraces, - V& contentEndPosition) -{ - std::vector::const_iterator parentBegin = parentContent.begin(); - std::vector::const_iterator parentEnd = parentContent.end(); - - std::vector::const_reverse_iterator parentRbegin = - cmMakeReverseIterator(parentEnd); - std::vector::const_reverse_iterator parentRend = - parentContent.rend(); - parentRbegin = std::find(parentRbegin, parentRend, cmPropertySentinal); - std::vector::const_iterator parentIt = parentRbegin.base(); - - thisContent = std::vector(parentIt, parentEnd); - - std::vector::const_iterator btIt = - parentBacktraces.begin() + std::distance(parentBegin, parentIt); - std::vector::const_iterator btEnd = - parentBacktraces.end(); - - thisBacktraces = std::vector(btIt, btEnd); - - contentEndPosition = thisContent.size(); -} - -void cmStateSnapshot::SetDefaultDefinitions() -{ -/* Up to CMake 2.4 here only WIN32, UNIX and APPLE were set. - With CMake must separate between target and host platform. In most cases - the tests for WIN32, UNIX and APPLE will be for the target system, so an - additional set of variables for the host system is required -> - CMAKE_HOST_WIN32, CMAKE_HOST_UNIX, CMAKE_HOST_APPLE. - WIN32, UNIX and APPLE are now set in the platform files in - Modules/Platforms/. - To keep cmake scripts (-P) and custom language and compiler modules - working, these variables are still also set here in this place, but they - will be reset in CMakeSystemSpecificInformation.cmake before the platform - files are executed. */ -#if defined(_WIN32) - this->SetDefinition("WIN32", "1"); - this->SetDefinition("CMAKE_HOST_WIN32", "1"); -#else - this->SetDefinition("UNIX", "1"); - this->SetDefinition("CMAKE_HOST_UNIX", "1"); -#endif -#if defined(__CYGWIN__) - std::string legacy; - if (cmSystemTools::GetEnv("CMAKE_LEGACY_CYGWIN_WIN32", legacy) && - cmSystemTools::IsOn(legacy.c_str())) { - this->SetDefinition("WIN32", "1"); - this->SetDefinition("CMAKE_HOST_WIN32", "1"); - } -#endif -#if defined(__APPLE__) - this->SetDefinition("APPLE", "1"); - this->SetDefinition("CMAKE_HOST_APPLE", "1"); -#endif -#if defined(__sun__) - this->SetDefinition("CMAKE_HOST_SOLARIS", "1"); -#endif - - char temp[1024]; - sprintf(temp, "%d", cmVersion::GetMinorVersion()); - this->SetDefinition("CMAKE_MINOR_VERSION", temp); - sprintf(temp, "%d", cmVersion::GetMajorVersion()); - this->SetDefinition("CMAKE_MAJOR_VERSION", temp); - sprintf(temp, "%d", cmVersion::GetPatchVersion()); - this->SetDefinition("CMAKE_PATCH_VERSION", temp); - sprintf(temp, "%d", cmVersion::GetTweakVersion()); - this->SetDefinition("CMAKE_TWEAK_VERSION", temp); - this->SetDefinition("CMAKE_VERSION", cmVersion::GetCMakeVersion()); - - this->SetDefinition("CMAKE_FILES_DIRECTORY", - cmake::GetCMakeFilesDirectory()); - - // Setup the default include file regular expression (match everything). - this->Position->BuildSystemDirectory->Properties.SetProperty( - "INCLUDE_REGULAR_EXPRESSION", "^.*$"); -} - -void cmStateSnapshot::SetDirectoryDefinitions() -{ - this->SetDefinition("CMAKE_SOURCE_DIR", this->State->GetSourceDirectory()); - this->SetDefinition("CMAKE_CURRENT_SOURCE_DIR", - this->State->GetSourceDirectory()); - this->SetDefinition("CMAKE_BINARY_DIR", this->State->GetBinaryDirectory()); - this->SetDefinition("CMAKE_CURRENT_BINARY_DIR", - this->State->GetBinaryDirectory()); -} - -void cmStateSnapshot::InitializeFromParent() -{ - cmStateDetail::PositionType parent = this->Position->DirectoryParent; - assert(this->Position->Vars.IsValid()); - assert(parent->Vars.IsValid()); - - *this->Position->Vars = - cmDefinitions::MakeClosure(parent->Vars, parent->Root); - - InitializeContentFromParent( - parent->BuildSystemDirectory->IncludeDirectories, - this->Position->BuildSystemDirectory->IncludeDirectories, - parent->BuildSystemDirectory->IncludeDirectoryBacktraces, - this->Position->BuildSystemDirectory->IncludeDirectoryBacktraces, - this->Position->IncludeDirectoryPosition); - - InitializeContentFromParent( - parent->BuildSystemDirectory->CompileDefinitions, - this->Position->BuildSystemDirectory->CompileDefinitions, - parent->BuildSystemDirectory->CompileDefinitionsBacktraces, - this->Position->BuildSystemDirectory->CompileDefinitionsBacktraces, - this->Position->CompileDefinitionsPosition); - - InitializeContentFromParent( - parent->BuildSystemDirectory->CompileOptions, - this->Position->BuildSystemDirectory->CompileOptions, - parent->BuildSystemDirectory->CompileOptionsBacktraces, - this->Position->BuildSystemDirectory->CompileOptionsBacktraces, - this->Position->CompileOptionsPosition); -} - -cmState* cmStateSnapshot::GetState() const -{ - return this->State; -} - -cmStateDirectory cmStateSnapshot::GetDirectory() const -{ - return cmStateDirectory(this->Position->BuildSystemDirectory, *this); -} - -void cmStateSnapshot::SetProjectName(const std::string& name) -{ - this->Position->BuildSystemDirectory->ProjectName = name; -} - -std::string cmStateSnapshot::GetProjectName() const -{ - return this->Position->BuildSystemDirectory->ProjectName; -} - -void cmStateSnapshot::InitializeFromParent_ForSubdirsCommand() -{ - std::string currentSrcDir = this->GetDefinition("CMAKE_CURRENT_SOURCE_DIR"); - std::string currentBinDir = this->GetDefinition("CMAKE_CURRENT_BINARY_DIR"); - this->InitializeFromParent(); - this->SetDefinition("CMAKE_SOURCE_DIR", this->State->GetSourceDirectory()); - this->SetDefinition("CMAKE_BINARY_DIR", this->State->GetBinaryDirectory()); - - this->SetDefinition("CMAKE_CURRENT_SOURCE_DIR", currentSrcDir); - this->SetDefinition("CMAKE_CURRENT_BINARY_DIR", currentBinDir); -} - -cmStateDirectory::cmStateDirectory( - cmLinkedTree::iterator iter, - const cmStateSnapshot& snapshot) - : DirectoryState(iter) - , Snapshot_(snapshot) -{ -} - -template -cmStringRange GetPropertyContent(T const& content, U contentEndPosition) -{ - std::vector::const_iterator end = - content.begin() + contentEndPosition; - - std::vector::const_reverse_iterator rbegin = - cmMakeReverseIterator(end); - rbegin = std::find(rbegin, content.rend(), cmPropertySentinal); - - return cmMakeRange(rbegin.base(), end); -} - -template -cmBacktraceRange GetPropertyBacktraces(T const& content, U const& backtraces, - V contentEndPosition) -{ - std::vector::const_iterator entryEnd = - content.begin() + contentEndPosition; - - std::vector::const_reverse_iterator rbegin = - cmMakeReverseIterator(entryEnd); - rbegin = std::find(rbegin, content.rend(), cmPropertySentinal); - - std::vector::const_iterator it = - backtraces.begin() + std::distance(content.begin(), rbegin.base()); - - std::vector::const_iterator end = backtraces.end(); - return cmMakeRange(it, end); -} - -template -void AppendEntry(T& content, U& backtraces, V& endContentPosition, - const std::string& value, const cmListFileBacktrace& lfbt) -{ - if (value.empty()) { - return; - } - - assert(endContentPosition == content.size()); - - content.push_back(value); - backtraces.push_back(lfbt); - - endContentPosition = content.size(); -} - -template -void SetContent(T& content, U& backtraces, V& endContentPosition, - const std::string& vec, const cmListFileBacktrace& lfbt) -{ - assert(endContentPosition == content.size()); - - content.resize(content.size() + 2); - backtraces.resize(backtraces.size() + 2); - - content.back() = vec; - backtraces.back() = lfbt; - - endContentPosition = content.size(); -} - -template -void ClearContent(T& content, U& backtraces, V& endContentPosition) -{ - assert(endContentPosition == content.size()); - - content.resize(content.size() + 1); - backtraces.resize(backtraces.size() + 1); - - endContentPosition = content.size(); -} - -cmStringRange cmStateDirectory::GetIncludeDirectoriesEntries() const -{ - return GetPropertyContent( - this->DirectoryState->IncludeDirectories, - this->Snapshot_.Position->IncludeDirectoryPosition); -} - -cmBacktraceRange cmStateDirectory::GetIncludeDirectoriesEntryBacktraces() const -{ - return GetPropertyBacktraces( - this->DirectoryState->IncludeDirectories, - this->DirectoryState->IncludeDirectoryBacktraces, - this->Snapshot_.Position->IncludeDirectoryPosition); -} - -void cmStateDirectory::AppendIncludeDirectoriesEntry( - const std::string& vec, const cmListFileBacktrace& lfbt) -{ - AppendEntry(this->DirectoryState->IncludeDirectories, - this->DirectoryState->IncludeDirectoryBacktraces, - this->Snapshot_.Position->IncludeDirectoryPosition, vec, lfbt); -} - -void cmStateDirectory::PrependIncludeDirectoriesEntry( - const std::string& vec, const cmListFileBacktrace& lfbt) -{ - std::vector::iterator entryEnd = - this->DirectoryState->IncludeDirectories.begin() + - this->Snapshot_.Position->IncludeDirectoryPosition; - - std::vector::reverse_iterator rend = - this->DirectoryState->IncludeDirectories.rend(); - std::vector::reverse_iterator rbegin = - cmMakeReverseIterator(entryEnd); - rbegin = std::find(rbegin, rend, cmPropertySentinal); - - std::vector::iterator entryIt = rbegin.base(); - std::vector::iterator entryBegin = - this->DirectoryState->IncludeDirectories.begin(); - - std::vector::iterator btIt = - this->DirectoryState->IncludeDirectoryBacktraces.begin() + - std::distance(entryBegin, entryIt); - - this->DirectoryState->IncludeDirectories.insert(entryIt, vec); - this->DirectoryState->IncludeDirectoryBacktraces.insert(btIt, lfbt); - - this->Snapshot_.Position->IncludeDirectoryPosition = - this->DirectoryState->IncludeDirectories.size(); -} - -void cmStateDirectory::SetIncludeDirectories(const std::string& vec, - const cmListFileBacktrace& lfbt) -{ - SetContent(this->DirectoryState->IncludeDirectories, - this->DirectoryState->IncludeDirectoryBacktraces, - this->Snapshot_.Position->IncludeDirectoryPosition, vec, lfbt); -} - -void cmStateDirectory::ClearIncludeDirectories() -{ - ClearContent(this->DirectoryState->IncludeDirectories, - this->DirectoryState->IncludeDirectoryBacktraces, - this->Snapshot_.Position->IncludeDirectoryPosition); -} - -cmStringRange cmStateDirectory::GetCompileDefinitionsEntries() const -{ - return GetPropertyContent( - this->DirectoryState->CompileDefinitions, - this->Snapshot_.Position->CompileDefinitionsPosition); -} - -cmBacktraceRange cmStateDirectory::GetCompileDefinitionsEntryBacktraces() const -{ - return GetPropertyBacktraces( - this->DirectoryState->CompileDefinitions, - this->DirectoryState->CompileDefinitionsBacktraces, - this->Snapshot_.Position->CompileDefinitionsPosition); -} - -void cmStateDirectory::AppendCompileDefinitionsEntry( - const std::string& vec, const cmListFileBacktrace& lfbt) -{ - AppendEntry(this->DirectoryState->CompileDefinitions, - this->DirectoryState->CompileDefinitionsBacktraces, - this->Snapshot_.Position->CompileDefinitionsPosition, vec, lfbt); -} - -void cmStateDirectory::SetCompileDefinitions(const std::string& vec, - const cmListFileBacktrace& lfbt) -{ - SetContent(this->DirectoryState->CompileDefinitions, - this->DirectoryState->CompileDefinitionsBacktraces, - this->Snapshot_.Position->CompileDefinitionsPosition, vec, lfbt); -} - -void cmStateDirectory::ClearCompileDefinitions() -{ - ClearContent(this->DirectoryState->CompileDefinitions, - this->DirectoryState->CompileDefinitionsBacktraces, - this->Snapshot_.Position->CompileDefinitionsPosition); -} - -cmStringRange cmStateDirectory::GetCompileOptionsEntries() const -{ - return GetPropertyContent(this->DirectoryState->CompileOptions, - this->Snapshot_.Position->CompileOptionsPosition); -} - -cmBacktraceRange cmStateDirectory::GetCompileOptionsEntryBacktraces() const -{ - return GetPropertyBacktraces( - this->DirectoryState->CompileOptions, - this->DirectoryState->CompileOptionsBacktraces, - this->Snapshot_.Position->CompileOptionsPosition); -} - -void cmStateDirectory::AppendCompileOptionsEntry( - const std::string& vec, const cmListFileBacktrace& lfbt) -{ - AppendEntry(this->DirectoryState->CompileOptions, - this->DirectoryState->CompileOptionsBacktraces, - this->Snapshot_.Position->CompileOptionsPosition, vec, lfbt); -} - -void cmStateDirectory::SetCompileOptions(const std::string& vec, - const cmListFileBacktrace& lfbt) -{ - SetContent(this->DirectoryState->CompileOptions, - this->DirectoryState->CompileOptionsBacktraces, - this->Snapshot_.Position->CompileOptionsPosition, vec, lfbt); -} - -void cmStateDirectory::ClearCompileOptions() -{ - ClearContent(this->DirectoryState->CompileOptions, - this->DirectoryState->CompileOptionsBacktraces, - this->Snapshot_.Position->CompileOptionsPosition); -} - -bool cmStateSnapshot::StrictWeakOrder::operator()( - const cmStateSnapshot& lhs, const cmStateSnapshot& rhs) const -{ - return lhs.Position.StrictWeakOrdered(rhs.Position); -} - -void cmStateDirectory::SetProperty(const std::string& prop, const char* value, - cmListFileBacktrace const& lfbt) -{ - if (prop == "INCLUDE_DIRECTORIES") { - if (!value) { - this->ClearIncludeDirectories(); - return; - } - this->SetIncludeDirectories(value, lfbt); - return; - } - if (prop == "COMPILE_OPTIONS") { - if (!value) { - this->ClearCompileOptions(); - return; - } - this->SetCompileOptions(value, lfbt); - return; - } - if (prop == "COMPILE_DEFINITIONS") { - if (!value) { - this->ClearCompileDefinitions(); - return; - } - this->SetCompileDefinitions(value, lfbt); - return; - } - - this->DirectoryState->Properties.SetProperty(prop, value); -} - -void cmStateDirectory::AppendProperty(const std::string& prop, - const char* value, bool asString, - cmListFileBacktrace const& lfbt) -{ - if (prop == "INCLUDE_DIRECTORIES") { - this->AppendIncludeDirectoriesEntry(value, lfbt); - return; - } - if (prop == "COMPILE_OPTIONS") { - this->AppendCompileOptionsEntry(value, lfbt); - return; - } - if (prop == "COMPILE_DEFINITIONS") { - this->AppendCompileDefinitionsEntry(value, lfbt); - return; - } - - this->DirectoryState->Properties.AppendProperty(prop, value, asString); -} - -const char* cmStateDirectory::GetProperty(const std::string& prop) const -{ - const bool chain = - this->Snapshot_.State->IsPropertyChained(prop, cmProperty::DIRECTORY); - return this->GetProperty(prop, chain); -} - -const char* cmStateDirectory::GetProperty(const std::string& prop, - bool chain) const -{ - static std::string output; - output = ""; - if (prop == "PARENT_DIRECTORY") { - cmStateSnapshot parent = this->Snapshot_.GetBuildsystemDirectoryParent(); - if (parent.IsValid()) { - return parent.GetDirectory().GetCurrentSource(); - } - return ""; - } - if (prop == kBINARY_DIR) { - output = this->GetCurrentBinary(); - return output.c_str(); - } - if (prop == kSOURCE_DIR) { - output = this->GetCurrentSource(); - return output.c_str(); - } - if (prop == kSUBDIRECTORIES) { - std::vector child_dirs; - std::vector const& children = - this->DirectoryState->Children; - for (std::vector::const_iterator ci = children.begin(); - ci != children.end(); ++ci) { - child_dirs.push_back(ci->GetDirectory().GetCurrentSource()); - } - output = cmJoin(child_dirs, ";"); - return output.c_str(); - } - if (prop == kBUILDSYSTEM_TARGETS) { - output = cmJoin(this->DirectoryState->NormalTargetNames, ";"); - return output.c_str(); - } - - if (prop == "LISTFILE_STACK") { - std::vector listFiles; - cmStateSnapshot snp = this->Snapshot_; - while (snp.IsValid()) { - listFiles.push_back(snp.GetExecutionListFile()); - snp = snp.GetCallStackParent(); - } - std::reverse(listFiles.begin(), listFiles.end()); - output = cmJoin(listFiles, ";"); - return output.c_str(); - } - if (prop == "CACHE_VARIABLES") { - output = cmJoin(this->Snapshot_.State->GetCacheEntryKeys(), ";"); - return output.c_str(); - } - if (prop == "VARIABLES") { - std::vector res = this->Snapshot_.ClosureKeys(); - std::vector cacheKeys = - this->Snapshot_.State->GetCacheEntryKeys(); - res.insert(res.end(), cacheKeys.begin(), cacheKeys.end()); - std::sort(res.begin(), res.end()); - output = cmJoin(res, ";"); - return output.c_str(); - } - if (prop == "INCLUDE_DIRECTORIES") { - output = cmJoin(this->GetIncludeDirectoriesEntries(), ";"); - return output.c_str(); - } - if (prop == "COMPILE_OPTIONS") { - output = cmJoin(this->GetCompileOptionsEntries(), ";"); - return output.c_str(); - } - if (prop == "COMPILE_DEFINITIONS") { - output = cmJoin(this->GetCompileDefinitionsEntries(), ";"); - return output.c_str(); - } - - const char* retVal = this->DirectoryState->Properties.GetPropertyValue(prop); - if (!retVal && chain) { - cmStateSnapshot parentSnapshot = - this->Snapshot_.GetBuildsystemDirectoryParent(); - if (parentSnapshot.IsValid()) { - return parentSnapshot.GetDirectory().GetProperty(prop, chain); - } - return this->Snapshot_.State->GetGlobalProperty(prop); - } - - return retVal; -} - -bool cmStateDirectory::GetPropertyAsBool(const std::string& prop) const -{ - return cmSystemTools::IsOn(this->GetProperty(prop)); -} - -std::vector cmStateDirectory::GetPropertyKeys() const -{ - std::vector keys; - keys.reserve(this->DirectoryState->Properties.size()); - for (cmPropertyMap::const_iterator it = - this->DirectoryState->Properties.begin(); - it != this->DirectoryState->Properties.end(); ++it) { - keys.push_back(it->first); - } - return keys; -} - -void cmStateDirectory::AddNormalTargetName(std::string const& name) -{ - this->DirectoryState->NormalTargetNames.push_back(name); -} - -bool operator==(const cmStateSnapshot& lhs, const cmStateSnapshot& rhs) -{ - return lhs.Position == rhs.Position; -} - -bool operator!=(const cmStateSnapshot& lhs, const cmStateSnapshot& rhs) -{ - return lhs.Position != rhs.Position; -} - static bool ParseEntryWithoutType(const std::string& entry, std::string& var, std::string& value) { diff --git a/Source/cmState.h b/Source/cmState.h index 938c90b..6d74815 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -8,7 +8,6 @@ #include "cmAlgorithms.h" #include "cmDefinitions.h" #include "cmLinkedTree.h" -#include "cmPolicies.h" #include "cmProperty.h" #include "cmPropertyDefinitionMap.h" #include "cmPropertyMap.h" @@ -186,138 +185,4 @@ private: bool MSYSShell; }; -class cmStateSnapshot -{ -public: - cmStateSnapshot(cmState* state = CM_NULLPTR); - cmStateSnapshot(cmState* state, cmStateDetail::PositionType position); - - const char* GetDefinition(std::string const& name) const; - bool IsInitialized(std::string const& name) const; - void SetDefinition(std::string const& name, std::string const& value); - void RemoveDefinition(std::string const& name); - std::vector UnusedKeys() const; - std::vector ClosureKeys() const; - bool RaiseScope(std::string const& var, const char* varDef); - - void SetListFile(std::string const& listfile); - - std::string GetExecutionListFile() const; - - std::vector GetChildren(); - - bool IsValid() const; - cmStateSnapshot GetBuildsystemDirectoryParent() const; - cmStateSnapshot GetCallStackParent() const; - cmStateSnapshot GetCallStackBottom() const; - cmStateEnums::SnapshotType GetType() const; - - void SetPolicy(cmPolicies::PolicyID id, cmPolicies::PolicyStatus status); - cmPolicies::PolicyStatus GetPolicy(cmPolicies::PolicyID id) const; - bool HasDefinedPolicyCMP0011(); - void PushPolicy(cmPolicies::PolicyMap entry, bool weak); - bool PopPolicy(); - bool CanPopPolicyScope(); - - cmState* GetState() const; - - cmStateDirectory GetDirectory() const; - - void SetProjectName(std::string const& name); - std::string GetProjectName() const; - - void InitializeFromParent_ForSubdirsCommand(); - - struct StrictWeakOrder - { - bool operator()(const cmStateSnapshot& lhs, - const cmStateSnapshot& rhs) const; - }; - - void SetDirectoryDefinitions(); - void SetDefaultDefinitions(); - -private: - friend bool operator==(const cmStateSnapshot& lhs, - const cmStateSnapshot& rhs); - friend bool operator!=(const cmStateSnapshot& lhs, - const cmStateSnapshot& rhs); - friend class cmState; - friend class cmStateDirectory; - friend struct StrictWeakOrder; - - void InitializeFromParent(); - - cmState* State; - cmStateDetail::PositionType Position; -}; - -class cmStateDirectory -{ - cmStateDirectory( - cmLinkedTree::iterator iter, - cmStateSnapshot const& snapshot); - -public: - const char* GetCurrentSource() const; - void SetCurrentSource(std::string const& dir); - const char* GetCurrentBinary() const; - void SetCurrentBinary(std::string const& dir); - - const char* GetRelativePathTopSource() const; - const char* GetRelativePathTopBinary() const; - void SetRelativePathTopSource(const char* dir); - void SetRelativePathTopBinary(const char* dir); - - cmStringRange GetIncludeDirectoriesEntries() const; - cmBacktraceRange GetIncludeDirectoriesEntryBacktraces() const; - void AppendIncludeDirectoriesEntry(std::string const& vec, - cmListFileBacktrace const& lfbt); - void PrependIncludeDirectoriesEntry(std::string const& vec, - cmListFileBacktrace const& lfbt); - void SetIncludeDirectories(std::string const& vec, - cmListFileBacktrace const& lfbt); - void ClearIncludeDirectories(); - - cmStringRange GetCompileDefinitionsEntries() const; - cmBacktraceRange GetCompileDefinitionsEntryBacktraces() const; - void AppendCompileDefinitionsEntry(std::string const& vec, - cmListFileBacktrace const& lfbt); - void SetCompileDefinitions(std::string const& vec, - cmListFileBacktrace const& lfbt); - void ClearCompileDefinitions(); - - cmStringRange GetCompileOptionsEntries() const; - cmBacktraceRange GetCompileOptionsEntryBacktraces() const; - void AppendCompileOptionsEntry(std::string const& vec, - cmListFileBacktrace const& lfbt); - void SetCompileOptions(std::string const& vec, - cmListFileBacktrace const& lfbt); - void ClearCompileOptions(); - - void SetProperty(const std::string& prop, const char* value, - cmListFileBacktrace const& lfbt); - void AppendProperty(const std::string& prop, const char* value, - bool asString, cmListFileBacktrace const& lfbt); - const char* GetProperty(const std::string& prop) const; - const char* GetProperty(const std::string& prop, bool chain) const; - bool GetPropertyAsBool(const std::string& prop) const; - std::vector GetPropertyKeys() const; - - void AddNormalTargetName(std::string const& name); - -private: - void ComputeRelativePathTopSource(); - void ComputeRelativePathTopBinary(); - -private: - cmLinkedTree::iterator - DirectoryState; - cmStateSnapshot Snapshot_; - friend class cmStateSnapshot; -}; - -bool operator==(const cmStateSnapshot& lhs, const cmStateSnapshot& rhs); -bool operator!=(const cmStateSnapshot& lhs, const cmStateSnapshot& rhs); - #endif diff --git a/Source/cmStateDirectory.cxx b/Source/cmStateDirectory.cxx new file mode 100644 index 0000000..01e1e7e --- /dev/null +++ b/Source/cmStateDirectory.cxx @@ -0,0 +1,518 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ + +#include "cmStateDirectory.h" +#include "cmState.h" +#include "cmStatePrivate.h" +#include "cmSystemTools.h" + +static std::string const kBINARY_DIR = "BINARY_DIR"; +static std::string const kBUILDSYSTEM_TARGETS = "BUILDSYSTEM_TARGETS"; +static std::string const kSOURCE_DIR = "SOURCE_DIR"; +static std::string const kSUBDIRECTORIES = "SUBDIRECTORIES"; + +void cmStateDirectory::ComputeRelativePathTopSource() +{ + // Relative path conversion inside the source tree is not used to + // construct relative paths passed to build tools so it is safe to use + // even when the source is a network path. + + cmStateSnapshot snapshot = this->Snapshot_; + std::vector snapshots; + snapshots.push_back(snapshot); + while (true) { + snapshot = snapshot.GetBuildsystemDirectoryParent(); + if (snapshot.IsValid()) { + snapshots.push_back(snapshot); + } else { + break; + } + } + + std::string result = snapshots.front().GetDirectory().GetCurrentSource(); + + for (std::vector::const_iterator it = snapshots.begin() + 1; + it != snapshots.end(); ++it) { + std::string currentSource = it->GetDirectory().GetCurrentSource(); + if (cmSystemTools::IsSubDirectory(result, currentSource)) { + result = currentSource; + } + } + this->DirectoryState->RelativePathTopSource = result; +} + +void cmStateDirectory::ComputeRelativePathTopBinary() +{ + cmStateSnapshot snapshot = this->Snapshot_; + std::vector snapshots; + snapshots.push_back(snapshot); + while (true) { + snapshot = snapshot.GetBuildsystemDirectoryParent(); + if (snapshot.IsValid()) { + snapshots.push_back(snapshot); + } else { + break; + } + } + + std::string result = snapshots.front().GetDirectory().GetCurrentBinary(); + + for (std::vector::const_iterator it = snapshots.begin() + 1; + it != snapshots.end(); ++it) { + std::string currentBinary = it->GetDirectory().GetCurrentBinary(); + if (cmSystemTools::IsSubDirectory(result, currentBinary)) { + result = currentBinary; + } + } + + // The current working directory on Windows cannot be a network + // path. Therefore relative paths cannot work when the binary tree + // is a network path. + if (result.size() < 2 || result.substr(0, 2) != "//") { + this->DirectoryState->RelativePathTopBinary = result; + } else { + this->DirectoryState->RelativePathTopBinary = ""; + } +} + +const char* cmStateDirectory::GetCurrentSource() const +{ + return this->DirectoryState->Location.c_str(); +} + +void cmStateDirectory::SetCurrentSource(std::string const& dir) +{ + std::string& loc = this->DirectoryState->Location; + loc = dir; + cmSystemTools::ConvertToUnixSlashes(loc); + loc = cmSystemTools::CollapseFullPath(loc); + + this->ComputeRelativePathTopSource(); + + this->Snapshot_.SetDefinition("CMAKE_CURRENT_SOURCE_DIR", loc); +} + +const char* cmStateDirectory::GetCurrentBinary() const +{ + return this->DirectoryState->OutputLocation.c_str(); +} + +void cmStateDirectory::SetCurrentBinary(std::string const& dir) +{ + std::string& loc = this->DirectoryState->OutputLocation; + loc = dir; + cmSystemTools::ConvertToUnixSlashes(loc); + loc = cmSystemTools::CollapseFullPath(loc); + + this->ComputeRelativePathTopBinary(); + + this->Snapshot_.SetDefinition("CMAKE_CURRENT_BINARY_DIR", loc); +} + +const char* cmStateDirectory::GetRelativePathTopSource() const +{ + return this->DirectoryState->RelativePathTopSource.c_str(); +} + +const char* cmStateDirectory::GetRelativePathTopBinary() const +{ + return this->DirectoryState->RelativePathTopBinary.c_str(); +} + +void cmStateDirectory::SetRelativePathTopSource(const char* dir) +{ + this->DirectoryState->RelativePathTopSource = dir; +} + +void cmStateDirectory::SetRelativePathTopBinary(const char* dir) +{ + this->DirectoryState->RelativePathTopBinary = dir; +} + +cmStateDirectory::cmStateDirectory( + cmLinkedTree::iterator iter, + const cmStateSnapshot& snapshot) + : DirectoryState(iter) + , Snapshot_(snapshot) +{ +} + +template +cmStringRange GetPropertyContent(T const& content, U contentEndPosition) +{ + std::vector::const_iterator end = + content.begin() + contentEndPosition; + + std::vector::const_reverse_iterator rbegin = + cmMakeReverseIterator(end); + rbegin = std::find(rbegin, content.rend(), cmPropertySentinal); + + return cmMakeRange(rbegin.base(), end); +} + +template +cmBacktraceRange GetPropertyBacktraces(T const& content, U const& backtraces, + V contentEndPosition) +{ + std::vector::const_iterator entryEnd = + content.begin() + contentEndPosition; + + std::vector::const_reverse_iterator rbegin = + cmMakeReverseIterator(entryEnd); + rbegin = std::find(rbegin, content.rend(), cmPropertySentinal); + + std::vector::const_iterator it = + backtraces.begin() + std::distance(content.begin(), rbegin.base()); + + std::vector::const_iterator end = backtraces.end(); + return cmMakeRange(it, end); +} + +template +void AppendEntry(T& content, U& backtraces, V& endContentPosition, + const std::string& value, const cmListFileBacktrace& lfbt) +{ + if (value.empty()) { + return; + } + + assert(endContentPosition == content.size()); + + content.push_back(value); + backtraces.push_back(lfbt); + + endContentPosition = content.size(); +} + +template +void SetContent(T& content, U& backtraces, V& endContentPosition, + const std::string& vec, const cmListFileBacktrace& lfbt) +{ + assert(endContentPosition == content.size()); + + content.resize(content.size() + 2); + backtraces.resize(backtraces.size() + 2); + + content.back() = vec; + backtraces.back() = lfbt; + + endContentPosition = content.size(); +} + +template +void ClearContent(T& content, U& backtraces, V& endContentPosition) +{ + assert(endContentPosition == content.size()); + + content.resize(content.size() + 1); + backtraces.resize(backtraces.size() + 1); + + endContentPosition = content.size(); +} + +cmStringRange cmStateDirectory::GetIncludeDirectoriesEntries() const +{ + return GetPropertyContent( + this->DirectoryState->IncludeDirectories, + this->Snapshot_.Position->IncludeDirectoryPosition); +} + +cmBacktraceRange cmStateDirectory::GetIncludeDirectoriesEntryBacktraces() const +{ + return GetPropertyBacktraces( + this->DirectoryState->IncludeDirectories, + this->DirectoryState->IncludeDirectoryBacktraces, + this->Snapshot_.Position->IncludeDirectoryPosition); +} + +void cmStateDirectory::AppendIncludeDirectoriesEntry( + const std::string& vec, const cmListFileBacktrace& lfbt) +{ + AppendEntry(this->DirectoryState->IncludeDirectories, + this->DirectoryState->IncludeDirectoryBacktraces, + this->Snapshot_.Position->IncludeDirectoryPosition, vec, lfbt); +} + +void cmStateDirectory::PrependIncludeDirectoriesEntry( + const std::string& vec, const cmListFileBacktrace& lfbt) +{ + std::vector::iterator entryEnd = + this->DirectoryState->IncludeDirectories.begin() + + this->Snapshot_.Position->IncludeDirectoryPosition; + + std::vector::reverse_iterator rend = + this->DirectoryState->IncludeDirectories.rend(); + std::vector::reverse_iterator rbegin = + cmMakeReverseIterator(entryEnd); + rbegin = std::find(rbegin, rend, cmPropertySentinal); + + std::vector::iterator entryIt = rbegin.base(); + std::vector::iterator entryBegin = + this->DirectoryState->IncludeDirectories.begin(); + + std::vector::iterator btIt = + this->DirectoryState->IncludeDirectoryBacktraces.begin() + + std::distance(entryBegin, entryIt); + + this->DirectoryState->IncludeDirectories.insert(entryIt, vec); + this->DirectoryState->IncludeDirectoryBacktraces.insert(btIt, lfbt); + + this->Snapshot_.Position->IncludeDirectoryPosition = + this->DirectoryState->IncludeDirectories.size(); +} + +void cmStateDirectory::SetIncludeDirectories(const std::string& vec, + const cmListFileBacktrace& lfbt) +{ + SetContent(this->DirectoryState->IncludeDirectories, + this->DirectoryState->IncludeDirectoryBacktraces, + this->Snapshot_.Position->IncludeDirectoryPosition, vec, lfbt); +} + +void cmStateDirectory::ClearIncludeDirectories() +{ + ClearContent(this->DirectoryState->IncludeDirectories, + this->DirectoryState->IncludeDirectoryBacktraces, + this->Snapshot_.Position->IncludeDirectoryPosition); +} + +cmStringRange cmStateDirectory::GetCompileDefinitionsEntries() const +{ + return GetPropertyContent( + this->DirectoryState->CompileDefinitions, + this->Snapshot_.Position->CompileDefinitionsPosition); +} + +cmBacktraceRange cmStateDirectory::GetCompileDefinitionsEntryBacktraces() const +{ + return GetPropertyBacktraces( + this->DirectoryState->CompileDefinitions, + this->DirectoryState->CompileDefinitionsBacktraces, + this->Snapshot_.Position->CompileDefinitionsPosition); +} + +void cmStateDirectory::AppendCompileDefinitionsEntry( + const std::string& vec, const cmListFileBacktrace& lfbt) +{ + AppendEntry(this->DirectoryState->CompileDefinitions, + this->DirectoryState->CompileDefinitionsBacktraces, + this->Snapshot_.Position->CompileDefinitionsPosition, vec, lfbt); +} + +void cmStateDirectory::SetCompileDefinitions(const std::string& vec, + const cmListFileBacktrace& lfbt) +{ + SetContent(this->DirectoryState->CompileDefinitions, + this->DirectoryState->CompileDefinitionsBacktraces, + this->Snapshot_.Position->CompileDefinitionsPosition, vec, lfbt); +} + +void cmStateDirectory::ClearCompileDefinitions() +{ + ClearContent(this->DirectoryState->CompileDefinitions, + this->DirectoryState->CompileDefinitionsBacktraces, + this->Snapshot_.Position->CompileDefinitionsPosition); +} + +cmStringRange cmStateDirectory::GetCompileOptionsEntries() const +{ + return GetPropertyContent(this->DirectoryState->CompileOptions, + this->Snapshot_.Position->CompileOptionsPosition); +} + +cmBacktraceRange cmStateDirectory::GetCompileOptionsEntryBacktraces() const +{ + return GetPropertyBacktraces( + this->DirectoryState->CompileOptions, + this->DirectoryState->CompileOptionsBacktraces, + this->Snapshot_.Position->CompileOptionsPosition); +} + +void cmStateDirectory::AppendCompileOptionsEntry( + const std::string& vec, const cmListFileBacktrace& lfbt) +{ + AppendEntry(this->DirectoryState->CompileOptions, + this->DirectoryState->CompileOptionsBacktraces, + this->Snapshot_.Position->CompileOptionsPosition, vec, lfbt); +} + +void cmStateDirectory::SetCompileOptions(const std::string& vec, + const cmListFileBacktrace& lfbt) +{ + SetContent(this->DirectoryState->CompileOptions, + this->DirectoryState->CompileOptionsBacktraces, + this->Snapshot_.Position->CompileOptionsPosition, vec, lfbt); +} + +void cmStateDirectory::ClearCompileOptions() +{ + ClearContent(this->DirectoryState->CompileOptions, + this->DirectoryState->CompileOptionsBacktraces, + this->Snapshot_.Position->CompileOptionsPosition); +} + +void cmStateDirectory::SetProperty(const std::string& prop, const char* value, + cmListFileBacktrace const& lfbt) +{ + if (prop == "INCLUDE_DIRECTORIES") { + if (!value) { + this->ClearIncludeDirectories(); + return; + } + this->SetIncludeDirectories(value, lfbt); + return; + } + if (prop == "COMPILE_OPTIONS") { + if (!value) { + this->ClearCompileOptions(); + return; + } + this->SetCompileOptions(value, lfbt); + return; + } + if (prop == "COMPILE_DEFINITIONS") { + if (!value) { + this->ClearCompileDefinitions(); + return; + } + this->SetCompileDefinitions(value, lfbt); + return; + } + + this->DirectoryState->Properties.SetProperty(prop, value); +} + +void cmStateDirectory::AppendProperty(const std::string& prop, + const char* value, bool asString, + cmListFileBacktrace const& lfbt) +{ + if (prop == "INCLUDE_DIRECTORIES") { + this->AppendIncludeDirectoriesEntry(value, lfbt); + return; + } + if (prop == "COMPILE_OPTIONS") { + this->AppendCompileOptionsEntry(value, lfbt); + return; + } + if (prop == "COMPILE_DEFINITIONS") { + this->AppendCompileDefinitionsEntry(value, lfbt); + return; + } + + this->DirectoryState->Properties.AppendProperty(prop, value, asString); +} + +const char* cmStateDirectory::GetProperty(const std::string& prop) const +{ + const bool chain = + this->Snapshot_.State->IsPropertyChained(prop, cmProperty::DIRECTORY); + return this->GetProperty(prop, chain); +} + +const char* cmStateDirectory::GetProperty(const std::string& prop, + bool chain) const +{ + static std::string output; + output = ""; + if (prop == "PARENT_DIRECTORY") { + cmStateSnapshot parent = this->Snapshot_.GetBuildsystemDirectoryParent(); + if (parent.IsValid()) { + return parent.GetDirectory().GetCurrentSource(); + } + return ""; + } + if (prop == kBINARY_DIR) { + output = this->GetCurrentBinary(); + return output.c_str(); + } + if (prop == kSOURCE_DIR) { + output = this->GetCurrentSource(); + return output.c_str(); + } + if (prop == kSUBDIRECTORIES) { + std::vector child_dirs; + std::vector const& children = + this->DirectoryState->Children; + for (std::vector::const_iterator ci = children.begin(); + ci != children.end(); ++ci) { + child_dirs.push_back(ci->GetDirectory().GetCurrentSource()); + } + output = cmJoin(child_dirs, ";"); + return output.c_str(); + } + if (prop == kBUILDSYSTEM_TARGETS) { + output = cmJoin(this->DirectoryState->NormalTargetNames, ";"); + return output.c_str(); + } + + if (prop == "LISTFILE_STACK") { + std::vector listFiles; + cmStateSnapshot snp = this->Snapshot_; + while (snp.IsValid()) { + listFiles.push_back(snp.GetExecutionListFile()); + snp = snp.GetCallStackParent(); + } + std::reverse(listFiles.begin(), listFiles.end()); + output = cmJoin(listFiles, ";"); + return output.c_str(); + } + if (prop == "CACHE_VARIABLES") { + output = cmJoin(this->Snapshot_.State->GetCacheEntryKeys(), ";"); + return output.c_str(); + } + if (prop == "VARIABLES") { + std::vector res = this->Snapshot_.ClosureKeys(); + std::vector cacheKeys = + this->Snapshot_.State->GetCacheEntryKeys(); + res.insert(res.end(), cacheKeys.begin(), cacheKeys.end()); + std::sort(res.begin(), res.end()); + output = cmJoin(res, ";"); + return output.c_str(); + } + if (prop == "INCLUDE_DIRECTORIES") { + output = cmJoin(this->GetIncludeDirectoriesEntries(), ";"); + return output.c_str(); + } + if (prop == "COMPILE_OPTIONS") { + output = cmJoin(this->GetCompileOptionsEntries(), ";"); + return output.c_str(); + } + if (prop == "COMPILE_DEFINITIONS") { + output = cmJoin(this->GetCompileDefinitionsEntries(), ";"); + return output.c_str(); + } + + const char* retVal = this->DirectoryState->Properties.GetPropertyValue(prop); + if (!retVal && chain) { + cmStateSnapshot parentSnapshot = + this->Snapshot_.GetBuildsystemDirectoryParent(); + if (parentSnapshot.IsValid()) { + return parentSnapshot.GetDirectory().GetProperty(prop, chain); + } + return this->Snapshot_.State->GetGlobalProperty(prop); + } + + return retVal; +} + +bool cmStateDirectory::GetPropertyAsBool(const std::string& prop) const +{ + return cmSystemTools::IsOn(this->GetProperty(prop)); +} + +std::vector cmStateDirectory::GetPropertyKeys() const +{ + std::vector keys; + keys.reserve(this->DirectoryState->Properties.size()); + for (cmPropertyMap::const_iterator it = + this->DirectoryState->Properties.begin(); + it != this->DirectoryState->Properties.end(); ++it) { + keys.push_back(it->first); + } + return keys; +} + +void cmStateDirectory::AddNormalTargetName(std::string const& name) +{ + this->DirectoryState->NormalTargetNames.push_back(name); +} diff --git a/Source/cmStateDirectory.h b/Source/cmStateDirectory.h new file mode 100644 index 0000000..17a89d8 --- /dev/null +++ b/Source/cmStateDirectory.h @@ -0,0 +1,82 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ + +#ifndef cmStateDirectory_h +#define cmStateDirectory_h + +#include // IWYU pragma: keep + +#include +#include + +#include "cmAlgorithms.h" +#include "cmListFileCache.h" +#include "cmStateSnapshot.h" +#include "cmStateTypes.h" + +class cmStateDirectory +{ + cmStateDirectory( + cmLinkedTree::iterator iter, + cmStateSnapshot const& snapshot); + +public: + const char* GetCurrentSource() const; + void SetCurrentSource(std::string const& dir); + const char* GetCurrentBinary() const; + void SetCurrentBinary(std::string const& dir); + + const char* GetRelativePathTopSource() const; + const char* GetRelativePathTopBinary() const; + void SetRelativePathTopSource(const char* dir); + void SetRelativePathTopBinary(const char* dir); + + cmStringRange GetIncludeDirectoriesEntries() const; + cmBacktraceRange GetIncludeDirectoriesEntryBacktraces() const; + void AppendIncludeDirectoriesEntry(std::string const& vec, + cmListFileBacktrace const& lfbt); + void PrependIncludeDirectoriesEntry(std::string const& vec, + cmListFileBacktrace const& lfbt); + void SetIncludeDirectories(std::string const& vec, + cmListFileBacktrace const& lfbt); + void ClearIncludeDirectories(); + + cmStringRange GetCompileDefinitionsEntries() const; + cmBacktraceRange GetCompileDefinitionsEntryBacktraces() const; + void AppendCompileDefinitionsEntry(std::string const& vec, + cmListFileBacktrace const& lfbt); + void SetCompileDefinitions(std::string const& vec, + cmListFileBacktrace const& lfbt); + void ClearCompileDefinitions(); + + cmStringRange GetCompileOptionsEntries() const; + cmBacktraceRange GetCompileOptionsEntryBacktraces() const; + void AppendCompileOptionsEntry(std::string const& vec, + cmListFileBacktrace const& lfbt); + void SetCompileOptions(std::string const& vec, + cmListFileBacktrace const& lfbt); + void ClearCompileOptions(); + + void SetProperty(const std::string& prop, const char* value, + cmListFileBacktrace const& lfbt); + void AppendProperty(const std::string& prop, const char* value, + bool asString, cmListFileBacktrace const& lfbt); + const char* GetProperty(const std::string& prop) const; + const char* GetProperty(const std::string& prop, bool chain) const; + bool GetPropertyAsBool(const std::string& prop) const; + std::vector GetPropertyKeys() const; + + void AddNormalTargetName(std::string const& name); + +private: + void ComputeRelativePathTopSource(); + void ComputeRelativePathTopBinary(); + +private: + cmLinkedTree::iterator + DirectoryState; + cmStateSnapshot Snapshot_; + friend class cmStateSnapshot; +}; + +#endif diff --git a/Source/cmStatePrivate.h b/Source/cmStatePrivate.h new file mode 100644 index 0000000..8daa3cf --- /dev/null +++ b/Source/cmStatePrivate.h @@ -0,0 +1,94 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ + +#ifndef cmStatePrivate_h +#define cmStatePrivate_h + +#include // IWYU pragma: keep + +#include +#include + +#include "cmDefinitions.h" +#include "cmLinkedTree.h" +#include "cmListFileCache.h" +#include "cmPropertyMap.h" +#include "cmStateTypes.h" + +static const std::string cmPropertySentinal = std::string(); + +struct cmStateDetail::SnapshotDataType +{ + cmStateDetail::PositionType ScopeParent; + cmStateDetail::PositionType DirectoryParent; + cmLinkedTree::iterator Policies; + cmLinkedTree::iterator PolicyRoot; + cmLinkedTree::iterator PolicyScope; + cmStateEnums::SnapshotType SnapshotType; + bool Keep; + cmLinkedTree::iterator ExecutionListFile; + cmLinkedTree::iterator + BuildSystemDirectory; + cmLinkedTree::iterator Vars; + cmLinkedTree::iterator Root; + cmLinkedTree::iterator Parent; + std::vector::size_type IncludeDirectoryPosition; + std::vector::size_type CompileDefinitionsPosition; + std::vector::size_type CompileOptionsPosition; +}; + +struct cmStateDetail::PolicyStackEntry : public cmPolicies::PolicyMap +{ + typedef cmPolicies::PolicyMap derived; + PolicyStackEntry(bool w = false) + : derived() + , Weak(w) + { + } + PolicyStackEntry(derived const& d, bool w) + : derived(d) + , Weak(w) + { + } + PolicyStackEntry(PolicyStackEntry const& r) + : derived(r) + , Weak(r.Weak) + { + } + bool Weak; +}; + +struct cmStateDetail::BuildsystemDirectoryStateType +{ + cmStateDetail::PositionType DirectoryEnd; + + std::string Location; + std::string OutputLocation; + + // The top-most directories for relative path conversion. Both the + // source and destination location of a relative path conversion + // must be underneath one of these directories (both under source or + // both under binary) in order for the relative path to be evaluated + // safely by the build tools. + std::string RelativePathTopSource; + std::string RelativePathTopBinary; + + std::vector IncludeDirectories; + std::vector IncludeDirectoryBacktraces; + + std::vector CompileDefinitions; + std::vector CompileDefinitionsBacktraces; + + std::vector CompileOptions; + std::vector CompileOptionsBacktraces; + + std::vector NormalTargetNames; + + std::string ProjectName; + + cmPropertyMap Properties; + + std::vector Children; +}; + +#endif diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx new file mode 100644 index 0000000..7f86221 --- /dev/null +++ b/Source/cmStateSnapshot.cxx @@ -0,0 +1,415 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ + +#include "cmStateSnapshot.h" + +#include "cmState.h" +#include "cmStateDirectory.h" +#include "cmStatePrivate.h" +#include "cmSystemTools.h" +#include "cmVersion.h" +#include "cmake.h" + +cmStateSnapshot::cmStateSnapshot(cmState* state) + : State(state) + , Position() +{ +} + +std::vector cmStateSnapshot::GetChildren() +{ + return this->Position->BuildSystemDirectory->Children; +} + +cmStateSnapshot::cmStateSnapshot(cmState* state, + cmStateDetail::PositionType position) + : State(state) + , Position(position) +{ +} + +cmStateEnums::SnapshotType cmStateSnapshot::GetType() const +{ + return this->Position->SnapshotType; +} + +void cmStateSnapshot::SetListFile(const std::string& listfile) +{ + *this->Position->ExecutionListFile = listfile; +} + +std::string cmStateSnapshot::GetExecutionListFile() const +{ + return *this->Position->ExecutionListFile; +} + +bool cmStateSnapshot::IsValid() const +{ + return this->State && this->Position.IsValid() + ? this->Position != this->State->SnapshotData.Root() + : false; +} + +cmStateSnapshot cmStateSnapshot::GetBuildsystemDirectoryParent() const +{ + cmStateSnapshot snapshot; + if (!this->State || this->Position == this->State->SnapshotData.Root()) { + return snapshot; + } + cmStateDetail::PositionType parentPos = this->Position->DirectoryParent; + if (parentPos != this->State->SnapshotData.Root()) { + snapshot = cmStateSnapshot(this->State, + parentPos->BuildSystemDirectory->DirectoryEnd); + } + + return snapshot; +} + +cmStateSnapshot cmStateSnapshot::GetCallStackParent() const +{ + assert(this->State); + assert(this->Position != this->State->SnapshotData.Root()); + + cmStateSnapshot snapshot; + cmStateDetail::PositionType parentPos = this->Position; + while (parentPos->SnapshotType == cmStateEnums::PolicyScopeType || + parentPos->SnapshotType == cmStateEnums::VariableScopeType) { + ++parentPos; + } + if (parentPos->SnapshotType == cmStateEnums::BuildsystemDirectoryType || + parentPos->SnapshotType == cmStateEnums::BaseType) { + return snapshot; + } + + ++parentPos; + while (parentPos->SnapshotType == cmStateEnums::PolicyScopeType || + parentPos->SnapshotType == cmStateEnums::VariableScopeType) { + ++parentPos; + } + + if (parentPos == this->State->SnapshotData.Root()) { + return snapshot; + } + + snapshot = cmStateSnapshot(this->State, parentPos); + return snapshot; +} + +cmStateSnapshot cmStateSnapshot::GetCallStackBottom() const +{ + assert(this->State); + assert(this->Position != this->State->SnapshotData.Root()); + + cmStateDetail::PositionType pos = this->Position; + while (pos->SnapshotType != cmStateEnums::BaseType && + pos->SnapshotType != cmStateEnums::BuildsystemDirectoryType && + pos != this->State->SnapshotData.Root()) { + ++pos; + } + return cmStateSnapshot(this->State, pos); +} + +void cmStateSnapshot::PushPolicy(cmPolicies::PolicyMap entry, bool weak) +{ + cmStateDetail::PositionType pos = this->Position; + pos->Policies = this->State->PolicyStack.Push( + pos->Policies, cmStateDetail::PolicyStackEntry(entry, weak)); +} + +bool cmStateSnapshot::PopPolicy() +{ + cmStateDetail::PositionType pos = this->Position; + if (pos->Policies == pos->PolicyScope) { + return false; + } + pos->Policies = this->State->PolicyStack.Pop(pos->Policies); + return true; +} + +bool cmStateSnapshot::CanPopPolicyScope() +{ + return this->Position->Policies == this->Position->PolicyScope; +} + +void cmStateSnapshot::SetPolicy(cmPolicies::PolicyID id, + cmPolicies::PolicyStatus status) +{ + // Update the policy stack from the top to the top-most strong entry. + bool previous_was_weak = true; + for (cmLinkedTree::iterator psi = + this->Position->Policies; + previous_was_weak && psi != this->Position->PolicyRoot; ++psi) { + psi->Set(id, status); + previous_was_weak = psi->Weak; + } +} + +cmPolicies::PolicyStatus cmStateSnapshot::GetPolicy( + cmPolicies::PolicyID id) const +{ + cmPolicies::PolicyStatus status = cmPolicies::GetPolicyStatus(id); + + if (status == cmPolicies::REQUIRED_ALWAYS || + status == cmPolicies::REQUIRED_IF_USED) { + return status; + } + + cmLinkedTree::iterator dir = + this->Position->BuildSystemDirectory; + + while (true) { + assert(dir.IsValid()); + cmLinkedTree::iterator leaf = + dir->DirectoryEnd->Policies; + cmLinkedTree::iterator root = + dir->DirectoryEnd->PolicyRoot; + for (; leaf != root; ++leaf) { + if (leaf->IsDefined(id)) { + status = leaf->Get(id); + return status; + } + } + cmStateDetail::PositionType e = dir->DirectoryEnd; + cmStateDetail::PositionType p = e->DirectoryParent; + if (p == this->State->SnapshotData.Root()) { + break; + } + dir = p->BuildSystemDirectory; + } + return status; +} + +bool cmStateSnapshot::HasDefinedPolicyCMP0011() +{ + return !this->Position->Policies->IsEmpty(); +} + +const char* cmStateSnapshot::GetDefinition(std::string const& name) const +{ + assert(this->Position->Vars.IsValid()); + return cmDefinitions::Get(name, this->Position->Vars, this->Position->Root); +} + +bool cmStateSnapshot::IsInitialized(std::string const& name) const +{ + return cmDefinitions::HasKey(name, this->Position->Vars, + this->Position->Root); +} + +void cmStateSnapshot::SetDefinition(std::string const& name, + std::string const& value) +{ + this->Position->Vars->Set(name, value.c_str()); +} + +void cmStateSnapshot::RemoveDefinition(std::string const& name) +{ + this->Position->Vars->Set(name, CM_NULLPTR); +} + +std::vector cmStateSnapshot::UnusedKeys() const +{ + return this->Position->Vars->UnusedKeys(); +} + +std::vector cmStateSnapshot::ClosureKeys() const +{ + return cmDefinitions::ClosureKeys(this->Position->Vars, + this->Position->Root); +} + +bool cmStateSnapshot::RaiseScope(std::string const& var, const char* varDef) +{ + if (this->Position->ScopeParent == this->Position->DirectoryParent) { + cmStateSnapshot parentDir = this->GetBuildsystemDirectoryParent(); + if (!parentDir.IsValid()) { + return false; + } + // Update the definition in the parent directory top scope. This + // directory's scope was initialized by the closure of the parent + // scope, so we do not need to localize the definition first. + if (varDef) { + parentDir.SetDefinition(var, varDef); + } else { + parentDir.RemoveDefinition(var); + } + return true; + } + // First localize the definition in the current scope. + cmDefinitions::Raise(var, this->Position->Vars, this->Position->Root); + + // Now update the definition in the parent scope. + this->Position->Parent->Set(var, varDef); + return true; +} + +template +void InitializeContentFromParent(T& parentContent, T& thisContent, + U& parentBacktraces, U& thisBacktraces, + V& contentEndPosition) +{ + std::vector::const_iterator parentBegin = parentContent.begin(); + std::vector::const_iterator parentEnd = parentContent.end(); + + std::vector::const_reverse_iterator parentRbegin = + cmMakeReverseIterator(parentEnd); + std::vector::const_reverse_iterator parentRend = + parentContent.rend(); + parentRbegin = std::find(parentRbegin, parentRend, cmPropertySentinal); + std::vector::const_iterator parentIt = parentRbegin.base(); + + thisContent = std::vector(parentIt, parentEnd); + + std::vector::const_iterator btIt = + parentBacktraces.begin() + std::distance(parentBegin, parentIt); + std::vector::const_iterator btEnd = + parentBacktraces.end(); + + thisBacktraces = std::vector(btIt, btEnd); + + contentEndPosition = thisContent.size(); +} + +void cmStateSnapshot::SetDefaultDefinitions() +{ +/* Up to CMake 2.4 here only WIN32, UNIX and APPLE were set. + With CMake must separate between target and host platform. In most cases + the tests for WIN32, UNIX and APPLE will be for the target system, so an + additional set of variables for the host system is required -> + CMAKE_HOST_WIN32, CMAKE_HOST_UNIX, CMAKE_HOST_APPLE. + WIN32, UNIX and APPLE are now set in the platform files in + Modules/Platforms/. + To keep cmake scripts (-P) and custom language and compiler modules + working, these variables are still also set here in this place, but they + will be reset in CMakeSystemSpecificInformation.cmake before the platform + files are executed. */ +#if defined(_WIN32) + this->SetDefinition("WIN32", "1"); + this->SetDefinition("CMAKE_HOST_WIN32", "1"); +#else + this->SetDefinition("UNIX", "1"); + this->SetDefinition("CMAKE_HOST_UNIX", "1"); +#endif +#if defined(__CYGWIN__) + std::string legacy; + if (cmSystemTools::GetEnv("CMAKE_LEGACY_CYGWIN_WIN32", legacy) && + cmSystemTools::IsOn(legacy.c_str())) { + this->SetDefinition("WIN32", "1"); + this->SetDefinition("CMAKE_HOST_WIN32", "1"); + } +#endif +#if defined(__APPLE__) + this->SetDefinition("APPLE", "1"); + this->SetDefinition("CMAKE_HOST_APPLE", "1"); +#endif +#if defined(__sun__) + this->SetDefinition("CMAKE_HOST_SOLARIS", "1"); +#endif + + char temp[1024]; + sprintf(temp, "%d", cmVersion::GetMinorVersion()); + this->SetDefinition("CMAKE_MINOR_VERSION", temp); + sprintf(temp, "%d", cmVersion::GetMajorVersion()); + this->SetDefinition("CMAKE_MAJOR_VERSION", temp); + sprintf(temp, "%d", cmVersion::GetPatchVersion()); + this->SetDefinition("CMAKE_PATCH_VERSION", temp); + sprintf(temp, "%d", cmVersion::GetTweakVersion()); + this->SetDefinition("CMAKE_TWEAK_VERSION", temp); + this->SetDefinition("CMAKE_VERSION", cmVersion::GetCMakeVersion()); + + this->SetDefinition("CMAKE_FILES_DIRECTORY", + cmake::GetCMakeFilesDirectory()); + + // Setup the default include file regular expression (match everything). + this->Position->BuildSystemDirectory->Properties.SetProperty( + "INCLUDE_REGULAR_EXPRESSION", "^.*$"); +} + +void cmStateSnapshot::SetDirectoryDefinitions() +{ + this->SetDefinition("CMAKE_SOURCE_DIR", this->State->GetSourceDirectory()); + this->SetDefinition("CMAKE_CURRENT_SOURCE_DIR", + this->State->GetSourceDirectory()); + this->SetDefinition("CMAKE_BINARY_DIR", this->State->GetBinaryDirectory()); + this->SetDefinition("CMAKE_CURRENT_BINARY_DIR", + this->State->GetBinaryDirectory()); +} + +void cmStateSnapshot::InitializeFromParent() +{ + cmStateDetail::PositionType parent = this->Position->DirectoryParent; + assert(this->Position->Vars.IsValid()); + assert(parent->Vars.IsValid()); + + *this->Position->Vars = + cmDefinitions::MakeClosure(parent->Vars, parent->Root); + + InitializeContentFromParent( + parent->BuildSystemDirectory->IncludeDirectories, + this->Position->BuildSystemDirectory->IncludeDirectories, + parent->BuildSystemDirectory->IncludeDirectoryBacktraces, + this->Position->BuildSystemDirectory->IncludeDirectoryBacktraces, + this->Position->IncludeDirectoryPosition); + + InitializeContentFromParent( + parent->BuildSystemDirectory->CompileDefinitions, + this->Position->BuildSystemDirectory->CompileDefinitions, + parent->BuildSystemDirectory->CompileDefinitionsBacktraces, + this->Position->BuildSystemDirectory->CompileDefinitionsBacktraces, + this->Position->CompileDefinitionsPosition); + + InitializeContentFromParent( + parent->BuildSystemDirectory->CompileOptions, + this->Position->BuildSystemDirectory->CompileOptions, + parent->BuildSystemDirectory->CompileOptionsBacktraces, + this->Position->BuildSystemDirectory->CompileOptionsBacktraces, + this->Position->CompileOptionsPosition); +} + +cmState* cmStateSnapshot::GetState() const +{ + return this->State; +} + +cmStateDirectory cmStateSnapshot::GetDirectory() const +{ + return cmStateDirectory(this->Position->BuildSystemDirectory, *this); +} + +void cmStateSnapshot::SetProjectName(const std::string& name) +{ + this->Position->BuildSystemDirectory->ProjectName = name; +} + +std::string cmStateSnapshot::GetProjectName() const +{ + return this->Position->BuildSystemDirectory->ProjectName; +} + +void cmStateSnapshot::InitializeFromParent_ForSubdirsCommand() +{ + std::string currentSrcDir = this->GetDefinition("CMAKE_CURRENT_SOURCE_DIR"); + std::string currentBinDir = this->GetDefinition("CMAKE_CURRENT_BINARY_DIR"); + this->InitializeFromParent(); + this->SetDefinition("CMAKE_SOURCE_DIR", this->State->GetSourceDirectory()); + this->SetDefinition("CMAKE_BINARY_DIR", this->State->GetBinaryDirectory()); + + this->SetDefinition("CMAKE_CURRENT_SOURCE_DIR", currentSrcDir); + this->SetDefinition("CMAKE_CURRENT_BINARY_DIR", currentBinDir); +} + +bool cmStateSnapshot::StrictWeakOrder::operator()( + const cmStateSnapshot& lhs, const cmStateSnapshot& rhs) const +{ + return lhs.Position.StrictWeakOrdered(rhs.Position); +} + +bool operator==(const cmStateSnapshot& lhs, const cmStateSnapshot& rhs) +{ + return lhs.Position == rhs.Position; +} + +bool operator!=(const cmStateSnapshot& lhs, const cmStateSnapshot& rhs) +{ + return lhs.Position != rhs.Position; +} diff --git a/Source/cmStateSnapshot.h b/Source/cmStateSnapshot.h new file mode 100644 index 0000000..63b581d --- /dev/null +++ b/Source/cmStateSnapshot.h @@ -0,0 +1,88 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ + +#ifndef cmStateSnapshot_h +#define cmStateSnapshot_h + +#include // IWYU pragma: keep + +#include +#include +#include + +#include "cmPolicies.h" +#include "cmStateTypes.h" + +class cmState; +class cmStateDirectory; + +class cmStateSnapshot +{ +public: + cmStateSnapshot(cmState* state = CM_NULLPTR); + cmStateSnapshot(cmState* state, cmStateDetail::PositionType position); + + const char* GetDefinition(std::string const& name) const; + bool IsInitialized(std::string const& name) const; + void SetDefinition(std::string const& name, std::string const& value); + void RemoveDefinition(std::string const& name); + std::vector UnusedKeys() const; + std::vector ClosureKeys() const; + bool RaiseScope(std::string const& var, const char* varDef); + + void SetListFile(std::string const& listfile); + + std::string GetExecutionListFile() const; + + std::vector GetChildren(); + + bool IsValid() const; + cmStateSnapshot GetBuildsystemDirectoryParent() const; + cmStateSnapshot GetCallStackParent() const; + cmStateSnapshot GetCallStackBottom() const; + cmStateEnums::SnapshotType GetType() const; + + void SetPolicy(cmPolicies::PolicyID id, cmPolicies::PolicyStatus status); + cmPolicies::PolicyStatus GetPolicy(cmPolicies::PolicyID id) const; + bool HasDefinedPolicyCMP0011(); + void PushPolicy(cmPolicies::PolicyMap entry, bool weak); + bool PopPolicy(); + bool CanPopPolicyScope(); + + cmState* GetState() const; + + cmStateDirectory GetDirectory() const; + + void SetProjectName(std::string const& name); + std::string GetProjectName() const; + + void InitializeFromParent_ForSubdirsCommand(); + + struct StrictWeakOrder + { + bool operator()(const cmStateSnapshot& lhs, + const cmStateSnapshot& rhs) const; + }; + + void SetDirectoryDefinitions(); + void SetDefaultDefinitions(); + +private: + friend bool operator==(const cmStateSnapshot& lhs, + const cmStateSnapshot& rhs); + friend bool operator!=(const cmStateSnapshot& lhs, + const cmStateSnapshot& rhs); + friend class cmState; + friend class cmStateDirectory; + friend struct StrictWeakOrder; + + void InitializeFromParent(); + + cmState* State; + cmStateDetail::PositionType Position; +}; + +bool operator==(const cmStateSnapshot& lhs, const cmStateSnapshot& rhs); +bool operator!=(const cmStateSnapshot& lhs, const cmStateSnapshot& rhs); + +#endif diff --git a/Source/cmake.h b/Source/cmake.h index 0a577ad..cd00c61 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -7,7 +7,7 @@ #include "cmInstalledFile.h" #include "cmListFileCache.h" -#include "cmState.h" +#include "cmStateSnapshot.h" #include #include diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 912acdb..6e9ad6c 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -7,7 +7,7 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmQtAutoGenerators.h" -#include "cmState.h" +#include "cmStateDirectory.h" #include "cmSystemTools.h" #include "cmUtils.hxx" #include "cmVersion.h" diff --git a/bootstrap b/bootstrap index d537211..44afbb2 100755 --- a/bootstrap +++ b/bootstrap @@ -292,6 +292,8 @@ CMAKE_CXX_SOURCES="\ cmSourceFile \ cmSourceFileLocation \ cmState \ + cmStateDirectory \ + cmStateSnapshot \ cmSystemTools \ cmTestGenerator \ cmVersion \ -- cgit v0.12 From e3587ee01ddf834805e317c21dc87198f443c00e Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 18 Oct 2016 22:16:11 +0200 Subject: cmTargetPropertyComputer: Add missing include --- Source/cmTargetPropertyComputer.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/cmTargetPropertyComputer.h b/Source/cmTargetPropertyComputer.h index f8b683a..352d858 100644 --- a/Source/cmTargetPropertyComputer.h +++ b/Source/cmTargetPropertyComputer.h @@ -5,6 +5,7 @@ #include // IWYU pragma: keep +#include "cmAlgorithms.h" #include "cmListFileCache.h" #include "cmSystemTools.h" -- cgit v0.12 From e6eecec761afd9c1b275d4adebfd08c2e96412fd Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 18 Oct 2016 21:28:49 +0200 Subject: cmListFileCache: Remove cmState header include Include it in dependents which have previously relied on it transitively. --- Source/CPack/cpack.cxx | 1 + Source/CTest/cmCTestScriptHandler.cxx | 1 + Source/CTest/cmCTestSubmitHandler.cxx | 1 + Source/CTest/cmCTestTestHandler.cxx | 1 + Source/CursesDialog/cmCursesCacheEntryComposite.cxx | 1 + Source/CursesDialog/cmCursesMainForm.cxx | 1 + Source/cmAddLibraryCommand.cxx | 1 + Source/cmCMakePolicyCommand.cxx | 1 + Source/cmCTest.cxx | 1 + Source/cmCommandArgumentParserHelper.cxx | 1 + Source/cmComputeLinkInformation.cxx | 1 + Source/cmComputeTargetDepends.cxx | 1 + Source/cmConditionEvaluator.cxx | 1 + Source/cmCoreTryCompile.cxx | 1 + Source/cmDefinePropertyCommand.cxx | 1 + Source/cmExtraEclipseCDT4Generator.cxx | 1 + Source/cmFindBase.cxx | 1 + Source/cmFindLibraryCommand.cxx | 1 + Source/cmFindPackageCommand.cxx | 1 + Source/cmGeneratorTarget.cxx | 1 + Source/cmGetPropertyCommand.cxx | 1 + Source/cmGlobalBorlandMakefileGenerator.cxx | 1 + Source/cmGlobalGenerator.cxx | 1 + Source/cmGlobalJOMMakefileGenerator.cxx | 1 + Source/cmGlobalMSYSMakefileGenerator.cxx | 1 + Source/cmGlobalMinGWMakefileGenerator.cxx | 1 + Source/cmGlobalNMakeMakefileGenerator.cxx | 1 + Source/cmGlobalVisualStudio7Generator.cxx | 1 + Source/cmGlobalVisualStudioGenerator.cxx | 1 + Source/cmGlobalWatcomWMakeGenerator.cxx | 1 + Source/cmListFileCache.cxx | 1 + Source/cmListFileCache.h | 1 - Source/cmLocalNinjaGenerator.cxx | 1 + Source/cmMakefileExecutableTargetGenerator.cxx | 1 + Source/cmMakefileLibraryTargetGenerator.cxx | 1 + Source/cmMakefileTargetGenerator.cxx | 1 + Source/cmNinjaNormalTargetGenerator.cxx | 1 + Source/cmNinjaTargetGenerator.cxx | 1 + Source/cmPolicies.cxx | 1 + Source/cmQtAutoGeneratorInitializer.cxx | 1 + Source/cmSourceFile.cxx | 1 + Source/cmTarget.cxx | 1 + Source/cmTest.cxx | 1 + Source/cmUtilitySourceCommand.cxx | 2 ++ 44 files changed, 44 insertions(+), 1 deletion(-) diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index e3adf6b..c305cbf 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -9,6 +9,7 @@ #include "cmDocumentationEntry.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" +#include "cmState.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTypeMacro.h" diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index fa816a6..7ee0f75 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -21,6 +21,7 @@ #include "cmGeneratedFileStream.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" +#include "cmState.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmake.h" diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index a114755..d21471d 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -7,6 +7,7 @@ #include "cmCTestScriptHandler.h" #include "cmCurl.h" #include "cmGeneratedFileStream.h" +#include "cmState.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmXMLParser.h" diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 09efafb..4e6f1e9 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -9,6 +9,7 @@ #include "cmGeneratedFileStream.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" +#include "cmState.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmXMLWriter.h" diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx index 5d29942..5539fbe 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx @@ -9,6 +9,7 @@ #include "cmCursesPathWidget.h" #include "cmCursesStringWidget.h" #include "cmCursesWidget.h" +#include "cmState.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmake.h" diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index e8e70df..ebd35f3 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -11,6 +11,7 @@ #include "cmCursesStandardIncludes.h" #include "cmCursesStringWidget.h" #include "cmCursesWidget.h" +#include "cmState.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmVersion.h" diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx index 3cde147..0777ef0 100644 --- a/Source/cmAddLibraryCommand.cxx +++ b/Source/cmAddLibraryCommand.cxx @@ -2,6 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmAddLibraryCommand.h" +#include "cmState.h" #include "cmStateTypes.h" #include "cmake.h" diff --git a/Source/cmCMakePolicyCommand.cxx b/Source/cmCMakePolicyCommand.cxx index 36ffd7c..67581b6 100644 --- a/Source/cmCMakePolicyCommand.cxx +++ b/Source/cmCMakePolicyCommand.cxx @@ -2,6 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmCMakePolicyCommand.h" +#include "cmState.h" #include "cmVersion.h" // cmCMakePolicyCommand diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 502a709..024260c 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -20,6 +20,7 @@ #include "cmGeneratedFileStream.h" #include "cmGlobalGenerator.h" #include "cmMakefile.h" +#include "cmState.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmVersion.h" diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index 3df7689..2d66344 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -6,6 +6,7 @@ #include "cmCommandArgumentLexer.h" #include "cmMakefile.h" +#include "cmState.h" #include "cmSystemTools.h" #include "cmake.h" diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 16bbadb..28aa533 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -11,6 +11,7 @@ #include "cmOrderDirectories.h" #include "cmOutputConverter.h" #include "cmPolicies.h" +#include "cmState.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 70ed31e..cfebda2 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -10,6 +10,7 @@ #include "cmMakefile.h" #include "cmPolicies.h" #include "cmSourceFile.h" +#include "cmState.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx index 420a777..4c0b649 100644 --- a/Source/cmConditionEvaluator.cxx +++ b/Source/cmConditionEvaluator.cxx @@ -4,6 +4,7 @@ #include "cmAlgorithms.h" #include "cmOutputConverter.h" +#include "cmState.h" #include "cmSystemTools.h" static std::string const keyAND = "AND"; diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index e4a97a1..c7b6d58 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -6,6 +6,7 @@ #include "cmExportTryCompileFileGenerator.h" #include "cmGlobalGenerator.h" #include "cmOutputConverter.h" +#include "cmState.h" #include "cmake.h" #include diff --git a/Source/cmDefinePropertyCommand.cxx b/Source/cmDefinePropertyCommand.cxx index 99db478..af4eff9 100644 --- a/Source/cmDefinePropertyCommand.cxx +++ b/Source/cmDefinePropertyCommand.cxx @@ -2,6 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmDefinePropertyCommand.h" +#include "cmState.h" #include "cmStateTypes.h" #include "cmake.h" diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index d20e386..c4e86a9 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -11,6 +11,7 @@ #include "cmOutputConverter.h" #include "cmSourceFile.h" #include "cmSourceGroup.h" +#include "cmState.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmXMLWriter.h" diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index 66433f9..ff822b8 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -3,6 +3,7 @@ #include "cmFindBase.h" #include "cmAlgorithms.h" +#include "cmState.h" #include "cmStateTypes.h" cmFindBase::cmFindBase() diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index 2909209..5d8aaa2 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -2,6 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmFindLibraryCommand.h" +#include "cmState.h" #include cmFindLibraryCommand::cmFindLibraryCommand() diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 5723999..029d422 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -3,6 +3,7 @@ #include "cmFindPackageCommand.h" #include "cmAlgorithms.h" +#include "cmState.h" #include #include #include diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 8324c30..7dae226 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -15,6 +15,7 @@ #include "cmPropertyMap.h" #include "cmSourceFile.h" #include "cmSourceFileLocation.h" +#include "cmState.h" #include "cmSystemTools.h" #include "cmTarget.h" #include "cmTargetLinkLibraryType.h" diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index c44445a..da648d9 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -5,6 +5,7 @@ #include "cmGlobalGenerator.h" #include "cmPropertyDefinition.h" #include "cmSourceFile.h" +#include "cmState.h" #include "cmStateTypes.h" #include "cmTargetPropertyComputer.h" #include "cmTest.h" diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx index 5a2150d..a0a33ea 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.cxx +++ b/Source/cmGlobalBorlandMakefileGenerator.cxx @@ -4,6 +4,7 @@ #include "cmLocalUnixMakefileGenerator3.h" #include "cmMakefile.h" +#include "cmState.h" #include "cmake.h" cmGlobalBorlandMakefileGenerator::cmGlobalBorlandMakefileGenerator(cmake* cm) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index fd3734b..b4ede1d 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -28,6 +28,7 @@ #include "cmPolicies.h" #include "cmQtAutoGeneratorInitializer.h" #include "cmSourceFile.h" +#include "cmState.h" #include "cmStateTypes.h" #include "cmVersion.h" #include "cmake.h" diff --git a/Source/cmGlobalJOMMakefileGenerator.cxx b/Source/cmGlobalJOMMakefileGenerator.cxx index a846773..78bf5bd 100644 --- a/Source/cmGlobalJOMMakefileGenerator.cxx +++ b/Source/cmGlobalJOMMakefileGenerator.cxx @@ -4,6 +4,7 @@ #include "cmLocalUnixMakefileGenerator3.h" #include "cmMakefile.h" +#include "cmState.h" cmGlobalJOMMakefileGenerator::cmGlobalJOMMakefileGenerator(cmake* cm) : cmGlobalUnixMakefileGenerator3(cm) diff --git a/Source/cmGlobalMSYSMakefileGenerator.cxx b/Source/cmGlobalMSYSMakefileGenerator.cxx index 6d314d6..f17b915 100644 --- a/Source/cmGlobalMSYSMakefileGenerator.cxx +++ b/Source/cmGlobalMSYSMakefileGenerator.cxx @@ -4,6 +4,7 @@ #include "cmLocalUnixMakefileGenerator3.h" #include "cmMakefile.h" +#include "cmState.h" #include "cmake.h" #include diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx index d5decfb..255c0f5 100644 --- a/Source/cmGlobalMinGWMakefileGenerator.cxx +++ b/Source/cmGlobalMinGWMakefileGenerator.cxx @@ -4,6 +4,7 @@ #include "cmLocalUnixMakefileGenerator3.h" #include "cmMakefile.h" +#include "cmState.h" cmGlobalMinGWMakefileGenerator::cmGlobalMinGWMakefileGenerator(cmake* cm) : cmGlobalUnixMakefileGenerator3(cm) diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx index 48798fb..06aba73 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.cxx +++ b/Source/cmGlobalNMakeMakefileGenerator.cxx @@ -4,6 +4,7 @@ #include "cmLocalUnixMakefileGenerator3.h" #include "cmMakefile.h" +#include "cmState.h" cmGlobalNMakeMakefileGenerator::cmGlobalNMakeMakefileGenerator(cmake* cm) : cmGlobalUnixMakefileGenerator3(cm) diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 635d07e..51cb315 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -8,6 +8,7 @@ #include "cmGeneratorTarget.h" #include "cmLocalVisualStudio7Generator.h" #include "cmMakefile.h" +#include "cmState.h" #include "cmUuid.h" #include "cmake.h" #include diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 45f7913..0782182 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -10,6 +10,7 @@ #include "cmLocalVisualStudioGenerator.h" #include "cmMakefile.h" #include "cmSourceFile.h" +#include "cmState.h" #include "cmTarget.h" #include diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx index f97bb75..0900797 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.cxx +++ b/Source/cmGlobalWatcomWMakeGenerator.cxx @@ -4,6 +4,7 @@ #include "cmDocumentationEntry.h" #include "cmMakefile.h" +#include "cmState.h" #include "cmStateTypes.h" #include "cmake.h" diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index c8744d4..b1cd889 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -5,6 +5,7 @@ #include "cmListFileLexer.h" #include "cmMessenger.h" #include "cmOutputConverter.h" +#include "cmState.h" #include "cmSystemTools.h" #include "cmake.h" diff --git a/Source/cmListFileCache.h b/Source/cmListFileCache.h index 9af00b2..1a30f29 100644 --- a/Source/cmListFileCache.h +++ b/Source/cmListFileCache.h @@ -9,7 +9,6 @@ #include #include -#include "cmState.h" #include "cmStateSnapshot.h" /** \class cmListFileCache diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 8789530..cd9af54 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -12,6 +12,7 @@ #include "cmNinjaTargetGenerator.h" #include "cmRulePlaceholderExpander.h" #include "cmSourceFile.h" +#include "cmState.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmake.h" diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 7eca0a8..cbbd2e6 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -12,6 +12,7 @@ #include "cmOSXBundleGenerator.h" #include "cmOutputConverter.h" #include "cmRulePlaceholderExpander.h" +#include "cmState.h" #include "cmSystemTools.h" #include "cmake.h" diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index cfe1e83..a249efd 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -12,6 +12,7 @@ #include "cmOSXBundleGenerator.h" #include "cmOutputConverter.h" #include "cmRulePlaceholderExpander.h" +#include "cmState.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmake.h" diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 4a8924f..68c166e 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -20,6 +20,7 @@ #include "cmOutputConverter.h" #include "cmRulePlaceholderExpander.h" #include "cmSourceFile.h" +#include "cmState.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cm_auto_ptr.hxx" diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index d5d3e90..3b71e34 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -17,6 +17,7 @@ #include "cmOutputConverter.h" #include "cmRulePlaceholderExpander.h" #include "cmSourceFile.h" +#include "cmState.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmake.h" diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 76fe047..514fbeb 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -16,6 +16,7 @@ #include "cmOutputConverter.h" #include "cmRulePlaceholderExpander.h" #include "cmSourceFile.h" +#include "cmState.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmake.h" diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 41bee8b..6339e11 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -2,6 +2,7 @@ #include "cmAlgorithms.h" #include "cmMakefile.h" +#include "cmState.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmVersion.h" diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx index b04c7ca..f0373a1 100644 --- a/Source/cmQtAutoGeneratorInitializer.cxx +++ b/Source/cmQtAutoGeneratorInitializer.cxx @@ -12,6 +12,7 @@ #include "cmOutputConverter.h" #include "cmSourceFile.h" #include "cmSourceFileLocation.h" +#include "cmState.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index ba24ff2..6f29b18 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -6,6 +6,7 @@ #include "cmGlobalGenerator.h" #include "cmMakefile.h" #include "cmProperty.h" +#include "cmState.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmake.h" diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 2527366..e2ee3a5 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -13,6 +13,7 @@ #include "cmProperty.h" #include "cmSourceFile.h" #include "cmSourceFileLocation.h" +#include "cmState.h" #include "cmSystemTools.h" #include "cmTargetPropertyComputer.h" #include "cmake.h" diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx index f55dc83..1c36dc6 100644 --- a/Source/cmTest.cxx +++ b/Source/cmTest.cxx @@ -4,6 +4,7 @@ #include "cmMakefile.h" #include "cmProperty.h" +#include "cmState.h" #include "cmStateTypes.h" #include "cmSystemTools.h" diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx index 8f25cbb..c816114 100644 --- a/Source/cmUtilitySourceCommand.cxx +++ b/Source/cmUtilitySourceCommand.cxx @@ -2,6 +2,8 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmUtilitySourceCommand.h" +#include "cmState.h" + // cmUtilitySourceCommand bool cmUtilitySourceCommand::InitialPass(std::vector const& args, cmExecutionStatus&) -- cgit v0.12