Rename the IncludeDirectoriesEntry to be more generic.

This commit is contained in:
Stephen Kelly 2013-02-12 10:35:28 +01:00
parent b030323c13
commit 5b88504f65
8 changed files with 23 additions and 49 deletions

View File

@ -76,4 +76,13 @@ struct cmListFile
std::vector<cmListFileFunction> Functions; std::vector<cmListFileFunction> Functions;
}; };
struct cmValueWithOrigin {
cmValueWithOrigin(const std::string &value,
const cmListFileBacktrace &bt)
: Value(value), Backtrace(bt)
{}
std::string Value;
cmListFileBacktrace Backtrace;
};
#endif #endif

View File

@ -1487,7 +1487,7 @@ void cmMakefile::InitializeFromParent()
// Initialize definitions with the closure of the parent scope. // Initialize definitions with the closure of the parent scope.
this->Internal->VarStack.top() = parent->Internal->VarStack.top().Closure(); this->Internal->VarStack.top() = parent->Internal->VarStack.top().Closure();
const std::vector<IncludeDirectoriesEntry> parentIncludes = const std::vector<cmValueWithOrigin> parentIncludes =
parent->GetIncludeDirectoriesEntries(); parent->GetIncludeDirectoriesEntries();
this->IncludeDirectoriesEntries.insert(this->IncludeDirectoriesEntries.end(), this->IncludeDirectoriesEntries.insert(this->IncludeDirectoriesEntries.end(),
parentIncludes.begin(), parentIncludes.begin(),
@ -1636,13 +1636,13 @@ void cmMakefile::AddIncludeDirectories(const std::vector<std::string> &incs,
sep = ";"; sep = ";";
} }
std::vector<IncludeDirectoriesEntry>::iterator position = std::vector<cmValueWithOrigin>::iterator position =
before ? this->IncludeDirectoriesEntries.begin() before ? this->IncludeDirectoriesEntries.begin()
: this->IncludeDirectoriesEntries.end(); : this->IncludeDirectoriesEntries.end();
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt;
this->GetBacktrace(lfbt); this->GetBacktrace(lfbt);
IncludeDirectoriesEntry entry(incString, lfbt); cmValueWithOrigin entry(incString, lfbt);
this->IncludeDirectoriesEntries.insert(position, entry); this->IncludeDirectoriesEntries.insert(position, entry);
// Property on each target: // Property on each target:
@ -3461,7 +3461,7 @@ void cmMakefile::SetProperty(const char* prop, const char* value)
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt;
this->GetBacktrace(lfbt); this->GetBacktrace(lfbt);
this->IncludeDirectoriesEntries.push_back( this->IncludeDirectoriesEntries.push_back(
IncludeDirectoriesEntry(value, lfbt)); cmValueWithOrigin(value, lfbt));
return; return;
} }
@ -3500,7 +3500,7 @@ void cmMakefile::AppendProperty(const char* prop, const char* value,
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt;
this->GetBacktrace(lfbt); this->GetBacktrace(lfbt);
this->IncludeDirectoriesEntries.push_back( this->IncludeDirectoriesEntries.push_back(
IncludeDirectoriesEntry(value, lfbt)); cmValueWithOrigin(value, lfbt));
return; return;
} }
if ( propname == "LINK_DIRECTORIES" ) if ( propname == "LINK_DIRECTORIES" )
@ -3617,7 +3617,7 @@ const char *cmMakefile::GetProperty(const char* prop,
else if (!strcmp("INCLUDE_DIRECTORIES",prop)) else if (!strcmp("INCLUDE_DIRECTORIES",prop))
{ {
std::string sep; std::string sep;
for (std::vector<IncludeDirectoriesEntry>::const_iterator for (std::vector<cmValueWithOrigin>::const_iterator
it = this->IncludeDirectoriesEntries.begin(), it = this->IncludeDirectoriesEntries.begin(),
end = this->IncludeDirectoriesEntries.end(); end = this->IncludeDirectoriesEntries.end();
it != end; ++it) it != end; ++it)

View File

@ -22,7 +22,6 @@
#include "cmNewLineStyle.h" #include "cmNewLineStyle.h"
#include "cmGeneratorTarget.h" #include "cmGeneratorTarget.h"
#include "cmake.h" #include "cmake.h"
#include "cmMakefileIncludeDirectoriesEntry.h"
#if defined(CMAKE_BUILD_WITH_CMAKE) #if defined(CMAKE_BUILD_WITH_CMAKE)
#include "cmSourceGroup.h" #include "cmSourceGroup.h"
@ -863,9 +862,7 @@ public:
/** Set whether or not to report a CMP0000 violation. */ /** Set whether or not to report a CMP0000 violation. */
void SetCheckCMP0000(bool b) { this->CheckCMP0000 = b; } void SetCheckCMP0000(bool b) { this->CheckCMP0000 = b; }
typedef cmMakefileIncludeDirectoriesEntry IncludeDirectoriesEntry; std::vector<cmValueWithOrigin> GetIncludeDirectoriesEntries() const
std::vector<IncludeDirectoriesEntry> GetIncludeDirectoriesEntries() const
{ {
return this->IncludeDirectoriesEntries; return this->IncludeDirectoriesEntries;
} }
@ -921,7 +918,7 @@ protected:
std::vector<std::string> HeaderFileExtensions; std::vector<std::string> HeaderFileExtensions;
std::string DefineFlags; std::string DefineFlags;
std::vector<IncludeDirectoriesEntry> IncludeDirectoriesEntries; std::vector<cmValueWithOrigin> IncludeDirectoriesEntries;
// Track the value of the computed DEFINITIONS property. // Track the value of the computed DEFINITIONS property.
void AddDefineFlag(const char*, std::string&); void AddDefineFlag(const char*, std::string&);

View File

@ -1,28 +0,0 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2012 Stephen Kelly <steveire@gmail.com>
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#ifndef cmMakefileIncludeDirectoriesEntry_h
#define cmMakefileIncludeDirectoriesEntry_h
#include <string>
#include "cmListFileCache.h"
struct cmMakefileIncludeDirectoriesEntry {
cmMakefileIncludeDirectoriesEntry(const std::string &value,
const cmListFileBacktrace &bt)
: Value(value), Backtrace(bt)
{}
std::string Value;
cmListFileBacktrace Backtrace;
};
#endif

View File

@ -1496,10 +1496,10 @@ void cmTarget::SetMakefile(cmMakefile* mf)
// Initialize the INCLUDE_DIRECTORIES property based on the current value // Initialize the INCLUDE_DIRECTORIES property based on the current value
// of the same directory property: // of the same directory property:
const std::vector<cmMakefileIncludeDirectoriesEntry> parentIncludes = const std::vector<cmValueWithOrigin> parentIncludes =
this->Makefile->GetIncludeDirectoriesEntries(); this->Makefile->GetIncludeDirectoriesEntries();
for (std::vector<cmMakefileIncludeDirectoriesEntry>::const_iterator it for (std::vector<cmValueWithOrigin>::const_iterator it
= parentIncludes.begin(); it != parentIncludes.end(); ++it) = parentIncludes.begin(); it != parentIncludes.end(); ++it)
{ {
this->InsertInclude(*it); this->InsertInclude(*it);
@ -2743,7 +2743,7 @@ void cmTarget::AppendBuildInterfaceIncludes()
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmTarget::InsertInclude(const cmMakefileIncludeDirectoriesEntry &entry, void cmTarget::InsertInclude(const cmValueWithOrigin &entry,
bool before) bool before)
{ {
cmGeneratorExpression ge(entry.Backtrace); cmGeneratorExpression ge(entry.Backtrace);

View File

@ -15,7 +15,7 @@
#include "cmCustomCommand.h" #include "cmCustomCommand.h"
#include "cmPropertyMap.h" #include "cmPropertyMap.h"
#include "cmPolicies.h" #include "cmPolicies.h"
#include "cmMakefileIncludeDirectoriesEntry.h" #include "cmListFileCache.h"
#include <cmsys/auto_ptr.hxx> #include <cmsys/auto_ptr.hxx>
@ -493,7 +493,7 @@ public:
std::string GetFrameworkDirectory(const char* config = 0); std::string GetFrameworkDirectory(const char* config = 0);
std::vector<std::string> GetIncludeDirectories(const char *config); std::vector<std::string> GetIncludeDirectories(const char *config);
void InsertInclude(const cmMakefileIncludeDirectoriesEntry &entry, void InsertInclude(const cmValueWithOrigin &entry,
bool before = false); bool before = false);
void AppendBuildInterfaceIncludes(); void AppendBuildInterfaceIncludes();

View File

@ -11,8 +11,6 @@
============================================================================*/ ============================================================================*/
#include "cmTargetCompileDefinitionsCommand.h" #include "cmTargetCompileDefinitionsCommand.h"
#include "cmMakefileIncludeDirectoriesEntry.h"
bool cmTargetCompileDefinitionsCommand bool cmTargetCompileDefinitionsCommand
::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
{ {

View File

@ -11,8 +11,6 @@
============================================================================*/ ============================================================================*/
#include "cmTargetIncludeDirectoriesCommand.h" #include "cmTargetIncludeDirectoriesCommand.h"
#include "cmMakefileIncludeDirectoriesEntry.h"
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool cmTargetIncludeDirectoriesCommand bool cmTargetIncludeDirectoriesCommand
::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
@ -71,6 +69,6 @@ void cmTargetIncludeDirectoriesCommand
{ {
cmListFileBacktrace lfbt; cmListFileBacktrace lfbt;
this->Makefile->GetBacktrace(lfbt); this->Makefile->GetBacktrace(lfbt);
cmMakefileIncludeDirectoriesEntry entry(this->Join(content), lfbt); cmValueWithOrigin entry(this->Join(content), lfbt);
tgt->InsertInclude(entry, prepend); tgt->InsertInclude(entry, prepend);
} }