mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
Merge topic 'use-cmRange'
7c3f6376Convert loop into two algorithms.8a399c8cConvert loop to the common pattern.abfca975Move loop inside of condition.0b61b86dHandle last element outside of the loop.e21f7829cmTarget: Use a sorted vector in place of a set.559dc155cmSet: Replace loop with cmJoin.0ea71932cmFindBase: Replace loop with cmJoin on range.9380e85fConvert loops to cmJoin algorithm with cmRange.bb10012fcmStringCommand: Accumulate with cmJoin and range adaptors.0c12f1eacmAlgorithms: Add a range adaptor and API for adjusting a range.27c6f017Use cmJoin to accumulate string ranges.4e78ebbdcmAlgorithms: Add a Range container and adaptor method.89102249Replace common loop pattern with cmJoin7b8725bfConvert loops populating maybe-empty content into the common pattern.7ee56f03Convert loops into the commonly used pattern.0a4e5674cmMacroCommand: Remove counting variable. ...
This commit is contained in:
@@ -2295,21 +2295,19 @@ cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p,
|
||||
// Begin the quoted result with the root component.
|
||||
result += components[0];
|
||||
|
||||
// Now add the rest of the components separated by the proper slash
|
||||
// direction for this platform.
|
||||
bool first = true;
|
||||
for(unsigned int i=1; i < components.size(); ++i)
|
||||
if (components.size() > 1)
|
||||
{
|
||||
// Now add the rest of the components separated by the proper slash
|
||||
// direction for this platform.
|
||||
std::vector<std::string>::const_iterator compEnd
|
||||
= std::remove(components.begin() + 1, components.end() - 1,
|
||||
std::string());
|
||||
std::vector<std::string>::const_iterator compStart
|
||||
= components.begin() + 1;
|
||||
result += cmJoin(cmRange(compStart, compEnd), slash);
|
||||
// Only the last component can be empty to avoid double slashes.
|
||||
if(!components[i].empty() || (i == (components.size()-1)))
|
||||
{
|
||||
if(!first)
|
||||
{
|
||||
result += slash;
|
||||
}
|
||||
result += components[i];
|
||||
first = false;
|
||||
}
|
||||
result += slash;
|
||||
result += components.back();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user