summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx57
1 files changed, 20 insertions, 37 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index dd4a8f8..7c83f27 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1947,14 +1947,13 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
// Write the library flags to the build rule.
fout << linkLibs;
- // Get the RPATH entries.
- std::vector<std::string> runtimeDirs;
- cli.GetRPath(runtimeDirs, relink);
-
// Check what kind of rpath flags to use.
if(cli.GetRuntimeSep().empty())
{
// Each rpath entry gets its own option ("-R a -R b -R c")
+ std::vector<std::string> runtimeDirs;
+ cli.GetRPath(runtimeDirs, relink);
+
std::string rpath;
for(std::vector<std::string>::iterator ri = runtimeDirs.begin();
ri != runtimeDirs.end(); ++ri)
@@ -2803,12 +2802,7 @@ std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source,
}
if(this->WindowsShell)
{
- std::string::size_type pos = 0;
- while((pos = result.find('/', pos)) != std::string::npos)
- {
- result[pos] = '\\';
- pos++;
- }
+ std::replace(result.begin(), result.end(), '/', '\\');
}
result = this->EscapeForShell(result, true, false, output == WATCOMQUOTE);
}
@@ -3013,14 +3007,12 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector<std::string>& local,
// trailing slash in the input then the last iteration of the loop
// will add a slash followed by an empty string which will preserve
// the trailing slash in the output.
- for(unsigned int i=common; i < remote.size(); ++i)
+
+ if(!relative.empty() && !remote.empty())
{
- if(!relative.empty())
- {
- relative += "/";
- }
- relative += remote[i];
+ relative += "/";
}
+ relative += cmJoin(cmRange(remote).advance(common), "/");
// Finally return the path.
return relative;
@@ -3206,11 +3198,7 @@ cmLocalGenerator
std::string ssin = sin;
// Avoid full paths by removing leading slashes.
- std::string::size_type pos = 0;
- for(;pos < ssin.size() && ssin[pos] == '/'; ++pos)
- {
- }
- ssin = ssin.substr(pos);
+ ssin.erase(0, ssin.find_first_not_of("/"));
// Avoid full paths by removing colons.
cmSystemTools::ReplaceString(ssin, ":", "_");
@@ -3647,26 +3635,21 @@ bool cmLocalGenerator::NeedBackwardsCompatibility_2_4()
bool cmLocalGenerator::CheckDefinition(std::string const& define) const
{
// Many compilers do not support -DNAME(arg)=sdf so we disable it.
- bool function_style = false;
- for(const char* c = define.c_str(); *c && *c != '='; ++c)
+ std::string::size_type pos = define.find_first_of("(=");
+ if (pos != std::string::npos)
{
- if(*c == '(')
+ if (define[pos] == '(')
{
- function_style = true;
- break;
+ std::ostringstream e;
+ e << "WARNING: Function-style preprocessor definitions may not be "
+ << "passed on the compiler command line because many compilers "
+ << "do not support it.\n"
+ << "CMake is dropping a preprocessor definition: " << define << "\n"
+ << "Consider defining the macro in a (configured) header file.\n";
+ cmSystemTools::Message(e.str().c_str());
+ return false;
}
}
- if(function_style)
- {
- std::ostringstream e;
- e << "WARNING: Function-style preprocessor definitions may not be "
- << "passed on the compiler command line because many compilers "
- << "do not support it.\n"
- << "CMake is dropping a preprocessor definition: " << define << "\n"
- << "Consider defining the macro in a (configured) header file.\n";
- cmSystemTools::Message(e.str().c_str());
- return false;
- }
// Many compilers do not support # in the value so we disable it.
if(define.find_first_of("#") != define.npos)