diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-08-04 22:00:53 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-08-26 17:46:30 (GMT) |
commit | a7f5d70dde50ac74726f3c23d276d2fdac70d659 (patch) | |
tree | e86e669efe22d739a037f2d7a2cf56ef295456b0 /Source/cmTarget.cxx | |
parent | d051086ccec5cd4b381cf47afb0e7fe962ed4c0b (diff) | |
download | CMake-a7f5d70dde50ac74726f3c23d276d2fdac70d659.zip CMake-a7f5d70dde50ac74726f3c23d276d2fdac70d659.tar.gz CMake-a7f5d70dde50ac74726f3c23d276d2fdac70d659.tar.bz2 |
cmGeneratorTarget: Move compile defintions processing from cmTarget.
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r-- | Source/cmTarget.cxx | 171 |
1 files changed, 10 insertions, 161 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 4ddbcb3..ea03ffe 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -145,7 +145,6 @@ public: std::vector<cmListFileBacktrace> CompileFeaturesBacktraces; std::vector<std::string> CompileDefinitionsEntries; std::vector<cmListFileBacktrace> CompileDefinitionsBacktraces; - std::vector<TargetPropertyEntry*> CompileDefinitionsItems; std::vector<TargetPropertyEntry*> SourceEntries; std::vector<cmValueWithOrigin> LinkImplementationPropertyEntries; @@ -174,7 +173,6 @@ cmTarget::cmTarget() this->IsApple = false; this->IsImportedTarget = false; this->BuildInterfaceIncludesAppended = false; - this->DebugCompileDefinitionsDone = false; this->DebugSourcesDone = false; this->LinkImplementationLanguageIsContextDependent = true; } @@ -417,14 +415,6 @@ void CreatePropertyGeneratorExpressions( } } -void cmTarget::Compute() -{ - CreatePropertyGeneratorExpressions( - this->Internal->CompileDefinitionsEntries, - this->Internal->CompileDefinitionsBacktraces, - this->Internal->CompileDefinitionsItems); -} - //---------------------------------------------------------------------------- void cmTarget::AddUtility(const std::string& u, cmMakefile *makefile) { @@ -1328,6 +1318,16 @@ cmBacktraceRange cmTarget::GetCompileFeaturesBacktraces() const return cmMakeRange(this->Internal->CompileFeaturesBacktraces); } +cmStringRange cmTarget::GetCompileDefinitionsEntries() const +{ + return cmMakeRange(this->Internal->CompileDefinitionsEntries); +} + +cmBacktraceRange cmTarget::GetCompileDefinitionsBacktraces() const +{ + return cmMakeRange(this->Internal->CompileDefinitionsBacktraces); +} + #if defined(_WIN32) && !defined(__CYGWIN__) //---------------------------------------------------------------------------- void @@ -1925,156 +1925,6 @@ void cmTarget::InsertCompileDefinition(std::string const& entry, } //---------------------------------------------------------------------------- -static void processCompileOptionsInternal(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, const char *logName, - std::string const& language) -{ - cmMakefile *mf = tgt->GetMakefile(); - - for (std::vector<cmTargetInternals::TargetPropertyEntry*>::const_iterator - it = entries.begin(), end = entries.end(); it != end; ++it) - { - std::vector<std::string> entryOptions; - cmSystemTools::ExpandListArgument((*it)->ge->Evaluate(mf, - config, - false, - tgt, - dagChecker, - language), - entryOptions); - std::string usedOptions; - for(std::vector<std::string>::iterator - li = entryOptions.begin(); li != entryOptions.end(); ++li) - { - std::string const& opt = *li; - - if(uniqueOptions.insert(opt).second) - { - options.push_back(opt); - if (debugOptions) - { - usedOptions += " * " + opt + "\n"; - } - } - } - if (!usedOptions.empty()) - { - mf->GetCMakeInstance()->IssueMessage(cmake::LOG, - std::string("Used compile ") + logName - + std::string(" for target ") - + tgt->GetName() + ":\n" - + usedOptions, (*it)->ge->GetBacktrace()); - } - } -} - -//---------------------------------------------------------------------------- -static void processCompileDefinitions(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, - std::string const& language) -{ - processCompileOptionsInternal(tgt, entries, options, uniqueOptions, - dagChecker, config, debugOptions, - "definitions", language); -} - -//---------------------------------------------------------------------------- -void cmTarget::GetCompileDefinitions(std::vector<std::string> &list, - const std::string& config, - const std::string& language) const -{ - UNORDERED_SET<std::string> uniqueOptions; - - cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), - "COMPILE_DEFINITIONS", 0, 0); - - std::vector<std::string> debugProperties; - const char *debugProp = - this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES"); - if (debugProp) - { - cmSystemTools::ExpandListArgument(debugProp, debugProperties); - } - - bool debugDefines = !this->DebugCompileDefinitionsDone - && std::find(debugProperties.begin(), - debugProperties.end(), - "COMPILE_DEFINITIONS") - != debugProperties.end(); - - if (this->Makefile->IsConfigured()) - { - this->DebugCompileDefinitionsDone = true; - } - - processCompileDefinitions(this, - this->Internal->CompileDefinitionsItems, - list, - uniqueOptions, - &dagChecker, - config, - debugDefines, - language); - - std::vector<cmTargetInternals::TargetPropertyEntry*> - linkInterfaceCompileDefinitionsEntries; - this->Internal->AddInterfaceEntries( - this, config, "INTERFACE_COMPILE_DEFINITIONS", - linkInterfaceCompileDefinitionsEntries); - if (!config.empty()) - { - std::string configPropName = "COMPILE_DEFINITIONS_" - + cmSystemTools::UpperCase(config); - const char *configProp = this->GetProperty(configPropName); - if (configProp) - { - switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0043)) - { - case cmPolicies::WARN: - { - std::ostringstream e; - e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0043); - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, - e.str()); - } - case cmPolicies::OLD: - { - cmGeneratorExpression ge; - cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = - ge.Parse(configProp); - linkInterfaceCompileDefinitionsEntries - .push_back(new cmTargetInternals::TargetPropertyEntry(cge)); - } - break; - case cmPolicies::NEW: - case cmPolicies::REQUIRED_ALWAYS: - case cmPolicies::REQUIRED_IF_USED: - break; - } - } - } - - processCompileDefinitions(this, - linkInterfaceCompileDefinitionsEntries, - list, - uniqueOptions, - &dagChecker, - config, - debugDefines, - language); - - cmDeleteAll(linkInterfaceCompileDefinitionsEntries); -} - -//---------------------------------------------------------------------------- void cmTarget::MaybeInvalidatePropertyCache(const std::string& prop) { // Wipe out maps caching information affected by this property. @@ -4034,7 +3884,6 @@ cmTargetInternalPointer //---------------------------------------------------------------------------- cmTargetInternalPointer::~cmTargetInternalPointer() { - cmDeleteAll(this->Pointer->CompileDefinitionsItems); cmDeleteAll(this->Pointer->SourceEntries); delete this->Pointer; } |