Merge topic 'cmRange-API'
8d336875
cmMakefile: Use Ranges for buildsystem property access.514a1dff
cmAlgorithms: Add some convenient typedefs.c7b39d06
cmMakefile: Split accessors for include directories and origins.b2de25ad
cmMakefile: Split accessors for compile options and origins.d6239507
cmMakefile: Split accessors for compile definitions and origins.ef17bbef
cmMakefile: Separate storage of buildsystem properties and their origins.a89c02ce
cmMakefile: Out of line some API.b19587e7
cmMakefile: Remove some references from APIs.1fe71e2e
cmAlgorithms: Move Range type out of private namespace.8ea0b81d
cmAlgorithms: Rename cmRange to cmMakeRange.
This commit is contained in:
commit
91a159245f
|
@ -122,35 +122,6 @@ struct DefaultDeleter<Range, /* valueTypeIsPair = */ true>
|
|||
}
|
||||
};
|
||||
|
||||
template<typename const_iterator_>
|
||||
struct Range
|
||||
{
|
||||
typedef const_iterator_ const_iterator;
|
||||
typedef typename std::iterator_traits<const_iterator>::value_type value_type;
|
||||
typedef typename std::iterator_traits<const_iterator>::difference_type
|
||||
difference_type;
|
||||
Range(const_iterator begin_, const_iterator end_)
|
||||
: Begin(begin_), End(end_) {}
|
||||
const_iterator begin() const { return Begin; }
|
||||
const_iterator end() const { return End; }
|
||||
bool empty() const { return std::distance(Begin, End) == 0; }
|
||||
difference_type size() const { return std::distance(Begin, End); }
|
||||
Range& advance(cmIML_INT_intptr_t amount)
|
||||
{
|
||||
std::advance(Begin, amount);
|
||||
return *this;
|
||||
}
|
||||
|
||||
Range& retreat(cmIML_INT_intptr_t amount)
|
||||
{
|
||||
std::advance(End, -amount);
|
||||
return *this;
|
||||
}
|
||||
private:
|
||||
const_iterator Begin;
|
||||
const_iterator End;
|
||||
};
|
||||
|
||||
template<typename FwdIt>
|
||||
FwdIt RemoveN(FwdIt i1, FwdIt i2, size_t n)
|
||||
{
|
||||
|
@ -178,17 +149,52 @@ private:
|
|||
|
||||
}
|
||||
|
||||
template<typename Iter1, typename Iter2>
|
||||
ContainerAlgorithms::Range<Iter1> cmRange(Iter1 begin, Iter2 end)
|
||||
template<typename const_iterator_>
|
||||
struct cmRange
|
||||
{
|
||||
return ContainerAlgorithms::Range<Iter1>(begin, end);
|
||||
typedef const_iterator_ const_iterator;
|
||||
typedef typename std::iterator_traits<const_iterator>::value_type value_type;
|
||||
typedef typename std::iterator_traits<const_iterator>::difference_type
|
||||
difference_type;
|
||||
cmRange(const_iterator begin_, const_iterator end_)
|
||||
: Begin(begin_), End(end_) {}
|
||||
const_iterator begin() const { return Begin; }
|
||||
const_iterator end() const { return End; }
|
||||
bool empty() const { return std::distance(Begin, End) == 0; }
|
||||
difference_type size() const { return std::distance(Begin, End); }
|
||||
cmRange& advance(cmIML_INT_intptr_t amount)
|
||||
{
|
||||
std::advance(Begin, amount);
|
||||
return *this;
|
||||
}
|
||||
|
||||
cmRange& retreat(cmIML_INT_intptr_t amount)
|
||||
{
|
||||
std::advance(End, -amount);
|
||||
return *this;
|
||||
}
|
||||
private:
|
||||
const_iterator Begin;
|
||||
const_iterator End;
|
||||
};
|
||||
|
||||
typedef cmRange<std::vector<std::string>::const_iterator> cmStringRange;
|
||||
|
||||
class cmListFileBacktrace;
|
||||
typedef
|
||||
cmRange<std::vector<cmListFileBacktrace>::const_iterator> cmBacktraceRange;
|
||||
|
||||
template<typename Iter1, typename Iter2>
|
||||
cmRange<Iter1> cmMakeRange(Iter1 begin, Iter2 end)
|
||||
{
|
||||
return cmRange<Iter1>(begin, end);
|
||||
}
|
||||
|
||||
template<typename Range>
|
||||
ContainerAlgorithms::Range<typename Range::const_iterator>
|
||||
cmRange(Range const& range)
|
||||
cmRange<typename Range::const_iterator>
|
||||
cmMakeRange(Range const& range)
|
||||
{
|
||||
return ContainerAlgorithms::Range<typename Range::const_iterator>(
|
||||
return cmRange<typename Range::const_iterator>(
|
||||
range.begin(), range.end());
|
||||
}
|
||||
|
||||
|
@ -350,10 +356,10 @@ typename Range::const_iterator cmFindNot(Range const& r, T const& t)
|
|||
}
|
||||
|
||||
template<typename Range>
|
||||
ContainerAlgorithms::Range<typename Range::const_reverse_iterator>
|
||||
cmRange<typename Range::const_reverse_iterator>
|
||||
cmReverseRange(Range const& range)
|
||||
{
|
||||
return ContainerAlgorithms::Range<typename Range::const_reverse_iterator>(
|
||||
return cmRange<typename Range::const_reverse_iterator>(
|
||||
range.rbegin(), range.rend());
|
||||
}
|
||||
|
||||
|
|
|
@ -270,7 +270,7 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args,
|
|||
this->SetError(error);
|
||||
return false;
|
||||
}
|
||||
std::string message = cmJoin(cmRange(i, args.end()), std::string());
|
||||
std::string message = cmJoin(cmMakeRange(i, args.end()), std::string());
|
||||
file << message;
|
||||
file.close();
|
||||
if(mode)
|
||||
|
|
|
@ -170,8 +170,8 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn)
|
|||
else
|
||||
{
|
||||
this->VariableDocumentation += "one of the ";
|
||||
this->VariableDocumentation += cmJoin(cmRange(this->Names).retreat(1),
|
||||
", ");
|
||||
this->VariableDocumentation +=
|
||||
cmJoin(cmMakeRange(this->Names).retreat(1), ", ");
|
||||
this->VariableDocumentation += " or "
|
||||
+ this->Names[this->Names.size() - 1] + " libraries be found";
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ bool cmFunctionHelperCommand::InvokeInitialPass
|
|||
std::string argvDef = cmJoin(expandedArgs, ";");
|
||||
std::vector<std::string>::const_iterator eit
|
||||
= expandedArgs.begin() + (this->Args.size()-1);
|
||||
std::string argnDef = cmJoin(cmRange(eit, expandedArgs.end()), ";");
|
||||
std::string argnDef = cmJoin(cmMakeRange(eit, expandedArgs.end()), ";");
|
||||
this->Makefile->AddDefinition("ARGV", argvDef.c_str());
|
||||
this->Makefile->MarkVariableAsUsed("ARGV");
|
||||
this->Makefile->AddDefinition("ARGN", argnDef.c_str());
|
||||
|
|
|
@ -1417,8 +1417,10 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
|
|||
{
|
||||
cmMakefile *mf = this->LocalGenerators[i]->GetMakefile();
|
||||
|
||||
const std::vector<cmValueWithOrigin> noconfig_compile_definitions =
|
||||
const cmStringRange noconfig_compile_definitions =
|
||||
mf->GetCompileDefinitionsEntries();
|
||||
const cmBacktraceRange noconfig_compile_definitions_bts =
|
||||
mf->GetCompileDefinitionsBacktraces();
|
||||
|
||||
cmTargets& targets = mf->GetTargets();
|
||||
for(cmTargets::iterator ti = targets.begin();
|
||||
|
@ -1433,11 +1435,13 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo()
|
|||
continue;
|
||||
}
|
||||
|
||||
for (std::vector<cmValueWithOrigin>::const_iterator it
|
||||
cmBacktraceRange::const_iterator btIt
|
||||
= noconfig_compile_definitions_bts.begin();
|
||||
for (cmStringRange::const_iterator it
|
||||
= noconfig_compile_definitions.begin();
|
||||
it != noconfig_compile_definitions.end(); ++it)
|
||||
it != noconfig_compile_definitions.end(); ++it, ++btIt)
|
||||
{
|
||||
t->InsertCompileDefinition(*it);
|
||||
t->InsertCompileDefinition(*it, *btIt);
|
||||
}
|
||||
|
||||
cmPolicies::PolicyStatus polSt
|
||||
|
|
|
@ -247,7 +247,7 @@ bool cmListCommand::HandleAppendCommand(std::vector<std::string> const& args)
|
|||
{
|
||||
listString += ";";
|
||||
}
|
||||
listString += cmJoin(cmRange(args).advance(2), ";");
|
||||
listString += cmJoin(cmMakeRange(args).advance(2), ";");
|
||||
|
||||
this->Makefile->AddDefinition(listName, listString.c_str());
|
||||
return true;
|
||||
|
@ -361,9 +361,9 @@ bool cmListCommand
|
|||
std::vector<std::string>::const_iterator remBegin = remove.begin();
|
||||
|
||||
std::vector<std::string>::const_iterator argsEnd =
|
||||
cmRemoveMatching(varArgsExpanded, cmRange(remBegin, remEnd));
|
||||
cmRemoveMatching(varArgsExpanded, cmMakeRange(remBegin, remEnd));
|
||||
std::vector<std::string>::const_iterator argsBegin = varArgsExpanded.begin();
|
||||
std::string value = cmJoin(cmRange(argsBegin, argsEnd), ";");
|
||||
std::string value = cmJoin(cmMakeRange(argsBegin, argsEnd), ";");
|
||||
this->Makefile->AddDefinition(listName, value.c_str());
|
||||
return true;
|
||||
}
|
||||
|
@ -421,7 +421,7 @@ bool cmListCommand
|
|||
cmRemoveDuplicates(varArgsExpanded);
|
||||
std::vector<std::string>::const_iterator argsBegin =
|
||||
varArgsExpanded.begin();
|
||||
std::string value = cmJoin(cmRange(argsBegin, argsEnd), ";");
|
||||
std::string value = cmJoin(cmMakeRange(argsBegin, argsEnd), ";");
|
||||
|
||||
this->Makefile->AddDefinition(listName, value.c_str());
|
||||
return true;
|
||||
|
@ -509,9 +509,9 @@ bool cmListCommand::HandleRemoveAtCommand(
|
|||
std::vector<size_t>::const_iterator remBegin = removed.begin();
|
||||
|
||||
std::vector<std::string>::const_iterator argsEnd =
|
||||
cmRemoveIndices(varArgsExpanded, cmRange(remBegin, remEnd));
|
||||
cmRemoveIndices(varArgsExpanded, cmMakeRange(remBegin, remEnd));
|
||||
std::vector<std::string>::const_iterator argsBegin = varArgsExpanded.begin();
|
||||
std::string value = cmJoin(cmRange(argsBegin, argsEnd), ";");
|
||||
std::string value = cmJoin(cmMakeRange(argsBegin, argsEnd), ";");
|
||||
|
||||
this->Makefile->AddDefinition(listName, value.c_str());
|
||||
return true;
|
||||
|
|
|
@ -2259,7 +2259,7 @@ cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p,
|
|||
std::string());
|
||||
std::vector<std::string>::const_iterator compStart
|
||||
= components.begin() + 1;
|
||||
result += cmJoin(cmRange(compStart, compEnd), slash);
|
||||
result += cmJoin(cmMakeRange(compStart, compEnd), slash);
|
||||
// Only the last component can be empty to avoid double slashes.
|
||||
result += slash;
|
||||
result += components.back();
|
||||
|
|
|
@ -107,7 +107,7 @@ bool cmMacroHelperCommand::InvokeInitialPass
|
|||
|
||||
std::vector<std::string>::const_iterator eit
|
||||
= expandedArgs.begin() + (this->Args.size() - 1);
|
||||
std::string expandedArgn = cmJoin(cmRange(eit, expandedArgs.end()), ";");
|
||||
std::string expandedArgn = cmJoin(cmMakeRange(eit, expandedArgs.end()), ";");
|
||||
std::string expandedArgv = cmJoin(expandedArgs, ";");
|
||||
std::vector<std::string> variables;
|
||||
variables.reserve(this->Args.size() - 1);
|
||||
|
|
|
@ -273,6 +273,36 @@ void cmMakefile::IssueMessage(cmake::MessageType t,
|
|||
}
|
||||
}
|
||||
|
||||
cmStringRange cmMakefile::GetIncludeDirectoriesEntries() const
|
||||
{
|
||||
return cmMakeRange(this->IncludeDirectoriesEntries);
|
||||
}
|
||||
|
||||
cmBacktraceRange cmMakefile::GetIncludeDirectoriesBacktraces() const
|
||||
{
|
||||
return cmMakeRange(this->IncludeDirectoriesEntryBacktraces);
|
||||
}
|
||||
|
||||
cmStringRange cmMakefile::GetCompileOptionsEntries() const
|
||||
{
|
||||
return cmMakeRange(this->CompileOptionsEntries);
|
||||
}
|
||||
|
||||
cmBacktraceRange cmMakefile::GetCompileOptionsBacktraces() const
|
||||
{
|
||||
return cmMakeRange(this->CompileOptionsEntryBacktraces);
|
||||
}
|
||||
|
||||
cmStringRange cmMakefile::GetCompileDefinitionsEntries() const
|
||||
{
|
||||
return cmMakeRange(this->CompileDefinitionsEntries);
|
||||
}
|
||||
|
||||
cmBacktraceRange cmMakefile::GetCompileDefinitionsBacktraces() const
|
||||
{
|
||||
return cmMakeRange(this->CompileDefinitionsEntryBacktraces);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
cmListFileBacktrace cmMakefile::GetBacktrace() const
|
||||
{
|
||||
|
@ -1427,7 +1457,7 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove)
|
|||
std::remove(defs.begin(), defs.end(), define);
|
||||
std::vector<std::string>::const_iterator defBegin =
|
||||
defs.begin();
|
||||
std::string ndefs = cmJoin(cmRange(defBegin, defEnd), ";");
|
||||
std::string ndefs = cmJoin(cmMakeRange(defBegin, defEnd), ";");
|
||||
|
||||
// Store the new list.
|
||||
this->SetProperty("COMPILE_DEFINITIONS", ndefs.c_str());
|
||||
|
@ -1527,23 +1557,32 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent)
|
|||
this->AddDefinition("CMAKE_CURRENT_BINARY_DIR",
|
||||
this->GetCurrentBinaryDirectory());
|
||||
|
||||
const std::vector<cmValueWithOrigin>& parentIncludes =
|
||||
parent->GetIncludeDirectoriesEntries();
|
||||
this->IncludeDirectoriesEntries.insert(this->IncludeDirectoriesEntries.end(),
|
||||
parentIncludes.begin(),
|
||||
parentIncludes.end());
|
||||
this->IncludeDirectoriesEntries.insert(
|
||||
this->IncludeDirectoriesEntries.end(),
|
||||
parent->IncludeDirectoriesEntries.begin(),
|
||||
parent->IncludeDirectoriesEntries.end());
|
||||
this->IncludeDirectoriesEntryBacktraces.insert(
|
||||
this->IncludeDirectoriesEntryBacktraces.end(),
|
||||
parent->IncludeDirectoriesEntryBacktraces.begin(),
|
||||
parent->IncludeDirectoriesEntryBacktraces.end());
|
||||
|
||||
const std::vector<cmValueWithOrigin>& parentOptions =
|
||||
parent->GetCompileOptionsEntries();
|
||||
this->CompileOptionsEntries.insert(this->CompileOptionsEntries.end(),
|
||||
parentOptions.begin(),
|
||||
parentOptions.end());
|
||||
this->CompileOptionsEntries.insert(
|
||||
this->CompileOptionsEntries.end(),
|
||||
parent->CompileOptionsEntries.begin(),
|
||||
parent->CompileOptionsEntries.end());
|
||||
this->CompileOptionsEntryBacktraces.insert(
|
||||
this->CompileOptionsEntryBacktraces.end(),
|
||||
parent->CompileOptionsEntryBacktraces.begin(),
|
||||
parent->CompileOptionsEntryBacktraces.end());
|
||||
|
||||
const std::vector<cmValueWithOrigin>& parentDefines =
|
||||
parent->GetCompileDefinitionsEntries();
|
||||
this->CompileDefinitionsEntries.insert(this->CompileDefinitionsEntries.end(),
|
||||
parentDefines.begin(),
|
||||
parentDefines.end());
|
||||
this->CompileDefinitionsEntries.insert(
|
||||
this->CompileDefinitionsEntries.end(),
|
||||
parent->CompileDefinitionsEntries.begin(),
|
||||
parent->CompileDefinitionsEntries.end());
|
||||
this->CompileDefinitionsEntryBacktraces.insert(
|
||||
this->CompileDefinitionsEntryBacktraces.end(),
|
||||
parent->CompileDefinitionsEntryBacktraces.begin(),
|
||||
parent->CompileDefinitionsEntryBacktraces.end());
|
||||
|
||||
this->SystemIncludeDirectories = parent->SystemIncludeDirectories;
|
||||
|
||||
|
@ -1887,20 +1926,24 @@ void cmMakefile::AddIncludeDirectories(const std::vector<std::string> &incs,
|
|||
return;
|
||||
}
|
||||
|
||||
std::vector<cmValueWithOrigin>::iterator position =
|
||||
std::vector<std::string>::iterator position =
|
||||
before ? this->IncludeDirectoriesEntries.begin()
|
||||
: this->IncludeDirectoriesEntries.end();
|
||||
std::vector<cmListFileBacktrace>::iterator btPos =
|
||||
this->IncludeDirectoriesEntryBacktraces.begin()
|
||||
+ std::distance(this->IncludeDirectoriesEntries.begin(), position);
|
||||
|
||||
cmListFileBacktrace lfbt = this->GetBacktrace();
|
||||
cmValueWithOrigin entry(cmJoin(incs, ";"), lfbt);
|
||||
this->IncludeDirectoriesEntries.insert(position, entry);
|
||||
std::string entryString = cmJoin(incs, ";");
|
||||
this->IncludeDirectoriesEntries.insert(position, entryString);
|
||||
this->IncludeDirectoriesEntryBacktraces.insert(btPos, lfbt);
|
||||
|
||||
// Property on each target:
|
||||
for (cmTargets::iterator l = this->Targets.begin();
|
||||
l != this->Targets.end(); ++l)
|
||||
{
|
||||
cmTarget &t = l->second;
|
||||
t.InsertInclude(entry, before);
|
||||
t.InsertInclude(entryString, lfbt, before);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4120,36 +4163,40 @@ void cmMakefile::SetProperty(const std::string& prop, const char* value)
|
|||
if (prop == "INCLUDE_DIRECTORIES")
|
||||
{
|
||||
this->IncludeDirectoriesEntries.clear();
|
||||
this->IncludeDirectoriesEntryBacktraces.clear();
|
||||
if (!value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
cmListFileBacktrace lfbt = this->GetBacktrace();
|
||||
this->IncludeDirectoriesEntries.push_back(
|
||||
cmValueWithOrigin(value, lfbt));
|
||||
this->IncludeDirectoriesEntries.push_back(value);
|
||||
this->IncludeDirectoriesEntryBacktraces.push_back(lfbt);
|
||||
return;
|
||||
}
|
||||
if (prop == "COMPILE_OPTIONS")
|
||||
{
|
||||
this->CompileOptionsEntries.clear();
|
||||
this->CompileDefinitionsEntryBacktraces.clear();
|
||||
if (!value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
cmListFileBacktrace lfbt = this->GetBacktrace();
|
||||
this->CompileOptionsEntries.push_back(cmValueWithOrigin(value, lfbt));
|
||||
this->CompileOptionsEntries.push_back(value);
|
||||
this->CompileOptionsEntryBacktraces.push_back(lfbt);
|
||||
return;
|
||||
}
|
||||
if (prop == "COMPILE_DEFINITIONS")
|
||||
{
|
||||
this->CompileDefinitionsEntries.clear();
|
||||
this->CompileDefinitionsEntryBacktraces.clear();
|
||||
if (!value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
cmListFileBacktrace lfbt = this->GetBacktrace();
|
||||
cmValueWithOrigin entry(value, lfbt);
|
||||
this->CompileDefinitionsEntries.push_back(entry);
|
||||
this->CompileDefinitionsEntries.push_back(value);
|
||||
this->CompileDefinitionsEntryBacktraces.push_back(lfbt);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4163,22 +4210,22 @@ void cmMakefile::AppendProperty(const std::string& prop,
|
|||
if (prop == "INCLUDE_DIRECTORIES")
|
||||
{
|
||||
cmListFileBacktrace lfbt = this->GetBacktrace();
|
||||
this->IncludeDirectoriesEntries.push_back(
|
||||
cmValueWithOrigin(value, lfbt));
|
||||
this->IncludeDirectoriesEntries.push_back(value);
|
||||
this->IncludeDirectoriesEntryBacktraces.push_back(lfbt);
|
||||
return;
|
||||
}
|
||||
if (prop == "COMPILE_OPTIONS")
|
||||
{
|
||||
cmListFileBacktrace lfbt = this->GetBacktrace();
|
||||
this->CompileOptionsEntries.push_back(
|
||||
cmValueWithOrigin(value, lfbt));
|
||||
this->CompileOptionsEntries.push_back(value);
|
||||
this->CompileOptionsEntryBacktraces.push_back(lfbt);
|
||||
return;
|
||||
}
|
||||
if (prop == "COMPILE_DEFINITIONS")
|
||||
{
|
||||
cmListFileBacktrace lfbt = this->GetBacktrace();
|
||||
this->CompileDefinitionsEntries.push_back(
|
||||
cmValueWithOrigin(value, lfbt));
|
||||
this->CompileDefinitionsEntries.push_back(value);
|
||||
this->CompileDefinitionsEntryBacktraces.push_back(lfbt);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4233,44 +4280,17 @@ const char *cmMakefile::GetProperty(const std::string& prop,
|
|||
}
|
||||
else if (prop == "INCLUDE_DIRECTORIES")
|
||||
{
|
||||
std::string sep;
|
||||
for (std::vector<cmValueWithOrigin>::const_iterator
|
||||
it = this->IncludeDirectoriesEntries.begin(),
|
||||
end = this->IncludeDirectoriesEntries.end();
|
||||
it != end; ++it)
|
||||
{
|
||||
output += sep;
|
||||
output += it->Value;
|
||||
sep = ";";
|
||||
}
|
||||
output = cmJoin(this->IncludeDirectoriesEntries, ";");
|
||||
return output.c_str();
|
||||
}
|
||||
else if (prop == "COMPILE_OPTIONS")
|
||||
{
|
||||
std::string sep;
|
||||
for (std::vector<cmValueWithOrigin>::const_iterator
|
||||
it = this->CompileOptionsEntries.begin(),
|
||||
end = this->CompileOptionsEntries.end();
|
||||
it != end; ++it)
|
||||
{
|
||||
output += sep;
|
||||
output += it->Value;
|
||||
sep = ";";
|
||||
}
|
||||
output = cmJoin(this->CompileOptionsEntries, ";");
|
||||
return output.c_str();
|
||||
}
|
||||
else if (prop == "COMPILE_DEFINITIONS")
|
||||
{
|
||||
std::string sep;
|
||||
for (std::vector<cmValueWithOrigin>::const_iterator
|
||||
it = this->CompileDefinitionsEntries.begin(),
|
||||
end = this->CompileDefinitionsEntries.end();
|
||||
it != end; ++it)
|
||||
{
|
||||
output += sep;
|
||||
output += it->Value;
|
||||
sep = ";";
|
||||
}
|
||||
output = cmJoin(this->CompileDefinitionsEntries, ";");
|
||||
return output.c_str();
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "cmExpandedCommandArgument.h"
|
||||
#include "cmake.h"
|
||||
#include "cmState.h"
|
||||
#include "cmAlgorithms.h"
|
||||
|
||||
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
||||
#include "cmSourceGroup.h"
|
||||
|
@ -746,18 +747,12 @@ public:
|
|||
/** Set whether or not to report a CMP0000 violation. */
|
||||
void SetCheckCMP0000(bool b) { this->CheckCMP0000 = b; }
|
||||
|
||||
const std::vector<cmValueWithOrigin>& GetIncludeDirectoriesEntries() const
|
||||
{
|
||||
return this->IncludeDirectoriesEntries;
|
||||
}
|
||||
const std::vector<cmValueWithOrigin>& GetCompileOptionsEntries() const
|
||||
{
|
||||
return this->CompileOptionsEntries;
|
||||
}
|
||||
const std::vector<cmValueWithOrigin>& GetCompileDefinitionsEntries() const
|
||||
{
|
||||
return this->CompileDefinitionsEntries;
|
||||
}
|
||||
cmStringRange GetIncludeDirectoriesEntries() const;
|
||||
cmBacktraceRange GetIncludeDirectoriesBacktraces() const;
|
||||
cmStringRange GetCompileOptionsEntries() const;
|
||||
cmBacktraceRange GetCompileOptionsBacktraces() const;
|
||||
cmStringRange GetCompileDefinitionsEntries() const;
|
||||
cmBacktraceRange GetCompileDefinitionsBacktraces() const;
|
||||
|
||||
bool IsConfigured() const { return this->Configured; }
|
||||
void SetConfigured(){ this->Configured = true; }
|
||||
|
@ -851,9 +846,12 @@ protected:
|
|||
std::vector<std::string> HeaderFileExtensions;
|
||||
std::string DefineFlags;
|
||||
|
||||
std::vector<cmValueWithOrigin> IncludeDirectoriesEntries;
|
||||
std::vector<cmValueWithOrigin> CompileOptionsEntries;
|
||||
std::vector<cmValueWithOrigin> CompileDefinitionsEntries;
|
||||
std::vector<std::string> IncludeDirectoriesEntries;
|
||||
std::vector<cmListFileBacktrace> IncludeDirectoriesEntryBacktraces;
|
||||
std::vector<std::string> CompileOptionsEntries;
|
||||
std::vector<cmListFileBacktrace> CompileOptionsEntryBacktraces;
|
||||
std::vector<std::string> CompileDefinitionsEntries;
|
||||
std::vector<cmListFileBacktrace> CompileDefinitionsEntryBacktraces;
|
||||
|
||||
// Track the value of the computed DEFINITIONS property.
|
||||
void AddDefineFlag(const char*, std::string&);
|
||||
|
|
|
@ -69,7 +69,7 @@ bool cmMessageCommand
|
|||
++i;
|
||||
}
|
||||
|
||||
std::string message = cmJoin(cmRange(i, args.end()), std::string());
|
||||
std::string message = cmJoin(cmMakeRange(i, args.end()), std::string());
|
||||
|
||||
if (type != cmake::MESSAGE)
|
||||
{
|
||||
|
|
|
@ -293,7 +293,7 @@ cmOutputConverter::ConvertToRelativePath(const std::vector<std::string>& local,
|
|||
{
|
||||
relative += "/";
|
||||
}
|
||||
relative += cmJoin(cmRange(remote).advance(common), "/");
|
||||
relative += cmJoin(cmMakeRange(remote).advance(common), "/");
|
||||
|
||||
// Finally return the path.
|
||||
return relative;
|
||||
|
|
|
@ -108,7 +108,7 @@ bool cmSetCommand
|
|||
}
|
||||
|
||||
// collect any values into a single semi-colon separated value list
|
||||
value = cmJoin(cmRange(args).advance(1).retreat(ignoreLastArgs), ";");
|
||||
value = cmJoin(cmMakeRange(args).advance(1).retreat(ignoreLastArgs), ";");
|
||||
|
||||
if (parentScope)
|
||||
{
|
||||
|
|
|
@ -319,7 +319,7 @@ bool cmStringCommand::RegexMatch(std::vector<std::string> const& args)
|
|||
}
|
||||
|
||||
// Concatenate all the last arguments together.
|
||||
std::string input = cmJoin(cmRange(args).advance(4), std::string());
|
||||
std::string input = cmJoin(cmMakeRange(args).advance(4), std::string());
|
||||
|
||||
// Scan through the input for all matches.
|
||||
std::string output;
|
||||
|
@ -365,7 +365,7 @@ bool cmStringCommand::RegexMatchAll(std::vector<std::string> const& args)
|
|||
}
|
||||
|
||||
// Concatenate all the last arguments together.
|
||||
std::string input = cmJoin(cmRange(args).advance(4), std::string());
|
||||
std::string input = cmJoin(cmMakeRange(args).advance(4), std::string());
|
||||
|
||||
// Scan through the input for all matches.
|
||||
std::string output;
|
||||
|
@ -465,7 +465,7 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args)
|
|||
}
|
||||
|
||||
// Concatenate all the last arguments together.
|
||||
std::string input = cmJoin(cmRange(args).advance(5), std::string());
|
||||
std::string input = cmJoin(cmMakeRange(args).advance(5), std::string());
|
||||
|
||||
// Scan through the input for all matches.
|
||||
std::string output;
|
||||
|
@ -665,7 +665,7 @@ bool cmStringCommand::HandleReplaceCommand(std::vector<std::string> const&
|
|||
const std::string& replaceExpression = args[2];
|
||||
const std::string& variableName = args[3];
|
||||
|
||||
std::string input = cmJoin(cmRange(args).advance(4), std::string());
|
||||
std::string input = cmJoin(cmMakeRange(args).advance(4), std::string());
|
||||
|
||||
cmsys::SystemTools::ReplaceString(input, matchExpression.c_str(),
|
||||
replaceExpression.c_str());
|
||||
|
@ -756,7 +756,7 @@ bool cmStringCommand::HandleAppendCommand(std::vector<std::string> const& args)
|
|||
{
|
||||
value = oldValue;
|
||||
}
|
||||
value += cmJoin(cmRange(args).advance(2), std::string());
|
||||
value += cmJoin(cmMakeRange(args).advance(2), std::string());
|
||||
this->Makefile->AddDefinition(variable, value.c_str());
|
||||
return true;
|
||||
}
|
||||
|
@ -772,7 +772,7 @@ bool cmStringCommand
|
|||
}
|
||||
|
||||
std::string const& variableName = args[1];
|
||||
std::string value = cmJoin(cmRange(args).advance(2), std::string());
|
||||
std::string value = cmJoin(cmMakeRange(args).advance(2), std::string());
|
||||
|
||||
this->Makefile->AddDefinition(variableName, value.c_str());
|
||||
return true;
|
||||
|
|
|
@ -402,13 +402,17 @@ void cmTarget::SetMakefile(cmMakefile* mf)
|
|||
{
|
||||
// Initialize the INCLUDE_DIRECTORIES property based on the current value
|
||||
// of the same directory property:
|
||||
const std::vector<cmValueWithOrigin> parentIncludes =
|
||||
this->Makefile->GetIncludeDirectoriesEntries();
|
||||
const cmStringRange parentIncludes =
|
||||
this->Makefile->GetIncludeDirectoriesEntries();
|
||||
const cmBacktraceRange parentIncludesBts =
|
||||
this->Makefile->GetIncludeDirectoriesBacktraces();
|
||||
|
||||
for (std::vector<cmValueWithOrigin>::const_iterator it
|
||||
= parentIncludes.begin(); it != parentIncludes.end(); ++it)
|
||||
cmBacktraceRange::const_iterator btIt = parentIncludesBts.begin();
|
||||
for (cmStringRange::const_iterator it
|
||||
= parentIncludes.begin();
|
||||
it != parentIncludes.end(); ++it, ++btIt)
|
||||
{
|
||||
this->InsertInclude(*it);
|
||||
this->InsertInclude(*it, *btIt);
|
||||
}
|
||||
const std::set<std::string> parentSystemIncludes =
|
||||
this->Makefile->GetSystemIncludeDirectories();
|
||||
|
@ -416,13 +420,17 @@ void cmTarget::SetMakefile(cmMakefile* mf)
|
|||
this->SystemIncludeDirectories.insert(parentSystemIncludes.begin(),
|
||||
parentSystemIncludes.end());
|
||||
|
||||
const std::vector<cmValueWithOrigin> parentOptions =
|
||||
const cmStringRange parentOptions =
|
||||
this->Makefile->GetCompileOptionsEntries();
|
||||
const cmBacktraceRange parentOptionsBts =
|
||||
this->Makefile->GetCompileOptionsBacktraces();
|
||||
|
||||
for (std::vector<cmValueWithOrigin>::const_iterator it
|
||||
= parentOptions.begin(); it != parentOptions.end(); ++it)
|
||||
btIt = parentOptionsBts.begin();
|
||||
for (cmStringRange::const_iterator it
|
||||
= parentOptions.begin();
|
||||
it != parentOptions.end(); ++it, ++btIt)
|
||||
{
|
||||
this->InsertCompileOption(*it);
|
||||
this->InsertCompileOption(*it, *btIt);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1926,40 +1934,43 @@ void cmTarget::AppendBuildInterfaceIncludes()
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmTarget::InsertInclude(const cmValueWithOrigin &entry,
|
||||
bool before)
|
||||
void cmTarget::InsertInclude(std::string const& entry,
|
||||
cmListFileBacktrace const& bt,
|
||||
bool before)
|
||||
{
|
||||
cmGeneratorExpression ge(entry.Backtrace);
|
||||
cmGeneratorExpression ge(bt);
|
||||
|
||||
std::vector<cmTargetInternals::TargetPropertyEntry*>::iterator position
|
||||
= before ? this->Internal->IncludeDirectoriesEntries.begin()
|
||||
: this->Internal->IncludeDirectoriesEntries.end();
|
||||
|
||||
this->Internal->IncludeDirectoriesEntries.insert(position,
|
||||
new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry.Value)));
|
||||
new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry)));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmTarget::InsertCompileOption(const cmValueWithOrigin &entry,
|
||||
bool before)
|
||||
void cmTarget::InsertCompileOption(std::string const& entry,
|
||||
cmListFileBacktrace const& bt,
|
||||
bool before)
|
||||
{
|
||||
cmGeneratorExpression ge(entry.Backtrace);
|
||||
cmGeneratorExpression ge(bt);
|
||||
|
||||
std::vector<cmTargetInternals::TargetPropertyEntry*>::iterator position
|
||||
= before ? this->Internal->CompileOptionsEntries.begin()
|
||||
: this->Internal->CompileOptionsEntries.end();
|
||||
|
||||
this->Internal->CompileOptionsEntries.insert(position,
|
||||
new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry.Value)));
|
||||
new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry)));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmTarget::InsertCompileDefinition(const cmValueWithOrigin &entry)
|
||||
void cmTarget::InsertCompileDefinition(std::string const& entry,
|
||||
cmListFileBacktrace const& bt)
|
||||
{
|
||||
cmGeneratorExpression ge(entry.Backtrace);
|
||||
cmGeneratorExpression ge(bt);
|
||||
|
||||
this->Internal->CompileDefinitionsEntries.push_back(
|
||||
new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry.Value)));
|
||||
new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry)));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -6686,7 +6697,7 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info,
|
|||
}
|
||||
std::sort(props.begin(), props.end());
|
||||
|
||||
std::string propsString = cmJoin(cmRange(props).retreat(1), ", ");
|
||||
std::string propsString = cmJoin(cmMakeRange(props).retreat(1), ", ");
|
||||
propsString += " and the " + props.back();
|
||||
|
||||
std::ostringstream e;
|
||||
|
|
|
@ -572,11 +572,14 @@ public:
|
|||
std::vector<std::string> GetIncludeDirectories(
|
||||
const std::string& config,
|
||||
const std::string& language) const;
|
||||
void InsertInclude(const cmValueWithOrigin &entry,
|
||||
void InsertInclude(std::string const& entry,
|
||||
cmListFileBacktrace const& bt,
|
||||
bool before = false);
|
||||
void InsertCompileOption(const cmValueWithOrigin &entry,
|
||||
bool before = false);
|
||||
void InsertCompileDefinition(const cmValueWithOrigin &entry);
|
||||
void InsertCompileOption(std::string const& entry,
|
||||
cmListFileBacktrace const& bt,
|
||||
bool before = false);
|
||||
void InsertCompileDefinition(std::string const& entry,
|
||||
cmListFileBacktrace const& bt);
|
||||
|
||||
void AppendBuildInterfaceIncludes();
|
||||
|
||||
|
|
|
@ -50,7 +50,6 @@ bool cmTargetCompileOptionsCommand
|
|||
bool, bool)
|
||||
{
|
||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||
cmValueWithOrigin entry(this->Join(content), lfbt);
|
||||
tgt->InsertCompileOption(entry);
|
||||
tgt->InsertCompileOption(this->Join(content), lfbt);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -72,8 +72,7 @@ bool cmTargetIncludeDirectoriesCommand
|
|||
bool prepend, bool system)
|
||||
{
|
||||
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
|
||||
cmValueWithOrigin entry(this->Join(content), lfbt);
|
||||
tgt->InsertInclude(entry, prepend);
|
||||
tgt->InsertInclude(this->Join(content), lfbt, prepend);
|
||||
if (system)
|
||||
{
|
||||
tgt->AddSystemIncludeDirectories(content);
|
||||
|
|
|
@ -335,14 +335,14 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
|
|||
// Echo string
|
||||
else if (args[1] == "echo" )
|
||||
{
|
||||
std::cout << cmJoin(cmRange(args).advance(2), " ") << std::endl;
|
||||
std::cout << cmJoin(cmMakeRange(args).advance(2), " ") << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Echo string no new line
|
||||
else if (args[1] == "echo_append" )
|
||||
{
|
||||
std::cout << cmJoin(cmRange(args).advance(2), " ");
|
||||
std::cout << cmJoin(cmMakeRange(args).advance(2), " ");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -511,7 +511,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
|
|||
// Clock command
|
||||
else if (args[1] == "time" && args.size() > 2)
|
||||
{
|
||||
std::string command = cmJoin(cmRange(args).advance(2), " ");
|
||||
std::string command = cmJoin(cmMakeRange(args).advance(2), " ");
|
||||
|
||||
clock_t clock_start, clock_finish;
|
||||
time_t time_start, time_finish;
|
||||
|
@ -572,7 +572,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
|
|||
return 1;
|
||||
}
|
||||
|
||||
std::string command = cmWrap('"', cmRange(args).advance(3), '"', " ");
|
||||
std::string command =
|
||||
cmWrap('"', cmMakeRange(args).advance(3), '"', " ");
|
||||
int retval = 0;
|
||||
int timeout = 0;
|
||||
if ( cmSystemTools::RunSingleCommand(command.c_str(), 0, 0, &retval,
|
||||
|
|
Loading…
Reference in New Issue