diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-08-04 21:48:58 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-08-26 17:46:10 (GMT) |
commit | d051086ccec5cd4b381cf47afb0e7fe962ed4c0b (patch) | |
tree | f75c2f09a92e0d3a15cb3849bf5d8c84a3ab8cc2 | |
parent | db4cb92bda8b43c3d66d27533622bb802e823589 (diff) | |
download | CMake-d051086ccec5cd4b381cf47afb0e7fe962ed4c0b.zip CMake-d051086ccec5cd4b381cf47afb0e7fe962ed4c0b.tar.gz CMake-d051086ccec5cd4b381cf47afb0e7fe962ed4c0b.tar.bz2 |
cmGeneratorTarget: Move compile features processing from cmTarget.
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 76 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.h | 5 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 85 | ||||
-rw-r--r-- | Source/cmTarget.h | 7 |
5 files changed, 94 insertions, 81 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 77e352f..5a67c15 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -262,7 +262,8 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg) SourceFileFlagsConstructed(false), PolicyWarnedCMP0022(false), DebugIncludesDone(false), - DebugCompileOptionsDone(false) + DebugCompileOptionsDone(false), + DebugCompileFeaturesDone(false) { this->Makefile = this->Target->GetMakefile(); this->LocalGenerator = lg; @@ -277,12 +278,18 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg) t->GetCompileOptionsEntries(), t->GetCompileOptionsBacktraces(), this->CompileOptionsEntries); + + CreatePropertyGeneratorExpressions( + t->GetCompileFeaturesEntries(), + t->GetCompileFeaturesBacktraces(), + this->CompileFeaturesEntries); } cmGeneratorTarget::~cmGeneratorTarget() { cmDeleteAll(this->IncludeDirectoriesEntries); cmDeleteAll(this->CompileOptionsEntries); + cmDeleteAll(this->CompileFeaturesEntries); cmDeleteAll(this->LinkInformation); this->LinkInformation.clear(); } @@ -2371,6 +2378,73 @@ void cmGeneratorTarget::GetCompileOptions(std::vector<std::string> &result, } //---------------------------------------------------------------------------- +static void processCompileFeatures(cmGeneratorTarget const* tgt, + const std::vector<cmGeneratorTarget::TargetPropertyEntry*> &entries, + std::vector<std::string> &options, + UNORDERED_SET<std::string> &uniqueOptions, + cmGeneratorExpressionDAGChecker *dagChecker, + const std::string& config, bool debugOptions) +{ + processCompileOptionsInternal(tgt, entries, options, uniqueOptions, + dagChecker, config, debugOptions, "features", + std::string()); +} + +//---------------------------------------------------------------------------- +void cmGeneratorTarget::GetCompileFeatures(std::vector<std::string> &result, + const std::string& config) const +{ + UNORDERED_SET<std::string> uniqueFeatures; + + cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), + "COMPILE_FEATURES", + 0, 0); + + std::vector<std::string> debugProperties; + const char *debugProp = + this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES"); + if (debugProp) + { + cmSystemTools::ExpandListArgument(debugProp, debugProperties); + } + + bool debugFeatures = !this->DebugCompileFeaturesDone + && std::find(debugProperties.begin(), + debugProperties.end(), + "COMPILE_FEATURES") + != debugProperties.end(); + + if (this->Makefile->IsConfigured()) + { + this->DebugCompileFeaturesDone = true; + } + + processCompileFeatures(this, + this->CompileFeaturesEntries, + result, + uniqueFeatures, + &dagChecker, + config, + debugFeatures); + + std::vector<cmGeneratorTarget::TargetPropertyEntry*> + linkInterfaceCompileFeaturesEntries; + AddInterfaceEntries( + this, config, "INTERFACE_COMPILE_FEATURES", + linkInterfaceCompileFeaturesEntries); + + processCompileFeatures(this, + linkInterfaceCompileFeaturesEntries, + result, + uniqueFeatures, + &dagChecker, + config, + debugFeatures); + + cmDeleteAll(linkInterfaceCompileFeaturesEntries); +} + +//---------------------------------------------------------------------------- void cmGeneratorTarget::GenerateTargetManifest( const std::string& config) const { diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 1fb8cfe..7e718af 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -221,6 +221,9 @@ public: const std::string& config, const std::string& language) const; + void GetCompileFeatures(std::vector<std::string> &features, + const std::string& config) const; + bool IsSystemIncludeDirectory(const std::string& dir, const std::string& config) const; @@ -412,6 +415,7 @@ private: std::vector<TargetPropertyEntry*> IncludeDirectoriesEntries; std::vector<TargetPropertyEntry*> CompileOptionsEntries; + std::vector<TargetPropertyEntry*> CompileFeaturesEntries; void ExpandLinkItems(std::string const& prop, std::string const& value, std::string const& config, cmTarget const* headTarget, @@ -427,6 +431,7 @@ private: mutable bool PolicyWarnedCMP0022; mutable bool DebugIncludesDone; mutable bool DebugCompileOptionsDone; + mutable bool DebugCompileFeaturesDone; public: std::vector<cmTarget const*> const& diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 89515ff..a7e4191 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1138,7 +1138,7 @@ void cmLocalGenerator::AddCompileOptions( } } std::vector<std::string> features; - target->GetCompileFeatures(features, config); + gtgt->GetCompileFeatures(features, config); for(std::vector<std::string>::const_iterator it = features.begin(); it != features.end(); ++it) { diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 9e13ea0..4ddbcb3 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -143,7 +143,6 @@ public: std::vector<cmListFileBacktrace> CompileOptionsBacktraces; std::vector<std::string> CompileFeaturesEntries; std::vector<cmListFileBacktrace> CompileFeaturesBacktraces; - std::vector<TargetPropertyEntry*> CompileFeaturesItems; std::vector<std::string> CompileDefinitionsEntries; std::vector<cmListFileBacktrace> CompileDefinitionsBacktraces; std::vector<TargetPropertyEntry*> CompileDefinitionsItems; @@ -175,7 +174,6 @@ cmTarget::cmTarget() this->IsApple = false; this->IsImportedTarget = false; this->BuildInterfaceIncludesAppended = false; - this->DebugCompileFeaturesDone = false; this->DebugCompileDefinitionsDone = false; this->DebugSourcesDone = false; this->LinkImplementationLanguageIsContextDependent = true; @@ -422,11 +420,6 @@ void CreatePropertyGeneratorExpressions( void cmTarget::Compute() { CreatePropertyGeneratorExpressions( - this->Internal->CompileFeaturesEntries, - this->Internal->CompileFeaturesBacktraces, - this->Internal->CompileFeaturesItems); - - CreatePropertyGeneratorExpressions( this->Internal->CompileDefinitionsEntries, this->Internal->CompileDefinitionsBacktraces, this->Internal->CompileDefinitionsItems); @@ -1325,6 +1318,16 @@ cmBacktraceRange cmTarget::GetCompileOptionsBacktraces() const return cmMakeRange(this->Internal->CompileOptionsBacktraces); } +cmStringRange cmTarget::GetCompileFeaturesEntries() const +{ + return cmMakeRange(this->Internal->CompileFeaturesEntries); +} + +cmBacktraceRange cmTarget::GetCompileFeaturesBacktraces() const +{ + return cmMakeRange(this->Internal->CompileFeaturesBacktraces); +} + #if defined(_WIN32) && !defined(__CYGWIN__) //---------------------------------------------------------------------------- void @@ -2072,73 +2075,6 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list, } //---------------------------------------------------------------------------- -static void processCompileFeatures(cmTarget const* tgt, - const std::vector<cmTargetInternals::TargetPropertyEntry*> &entries, - std::vector<std::string> &options, - UNORDERED_SET<std::string> &uniqueOptions, - cmGeneratorExpressionDAGChecker *dagChecker, - const std::string& config, bool debugOptions) -{ - processCompileOptionsInternal(tgt, entries, options, uniqueOptions, - dagChecker, config, debugOptions, "features", - std::string()); -} - -//---------------------------------------------------------------------------- -void cmTarget::GetCompileFeatures(std::vector<std::string> &result, - const std::string& config) const -{ - UNORDERED_SET<std::string> uniqueFeatures; - - cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), - "COMPILE_FEATURES", - 0, 0); - - std::vector<std::string> debugProperties; - const char *debugProp = - this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES"); - if (debugProp) - { - cmSystemTools::ExpandListArgument(debugProp, debugProperties); - } - - bool debugFeatures = !this->DebugCompileFeaturesDone - && std::find(debugProperties.begin(), - debugProperties.end(), - "COMPILE_FEATURES") - != debugProperties.end(); - - if (this->Makefile->IsConfigured()) - { - this->DebugCompileFeaturesDone = true; - } - - processCompileFeatures(this, - this->Internal->CompileFeaturesItems, - result, - uniqueFeatures, - &dagChecker, - config, - debugFeatures); - - std::vector<cmTargetInternals::TargetPropertyEntry*> - linkInterfaceCompileFeaturesEntries; - this->Internal->AddInterfaceEntries( - this, config, "INTERFACE_COMPILE_FEATURES", - linkInterfaceCompileFeaturesEntries); - - processCompileFeatures(this, - linkInterfaceCompileFeaturesEntries, - result, - uniqueFeatures, - &dagChecker, - config, - debugFeatures); - - cmDeleteAll(linkInterfaceCompileFeaturesEntries); -} - -//---------------------------------------------------------------------------- void cmTarget::MaybeInvalidatePropertyCache(const std::string& prop) { // Wipe out maps caching information affected by this property. @@ -4098,7 +4034,6 @@ cmTargetInternalPointer //---------------------------------------------------------------------------- cmTargetInternalPointer::~cmTargetInternalPointer() { - cmDeleteAll(this->Pointer->CompileFeaturesItems); cmDeleteAll(this->Pointer->CompileDefinitionsItems); cmDeleteAll(this->Pointer->SourceEntries); delete this->Pointer; diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 05b6aec..aae558e 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -375,9 +375,6 @@ public: void AppendBuildInterfaceIncludes(); - void GetCompileFeatures(std::vector<std::string> &features, - const std::string& config) const; - bool IsNullImpliedByLinkLibraries(const std::string &p) const; std::string GetDebugGeneratorExpressions(const std::string &value, @@ -402,6 +399,9 @@ public: cmStringRange GetCompileOptionsEntries() const; cmBacktraceRange GetCompileOptionsBacktraces() const; + cmStringRange GetCompileFeaturesEntries() const; + cmBacktraceRange GetCompileFeaturesBacktraces() const; + #if defined(_WIN32) && !defined(__CYGWIN__) const LinkLibraryVectorType &GetLinkLibrariesForVS6() const { return this->LinkLibrariesForVS6;} @@ -518,7 +518,6 @@ private: bool BuildInterfaceIncludesAppended; mutable bool DebugCompileDefinitionsDone; mutable bool DebugSourcesDone; - mutable bool DebugCompileFeaturesDone; mutable bool LinkImplementationLanguageIsContextDependent; #if defined(_WIN32) && !defined(__CYGWIN__) bool LinkLibrariesForVS6Analyzed; |