diff options
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 97 |
1 files changed, 53 insertions, 44 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 50e279b..7b54b88 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -79,9 +79,15 @@ public: this->GG = lg->GetGlobalGenerator(); this->LG = this->GG->GetCurrentLocalGenerator(); this->GG->SetCurrentLocalGenerator(lg); +#if defined(CMAKE_BUILD_WITH_CMAKE) + this->GG->GetFileLockPool().PushFileScope(); +#endif } ~cmLocalGeneratorCurrent() { +#if defined(CMAKE_BUILD_WITH_CMAKE) + this->GG->GetFileLockPool().PopFileScope(); +#endif this->GG->SetCurrentLocalGenerator(this->LG); } }; @@ -147,7 +153,7 @@ void cmLocalGenerator::ComputeObjectMaxPath() } else { - cmOStringStream w; + std::ostringstream w; w << "CMAKE_OBJECT_PATH_MAX is set to " << pmax << ", which is less than the minimum of 128. " << "The value will be ignored."; @@ -156,7 +162,7 @@ void cmLocalGenerator::ComputeObjectMaxPath() } else { - cmOStringStream w; + std::ostringstream w; w << "CMAKE_OBJECT_PATH_MAX is set to \"" << plen << "\", which fails to parse as a positive integer. " << "The value will be ignored."; @@ -185,7 +191,7 @@ void cmLocalGenerator::ReadInputFile() // The file is missing. Check policy CMP0014. cmMakefile* mf = this->Parent->GetMakefile(); - cmOStringStream e; + std::ostringstream e; e << "The source directory\n" << " " << this->Makefile->GetStartDirectory() << "\n" << "does not contain a CMakeLists.txt file."; @@ -221,19 +227,19 @@ void cmLocalGenerator::SetupPathConversions() std::string outdir; outdir = cmSystemTools::CollapseFullPath(this->Makefile->GetHomeDirectory()); - cmSystemTools::SplitPath(outdir.c_str(), this->HomeDirectoryComponents); + cmSystemTools::SplitPath(outdir, this->HomeDirectoryComponents); outdir = cmSystemTools::CollapseFullPath(this->Makefile->GetStartDirectory()); - cmSystemTools::SplitPath(outdir.c_str(), this->StartDirectoryComponents); + cmSystemTools::SplitPath(outdir, this->StartDirectoryComponents); outdir = cmSystemTools::CollapseFullPath (this->Makefile->GetHomeOutputDirectory()); - cmSystemTools::SplitPath(outdir.c_str(), + cmSystemTools::SplitPath(outdir, this->HomeOutputDirectoryComponents); outdir = cmSystemTools::CollapseFullPath (this->Makefile->GetStartOutputDirectory()); - cmSystemTools::SplitPath(outdir.c_str(), + cmSystemTools::SplitPath(outdir, this->StartOutputDirectoryComponents); } @@ -259,6 +265,17 @@ void cmLocalGenerator::ConfigureFinalPass() void cmLocalGenerator::TraceDependencies() { + std::vector<std::string> configs; + this->Makefile->GetConfigurations(configs); + if (configs.empty()) + { + configs.push_back(""); + } + for(std::vector<std::string>::const_iterator ci = configs.begin(); + ci != configs.end(); ++ci) + { + this->GlobalGenerator->CreateEvaluationSourceFiles(*ci); + } // Generate the rule files for each target. cmGeneratorTargetsType targets = this->Makefile->GetGeneratorTargets(); for(cmGeneratorTargetsType::iterator t = targets.begin(); @@ -617,11 +634,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, // Parse the string to get the custom command line. cmCustomCommandLine commandLine; std::vector<std::string> cmd = cmSystemTools::ParseArguments(i->c_str()); - for(std::vector<std::string>::iterator a = cmd.begin(); - a != cmd.end(); ++a) - { - commandLine.push_back(*a); - } + commandLine.insert(commandLine.end(), cmd.begin(), cmd.end()); // Store this command line. commandLines.push_back(commandLine); @@ -728,11 +741,7 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, // Parse the string to get the custom command line. cmCustomCommandLine commandLine; std::vector<std::string> cmd = cmSystemTools::ParseArguments(i->c_str()); - for(std::vector<std::string>::iterator a = cmd.begin(); - a != cmd.end(); ++a) - { - commandLine.push_back(*a); - } + commandLine.insert(commandLine.end(), cmd.begin(), cmd.end()); // Store this command line. commandLines.push_back(commandLine); @@ -1228,7 +1237,7 @@ void cmLocalGenerator::InsertRuleLauncher(std::string& s, cmTarget* target, { if(const char* val = this->GetRuleLauncher(target, prop)) { - cmOStringStream wrapped; + std::ostringstream wrapped; wrapped << val << " " << s; s = wrapped.str(); } @@ -1247,7 +1256,7 @@ cmLocalGenerator::ConvertToOutputForExistingCommon(const std::string& remote, cmSystemTools::FileExists(remote.c_str())) { std::string tmp; - if(cmSystemTools::GetShortPath(remote.c_str(), tmp)) + if(cmSystemTools::GetShortPath(remote, tmp)) { return this->Convert(tmp, NONE, format, true); } @@ -1309,7 +1318,7 @@ std::string cmLocalGenerator::GetIncludeFlags( } OutputFormat shellFormat = forResponseFile? RESPONSE : SHELL; - cmOStringStream includeFlags; + std::ostringstream includeFlags; std::string flagVar = "CMAKE_INCLUDE_FLAG_"; flagVar += lang; @@ -1371,7 +1380,7 @@ std::string cmLocalGenerator::GetIncludeFlags( { std::string frameworkDir = *i; frameworkDir += "/../"; - frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir.c_str()); + frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir); if(emitted.insert(frameworkDir).second) { if (sysFwSearchFlag && target && @@ -1504,7 +1513,7 @@ void cmLocalGenerator::AddCompileOptions( } if (this->Makefile->IsLaterStandard(it->first, standard, it->second)) { - cmOStringStream e; + std::ostringstream e; e << "The COMPILE_FEATURES property of target \"" << target->GetName() << "\" was evaluated when computing the link " "implementation, and the \"" << it->first << "_STANDARD\" was \"" @@ -1613,10 +1622,10 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs, { // Emit this directory only if it is a subdirectory of the // top-level source or binary tree. - if(cmSystemTools::ComparePath(i->c_str(), topSourceDir) || - cmSystemTools::ComparePath(i->c_str(), topBinaryDir) || - cmSystemTools::IsSubDirectory(i->c_str(), topSourceDir) || - cmSystemTools::IsSubDirectory(i->c_str(), topBinaryDir)) + if(cmSystemTools::ComparePath(*i, topSourceDir) || + cmSystemTools::ComparePath(*i, topBinaryDir) || + cmSystemTools::IsSubDirectory(*i, topSourceDir) || + cmSystemTools::IsSubDirectory(*i, topBinaryDir)) { if(emitted.insert(*i).second) { @@ -1863,7 +1872,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, OutputFormat shellFormat = (forResponseFile) ? RESPONSE : ((useWatcomQuote) ? WATCOMQUOTE : SHELL); bool escapeAllowMakeVars = !forResponseFile; - cmOStringStream fout; + std::ostringstream fout; std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); cmComputeLinkInformation* pcli = tgt.Target->GetLinkInformation(config); if(!pcli) @@ -2109,11 +2118,11 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName, { tLocation = target->GetLocation(config); tLocation = cmSystemTools::GetFilenamePath(tLocation); - tLocation = cmSystemTools::CollapseFullPath(tLocation.c_str()); + tLocation = cmSystemTools::CollapseFullPath(tLocation); } std::string depLocation = cmSystemTools::GetFilenamePath( std::string(inName)); - depLocation = cmSystemTools::CollapseFullPath(depLocation.c_str()); + depLocation = cmSystemTools::CollapseFullPath(depLocation); if(depLocation != tLocation) { // it is a full path to a depend that has the same name @@ -2225,7 +2234,7 @@ AddCompilerRequirementFlag(std::string &flags, cmTarget* target, const char *opt = target->GetMakefile()->GetDefinition(option_flag); if (!opt) { - cmOStringStream e; + std::ostringstream e; e << "Target \"" << target->GetName() << "\" requires the language " "dialect \"" << lang << standardProp << "\" " << (ext ? "(with compiler extensions)" : "") << ", but CMake " @@ -2310,7 +2319,7 @@ static void AddVisibilityCompileOption(std::string &flags, cmTarget* target, && strcmp(prop, "protected") != 0 && strcmp(prop, "internal") != 0 ) { - cmOStringStream e; + std::ostringstream e; e << "Target " << target->GetName() << " uses unsupported value \"" << prop << "\" for " << flagDefine << "."; cmSystemTools::Error(e.str().c_str()); @@ -2425,7 +2434,7 @@ bool cmLocalGenerator::GetShouldUseOldFlags(bool shared, { case cmPolicies::WARN: { - cmOStringStream e; + std::ostringstream e; e << "Variable " << flagsVar << " has been modified. CMake " "will ignore the POSITION_INDEPENDENT_CODE target property for " "shared libraries and will use the " << flagsVar << " variable " @@ -2743,7 +2752,7 @@ std::string cmLocalGenerator::Convert(const std::string& source, result); break; case FULL: - result = cmSystemTools::CollapseFullPath(result.c_str()); + result = cmSystemTools::CollapseFullPath(result); break; case NONE: break; @@ -2807,7 +2816,7 @@ std::string cmLocalGenerator::Convert(RelativeRoot remote, if(!local.empty() && (!optional || this->UseRelativePaths)) { std::vector<std::string> components; - cmSystemTools::SplitPath(local.c_str(), components); + cmSystemTools::SplitPath(local, components); std::string result = this->ConvertToRelativePath(components, remotePath); return this->ConvertToOutputFormat(result, output); } @@ -2827,7 +2836,7 @@ std::string cmLocalGenerator::FindRelativePathTopSource() { std::string parentTop = parent->FindRelativePathTopSource(); if(cmSystemTools::IsSubDirectory( - this->Makefile->GetStartDirectory(), parentTop.c_str())) + this->Makefile->GetStartDirectory(), parentTop)) { return parentTop; } @@ -2847,7 +2856,7 @@ std::string cmLocalGenerator::FindRelativePathTopBinary() { std::string parentTop = parent->FindRelativePathTopBinary(); if(cmSystemTools::IsSubDirectory( - this->Makefile->GetStartOutputDirectory(), parentTop.c_str())) + this->Makefile->GetStartOutputDirectory(), parentTop)) { return parentTop; } @@ -2933,12 +2942,12 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector<std::string>& local, // Identify the longest shared path component between the remote // path and the local path. std::vector<std::string> remote; - cmSystemTools::SplitPath(in_remote.c_str(), remote); + cmSystemTools::SplitPath(in_remote, remote); unsigned int common=0; while(common < remote.size() && common < local.size() && - cmSystemTools::ComparePath(remote[common].c_str(), - local[common].c_str())) + cmSystemTools::ComparePath(remote[common], + local[common])) { ++common; } @@ -3234,7 +3243,7 @@ cmLocalGenerator // Warn if this is the first time the path has been seen. if(this->ObjectMaxPathViolations.insert(dir_max).second) { - cmOStringStream m; + std::ostringstream m; m << "The object file directory\n" << " " << dir_max << "\n" << "has " << dir_max.size() << " characters. " @@ -3632,7 +3641,7 @@ bool cmLocalGenerator::CheckDefinition(std::string const& define) const } if(function_style) { - cmOStringStream e; + 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" @@ -3645,7 +3654,7 @@ bool cmLocalGenerator::CheckDefinition(std::string const& define) const // Many compilers do not support # in the value so we disable it. if(define.find_first_of("#") != define.npos) { - cmOStringStream e; + std::ostringstream e; e << "WARNING: Preprocessor definitions containing '#' may not be " << "passed on the compiler command line because many compilers " << "do not support it.\n" @@ -3687,7 +3696,7 @@ void cmLocalGenerator::GenerateAppleInfoPList(cmTarget* target, } if(!cmSystemTools::FileExists(inFile.c_str(), true)) { - cmOStringStream e; + std::ostringstream e; e << "Target " << target->GetName() << " Info.plist template \"" << inFile << "\" could not be found."; cmSystemTools::Error(e.str().c_str()); @@ -3731,7 +3740,7 @@ void cmLocalGenerator::GenerateFrameworkInfoPList(cmTarget* target, } if(!cmSystemTools::FileExists(inFile.c_str(), true)) { - cmOStringStream e; + std::ostringstream e; e << "Target " << target->GetName() << " Info.plist template \"" << inFile << "\" could not be found."; cmSystemTools::Error(e.str().c_str()); |