diff options
157 files changed, 1384 insertions, 1384 deletions
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index 0162d55..9ae5839 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -506,7 +506,7 @@ int cmCPackDebGenerator::createDeb() controlExtraList.begin(); i != controlExtraList.end(); ++i) { std::string filenamename = - cmsys::SystemTools::GetFilenameName(i->c_str()); + cmsys::SystemTools::GetFilenameName(*i); std::string localcopy = this->GetOption("WDIR"); localcopy += "/"; localcopy += filenamename; @@ -588,9 +588,9 @@ std::string cmCPackDebGenerator::GetComponentInstallDirNameSuffix( // the current COMPONENT belongs to. std::string groupVar = "CPACK_COMPONENT_" + cmSystemTools::UpperCase(componentName) + "_GROUP"; - if (NULL != GetOption(groupVar.c_str())) + if (NULL != GetOption(groupVar)) { - return std::string(GetOption(groupVar.c_str())); + return std::string(GetOption(groupVar)); } else { diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 3915b31..cf514aa 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -357,9 +357,9 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( std::list<std::pair<std::string,std::string> > symlinkedFiles; cmCPackLogger(cmCPackLog::LOG_DEBUG, "Find files" << std::endl); cmsys::Glob gl; - std::string top = it->c_str(); + std::string top = *it; it ++; - std::string subdir = it->c_str(); + std::string subdir = *it; std::string findExpr = top; findExpr += "/*"; cmCPackLogger(cmCPackLog::LOG_OUTPUT, @@ -473,7 +473,7 @@ int cmCPackGenerator::InstallProjectViaInstallScript( it != cmakeScriptsVector.end(); ++it ) { - std::string installScript = it->c_str(); + std::string installScript = *it; cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Install script: " << installScript << std::endl); @@ -562,13 +562,13 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( << std::endl); return 0; } - std::string installDirectory = it->c_str(); + std::string installDirectory = *it; ++it; - std::string installProjectName = it->c_str(); + std::string installProjectName = *it; ++it; - std::string installComponent = it->c_str(); + std::string installComponent = *it; ++it; - std::string installSubDirectory = it->c_str(); + std::string installSubDirectory = *it; std::string installFile = installDirectory + "/cmake_install.cmake"; std::vector<std::string> componentsVector; @@ -586,7 +586,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( // Determine the installation types for this project (if provided). std::string installTypesVar = "CPACK_" + cmSystemTools::UpperCase(installComponent) + "_INSTALL_TYPES"; - const char *installTypes = this->GetOption(installTypesVar.c_str()); + const char *installTypes = this->GetOption(installTypesVar); if (installTypes && *installTypes) { std::vector<std::string> installTypesVector; @@ -596,15 +596,15 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( installTypeIt != installTypesVector.end(); ++installTypeIt) { - this->GetInstallationType(installProjectName.c_str(), - installTypeIt->c_str()); + this->GetInstallationType(installProjectName, + *installTypeIt); } } // Determine the set of components that will be used in this project std::string componentsVar = "CPACK_COMPONENTS_" + cmSystemTools::UpperCase(installComponent); - const char *components = this->GetOption(componentsVar.c_str()); + const char *components = this->GetOption(componentsVar); if (components && *components) { cmSystemTools::ExpandListArgument(components, componentsVector); @@ -613,7 +613,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( compIt != componentsVector.end(); ++compIt) { - GetComponent(installProjectName.c_str(), compIt->c_str()); + GetComponent(installProjectName, *compIt); } componentInstall = true; } @@ -641,7 +641,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( = this->MakefileMap->GetDefinition("CMAKE_MAKE_PROGRAM"); std::vector<std::string> buildCommand; globalGenerator->GenerateBuildCommand(buildCommand, cmakeMakeProgram, - installProjectName.c_str(), installDirectory.c_str(), + installProjectName, installDirectory, globalGenerator->GetPreinstallTargetName(), buildConfig, false); std::string buildCommandStr = @@ -932,19 +932,19 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( std::string absoluteDestFileComponent = std::string("CPACK_ABSOLUTE_DESTINATION_FILES") + "_" + GetComponentInstallDirNameSuffix(installComponent); - if (NULL != this->GetOption(absoluteDestFileComponent.c_str())) + if (NULL != this->GetOption(absoluteDestFileComponent)) { std::string absoluteDestFilesListComponent = - this->GetOption(absoluteDestFileComponent.c_str()); + this->GetOption(absoluteDestFileComponent); absoluteDestFilesListComponent +=";"; absoluteDestFilesListComponent += mf->GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES"); - this->SetOption(absoluteDestFileComponent.c_str(), + this->SetOption(absoluteDestFileComponent, absoluteDestFilesListComponent.c_str()); } else { - this->SetOption(absoluteDestFileComponent.c_str(), + this->SetOption(absoluteDestFileComponent, mf->GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES")); } } @@ -1428,14 +1428,14 @@ std::string cmCPackGenerator::GetComponentPackageFileName( std::string suffix="-"+groupOrComponentName; /* check if we should use DISPLAY name */ std::string dispNameVar = "CPACK_"+Name+"_USE_DISPLAY_NAME_IN_FILENAME"; - if (IsOn(dispNameVar.c_str())) + if (IsOn(dispNameVar)) { /* the component Group case */ if (isGroupName) { std::string groupDispVar = "CPACK_COMPONENT_GROUP_" + cmSystemTools::UpperCase(groupOrComponentName) + "_DISPLAY_NAME"; - const char* groupDispName = GetOption(groupDispVar.c_str()); + const char* groupDispName = GetOption(groupDispVar); if (groupDispName) { suffix = "-"+std::string(groupDispName); @@ -1446,7 +1446,7 @@ std::string cmCPackGenerator::GetComponentPackageFileName( { std::string dispVar = "CPACK_COMPONENT_" + cmSystemTools::UpperCase(groupOrComponentName) + "_DISPLAY_NAME"; - const char* dispName = GetOption(dispVar.c_str()); + const char* dispName = GetOption(dispVar); if(dispName) { suffix = "-"+std::string(dispName); @@ -1497,7 +1497,7 @@ cmCPackGenerator::GetInstallationType(const std::string& projectName, installType->Name = name; const char* displayName - = this->GetOption((macroPrefix + "_DISPLAY_NAME").c_str()); + = this->GetOption(macroPrefix + "_DISPLAY_NAME"); if (displayName && *displayName) { installType->DisplayName = displayName; @@ -1527,7 +1527,7 @@ cmCPackGenerator::GetComponent(const std::string& projectName, + cmsys::SystemTools::UpperCase(name); component->Name = name; const char* displayName - = this->GetOption((macroPrefix + "_DISPLAY_NAME").c_str()); + = this->GetOption(macroPrefix + "_DISPLAY_NAME"); if (displayName && *displayName) { component->DisplayName = displayName; @@ -1537,23 +1537,23 @@ cmCPackGenerator::GetComponent(const std::string& projectName, component->DisplayName = component->Name; } component->IsHidden - = this->IsOn((macroPrefix + "_HIDDEN").c_str()); + = this->IsOn(macroPrefix + "_HIDDEN"); component->IsRequired - = this->IsOn((macroPrefix + "_REQUIRED").c_str()); + = this->IsOn(macroPrefix + "_REQUIRED"); component->IsDisabledByDefault - = this->IsOn((macroPrefix + "_DISABLED").c_str()); + = this->IsOn(macroPrefix + "_DISABLED"); component->IsDownloaded - = this->IsOn((macroPrefix + "_DOWNLOADED").c_str()) + = this->IsOn(macroPrefix + "_DOWNLOADED") || cmSystemTools::IsOn(this->GetOption("CPACK_DOWNLOAD_ALL")); - const char* archiveFile = this->GetOption((macroPrefix + - "_ARCHIVE_FILE").c_str()); + const char* archiveFile = this->GetOption(macroPrefix + + "_ARCHIVE_FILE"); if (archiveFile && *archiveFile) { component->ArchiveFile = archiveFile; } - const char* groupName = this->GetOption((macroPrefix + "_GROUP").c_str()); + const char* groupName = this->GetOption(macroPrefix + "_GROUP"); if (groupName && *groupName) { component->Group = GetComponentGroup(projectName, groupName); @@ -1565,7 +1565,7 @@ cmCPackGenerator::GetComponent(const std::string& projectName, } const char* description - = this->GetOption((macroPrefix + "_DESCRIPTION").c_str()); + = this->GetOption(macroPrefix + "_DESCRIPTION"); if (description && *description) { component->Description = description; @@ -1573,7 +1573,7 @@ cmCPackGenerator::GetComponent(const std::string& projectName, // Determine the installation types. const char *installTypes - = this->GetOption((macroPrefix + "_INSTALL_TYPES").c_str()); + = this->GetOption(macroPrefix + "_INSTALL_TYPES"); if (installTypes && *installTypes) { std::vector<std::string> installTypesVector; @@ -1589,7 +1589,7 @@ cmCPackGenerator::GetComponent(const std::string& projectName, } // Determine the component dependencies. - const char *depends = this->GetOption((macroPrefix + "_DEPENDS").c_str()); + const char *depends = this->GetOption(macroPrefix + "_DEPENDS"); if (depends && *depends) { std::vector<std::string> dependsVector; @@ -1600,7 +1600,7 @@ cmCPackGenerator::GetComponent(const std::string& projectName, ++dependIt) { cmCPackComponent *child = GetComponent(projectName, - dependIt->c_str()); + *dependIt); component->Dependencies.push_back(child); child->ReverseDependencies.push_back(component); } @@ -1624,7 +1624,7 @@ cmCPackGenerator::GetComponentGroup(const std::string& projectName, // Define the group group->Name = name; const char* displayName - = this->GetOption((macroPrefix + "_DISPLAY_NAME").c_str()); + = this->GetOption(macroPrefix + "_DISPLAY_NAME"); if (displayName && *displayName) { group->DisplayName = displayName; @@ -1635,17 +1635,17 @@ cmCPackGenerator::GetComponentGroup(const std::string& projectName, } const char* description - = this->GetOption((macroPrefix + "_DESCRIPTION").c_str()); + = this->GetOption(macroPrefix + "_DESCRIPTION"); if (description && *description) { group->Description = description; } group->IsBold - = this->IsOn((macroPrefix + "_BOLD_TITLE").c_str()); + = this->IsOn(macroPrefix + "_BOLD_TITLE"); group->IsExpandedByDefault - = this->IsOn((macroPrefix + "_EXPANDED").c_str()); + = this->IsOn(macroPrefix + "_EXPANDED"); const char* parentGroupName - = this->GetOption((macroPrefix + "_PARENT_GROUP").c_str()); + = this->GetOption(macroPrefix + "_PARENT_GROUP"); if (parentGroupName && *parentGroupName) { group->ParentGroup = GetComponentGroup(projectName, parentGroupName); diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index 62bfa91..f433834 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -629,7 +629,7 @@ void cmCPackNSISGenerator::CreateMenuLinks( cmOStringStream& str, // if so add a desktop link std::string desktop = "CPACK_CREATE_DESKTOP_LINK_"; desktop += linkName; - if(this->IsSet(desktop.c_str())) + if(this->IsSet(desktop)) { str << " StrCmp \"$INSTALL_DESKTOP\" \"1\" 0 +2\n"; str << " CreateShortCut \"$DESKTOP\\" diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx index 66a4194..c6171dc 100644 --- a/Source/CPack/cmCPackRPMGenerator.cxx +++ b/Source/CPack/cmCPackRPMGenerator.cxx @@ -272,9 +272,9 @@ std::string cmCPackRPMGenerator::GetComponentInstallDirNameSuffix( // the current COMPONENT belongs to. std::string groupVar = "CPACK_COMPONENT_" + cmSystemTools::UpperCase(componentName) + "_GROUP"; - if (NULL != GetOption(groupVar.c_str())) + if (NULL != GetOption(groupVar)) { - return std::string(GetOption(groupVar.c_str())); + return std::string(GetOption(groupVar)); } else { diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index d74c38d..d1a16f0 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -326,7 +326,7 @@ int main (int argc, char const* const* argv) cdit != definitions.Map.end(); ++cdit ) { - globalMF->AddDefinition(cdit->first.c_str(), cdit->second.c_str()); + globalMF->AddDefinition(cdit->first, cdit->second.c_str()); } const char* cpackModulesPath = diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index 0fac136..4a3eec5 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -241,11 +241,11 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) { // Make the generator available for the Build call below. cm.SetGlobalGenerator(cm.CreateGlobalGenerator( - this->BuildGenerator.c_str())); + this->BuildGenerator)); cm.SetGeneratorToolset(this->BuildGeneratorToolset); // Load the cache to make CMAKE_MAKE_PROGRAM available. - cm.GetCacheManager()->LoadCache(this->BinaryDir.c_str()); + cm.GetCacheManager()->LoadCache(this->BinaryDir); } else { @@ -295,9 +295,9 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) config = "Debug"; } int retVal = cm.GetGlobalGenerator()->Build( - this->SourceDir.c_str(), this->BinaryDir.c_str(), - this->BuildProject.c_str(), tarIt->c_str(), - &output, this->BuildMakeProgram.c_str(), + this->SourceDir, this->BinaryDir, + this->BuildProject, *tarIt, + &output, this->BuildMakeProgram, config, !this->BuildNoClean, false, remainingTime); diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx index 04eabd2..de42e2b 100644 --- a/Source/CTest/cmCTestBuildCommand.cxx +++ b/Source/CTest/cmCTestBuildCommand.cxx @@ -151,7 +151,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() "\n" "Alternatively, set CTEST_BUILD_COMMAND to build the project " "with a custom command line."; - this->SetError(ostr.str().c_str()); + this->SetError(ostr.str()); return 0; } } diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx index 5eed409..1aa8768 100644 --- a/Source/CTest/cmCTestConfigureCommand.cxx +++ b/Source/CTest/cmCTestConfigureCommand.cxx @@ -69,7 +69,7 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler() cmOStringStream e; e << "CMakeLists.txt file does not exist [" << cmakelists_file << "]"; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return 0; } diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 2e35b75..2c21a13 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -157,7 +157,7 @@ void cmCTestCoverageHandler::CleanCoverageLogFiles(std::ostream& log) logGlob += this->CTest->GetCurrentTag(); logGlob += "/CoverageLog*"; cmsys::Glob gl; - gl.FindFiles(logGlob.c_str()); + gl.FindFiles(logGlob); std::vector<std::string> const& files = gl.GetFiles(); for(std::vector<std::string>::const_iterator fi = files.begin(); fi != files.end(); ++fi) @@ -241,7 +241,7 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file, bool buildSubDir = cmSystemTools::IsSubDirectory(fFile.c_str(), fBinDir.c_str()); // Always check parent directory of the file. - std::string fileDir = cmSystemTools::GetFilenamePath(fFile.c_str()); + std::string fileDir = cmSystemTools::GetFilenamePath(fFile); std::string checkDir; // We also need to check the binary/source directory pair. @@ -296,7 +296,7 @@ bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file, checkDir = fSrcDir; } fFile = checkDir + "/" + relPath; - fFile = cmSystemTools::GetFilenamePath(fFile.c_str()); + fFile = cmSystemTools::GetFilenamePath(fFile); if ( fileDir == fFile ) { @@ -503,7 +503,7 @@ int cmCTestCoverageHandler::ProcessHandler() } const std::string fileName - = cmSystemTools::GetFilenameName(fullFileName.c_str()); + = cmSystemTools::GetFilenameName(fullFileName); std::string shortFileName = this->CTest->GetShortPathToFile(fullFileName.c_str()); const cmCTestCoverageHandlerContainer::SingleFileCoverageVector& fcov @@ -947,7 +947,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage( // Call gcov to get coverage data for this *.gcda file: // - std::string fileDir = cmSystemTools::GetFilenamePath(it->c_str()); + std::string fileDir = cmSystemTools::GetFilenamePath(*it); std::string command = "\"" + gcovCommand + "\" " + gcovExtraFlags + " " + "-o \"" + fileDir + "\" " + @@ -1814,7 +1814,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary( total_tested += functionsCalled; total_untested += (totalFunctions - functionsCalled); - std::string fileName = cmSystemTools::GetFilenameName(file.c_str()); + std::string fileName = cmSystemTools::GetFilenameName(file); std::string shortFileName = this->CTest->GetShortPathToFile(file.c_str()); diff --git a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx index abc33de..a470b3b 100644 --- a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx +++ b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx @@ -26,7 +26,7 @@ bool cmCTestEmptyBinaryDirectoryCommand { cmOStringStream ostr; ostr << "problem removing the binary directory: " << args[0].c_str(); - this->SetError(ostr.str().c_str()); + this->SetError(ostr.str()); return false; } diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx index ae498ea..08cfaec 100644 --- a/Source/CTest/cmCTestGenericHandler.cxx +++ b/Source/CTest/cmCTestGenericHandler.cxx @@ -75,7 +75,7 @@ void cmCTestGenericHandler::Initialize() it != this->PersistentOptions.end(); ++ it ) { - this->Options[it->first.c_str()] = it->second.c_str(); + this->Options[it->first] = it->second.c_str(); } } @@ -121,7 +121,7 @@ bool cmCTestGenericHandler::StartResultingXML(cmCTest::Part part, return false; } if( !this->CTest->OpenOutputFile(this->CTest->GetCurrentTag(), - ostr.str().c_str(), xofs, true) ) + ostr.str(), xofs, true) ) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot create resulting XML file: " << ostr.str().c_str() @@ -153,7 +153,7 @@ bool cmCTestGenericHandler::StartLogFile(const char* name, ostr << "_" << this->CTest->GetCurrentTag(); } ostr << ".log"; - if( !this->CTest->OpenOutputFile("Temporary", ostr.str().c_str(), xofs) ) + if( !this->CTest->OpenOutputFile("Temporary", ostr.str(), xofs) ) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot create log file: " << ostr.str().c_str() << std::endl); diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx index 2e2feb0..0e29160 100644 --- a/Source/CTest/cmCTestHandlerCommand.cxx +++ b/Source/CTest/cmCTestHandlerCommand.cxx @@ -48,7 +48,7 @@ bool cmCTestHandlerCommand { cmOStringStream e; e << "called with unknown argument \"" << args[i] << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index c9f9e9e..10a5199 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -680,8 +680,8 @@ bool cmCTestLaunch::ScrapeLog(std::string const& fname) continue; } - if(this->Match(line.c_str(), this->RegexWarning) && - !this->Match(line.c_str(), this->RegexWarningSuppress)) + if(this->Match(line, this->RegexWarning) && + !this->Match(line, this->RegexWarningSuppress)) { return true; } diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx index 1ad94bc..0bb1a99 100644 --- a/Source/CTest/cmCTestP4.cxx +++ b/Source/CTest/cmCTestP4.cxx @@ -352,7 +352,7 @@ void cmCTestP4::SetP4Options(std::vector<char const*> &CommandOptions) for(std::vector<std::string>::const_iterator ai = args.begin(); ai != args.end(); ++ai) { - P4Options.push_back(ai->c_str()); + P4Options.push_back(*ai); } } diff --git a/Source/CTest/cmCTestRunScriptCommand.cxx b/Source/CTest/cmCTestRunScriptCommand.cxx index fe429bd..bdf9b9c 100644 --- a/Source/CTest/cmCTestRunScriptCommand.cxx +++ b/Source/CTest/cmCTestRunScriptCommand.cxx @@ -56,7 +56,7 @@ bool cmCTestRunScriptCommand &ret); cmOStringStream str; str << ret; - this->Makefile->AddDefinition(returnVariable.c_str(), str.str().c_str()); + this->Makefile->AddDefinition(returnVariable, str.str().c_str()); } } return true; diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 7f13855..4d419c2 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -337,8 +337,8 @@ void cmCTestScriptHandler::CreateCMake() // Set CMAKE_CURRENT_SOURCE_DIR and CMAKE_CURRENT_BINARY_DIR. // Also, some commands need Makefile->GetCurrentDirectory(). std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); - this->Makefile->SetStartDirectory(cwd.c_str()); - this->Makefile->SetStartOutputDirectory(cwd.c_str()); + this->Makefile->SetStartDirectory(cwd); + this->Makefile->SetStartOutputDirectory(cwd); // remove all cmake commands which are not scriptable, since they can't be // used in ctest scripts @@ -436,7 +436,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) for (std::map<std::string, std::string>::const_iterator it = defs.begin(); it != defs.end(); ++it) { - this->Makefile->AddDefinition(it->first.c_str(), it->second.c_str()); + this->Makefile->AddDefinition(it->first, it->second.c_str()); } // finally read in the script @@ -646,7 +646,7 @@ int cmCTestScriptHandler::RunCurrentScript() if (!this->CTestEnv.empty()) { std::vector<std::string> envArgs; - cmSystemTools::ExpandListArgument(this->CTestEnv.c_str(),envArgs); + cmSystemTools::ExpandListArgument(this->CTestEnv,envArgs); cmSystemTools::AppendEnv(envArgs); } @@ -772,7 +772,7 @@ int cmCTestScriptHandler::PerformExtraUpdates() ++ it ) { std::vector<std::string> cvsArgs; - cmSystemTools::ExpandListArgument(it->c_str(),cvsArgs); + cmSystemTools::ExpandListArgument(*it,cvsArgs); if (cvsArgs.size() == 2) { std::string fullCommand = command; diff --git a/Source/CTest/cmCTestStartCommand.cxx b/Source/CTest/cmCTestStartCommand.cxx index 228a173..da46f4a 100644 --- a/Source/CTest/cmCTestStartCommand.cxx +++ b/Source/CTest/cmCTestStartCommand.cxx @@ -131,7 +131,7 @@ bool cmCTestStartCommand << " " << sourceDir << "\n" << "which is not an existing directory. " << "Set CTEST_CHECKOUT_COMMAND to a command line to create it."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -160,7 +160,7 @@ bool cmCTestStartCommand::InitialCheckout( { // Use a generic VC object to run and log the command. cmCTestVC vc(this->CTest, ofs); - vc.SetSourceDirectory(sourceDir.c_str()); + vc.SetSourceDirectory(sourceDir); if(!vc.InitialCheckout(initialCheckoutCommand)) { return false; diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 3173f15..bc3c333 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -339,7 +339,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, std::string dropMethod(this->CTest->GetCTestConfiguration("DropMethod")); std::string curlopt(this->CTest->GetCTestConfiguration("CurlOptions")); std::vector<std::string> args; - cmSystemTools::ExpandListArgument(curlopt.c_str(), args); + cmSystemTools::ExpandListArgument(curlopt, args); bool verifyPeerOff = false; bool verifyHostOff = false; for( std::vector<std::string>::iterator i = args.begin(); @@ -461,7 +461,7 @@ bool cmCTestSubmitHandler::SubmitUsingHTTP(const std::string& localprefix, else { char md5[33]; - cmSystemTools::ComputeFileMD5(local_file.c_str(), md5); + cmSystemTools::ComputeFileMD5(local_file, md5); md5[32] = 0; upload_as += md5; } diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 5970656..efeb658 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -125,7 +125,7 @@ bool cmCTestSubdirCommand { std::string m = "Could not find include file: "; m += fname; - this->SetError(m.c_str()); + this->SetError(m); return false; } } @@ -213,7 +213,7 @@ bool cmCTestAddSubdirectoryCommand { std::string m = "Could not find include file: "; m += fname; - this->SetError(m.c_str()); + this->SetError(m); return false; } return true; @@ -1506,7 +1506,7 @@ std::string cmCTestTestHandler // then try with the exe extension else { - failed.push_back(attempted[ai].c_str()); + failed.push_back(attempted[ai]); tempPath = attempted[ai]; tempPath += cmSystemTools::GetExecutableExtension(); if(cmSystemTools::FileExists(tempPath.c_str()) @@ -1517,7 +1517,7 @@ std::string cmCTestTestHandler } else { - failed.push_back(tempPath.c_str()); + failed.push_back(tempPath); } } } @@ -2154,7 +2154,7 @@ bool cmCTestTestHandler::SetTestsProperties( if ( key == "ATTACHED_FILES" ) { std::vector<std::string> lval; - cmSystemTools::ExpandListArgument(val.c_str(), lval); + cmSystemTools::ExpandListArgument(val, lval); for(std::vector<std::string>::iterator f = lval.begin(); f != lval.end(); ++f) @@ -2165,7 +2165,7 @@ bool cmCTestTestHandler::SetTestsProperties( if ( key == "ATTACHED_FILES_ON_FAIL" ) { std::vector<std::string> lval; - cmSystemTools::ExpandListArgument(val.c_str(), lval); + cmSystemTools::ExpandListArgument(val, lval); for(std::vector<std::string>::iterator f = lval.begin(); f != lval.end(); ++f) @@ -2176,7 +2176,7 @@ bool cmCTestTestHandler::SetTestsProperties( if ( key == "RESOURCE_LOCK" ) { std::vector<std::string> lval; - cmSystemTools::ExpandListArgument(val.c_str(), lval); + cmSystemTools::ExpandListArgument(val, lval); for(std::vector<std::string>::iterator f = lval.begin(); f != lval.end(); ++f) @@ -2196,7 +2196,7 @@ bool cmCTestTestHandler::SetTestsProperties( if ( key == "REQUIRED_FILES" ) { std::vector<std::string> lval; - cmSystemTools::ExpandListArgument(val.c_str(), lval); + cmSystemTools::ExpandListArgument(val, lval); for(std::vector<std::string>::iterator f = lval.begin(); f != lval.end(); ++f) @@ -2211,14 +2211,14 @@ bool cmCTestTestHandler::SetTestsProperties( if ( key == "FAIL_REGULAR_EXPRESSION" ) { std::vector<std::string> lval; - cmSystemTools::ExpandListArgument(val.c_str(), lval); + cmSystemTools::ExpandListArgument(val, lval); std::vector<std::string>::iterator crit; for ( crit = lval.begin(); crit != lval.end(); ++ crit ) { rtit->ErrorRegularExpressions.push_back( std::pair<cmsys::RegularExpression, std::string>( cmsys::RegularExpression(crit->c_str()), - std::string(crit->c_str()))); + std::string(*crit))); } } if ( key == "PROCESSORS" ) @@ -2240,7 +2240,7 @@ bool cmCTestTestHandler::SetTestsProperties( if ( key == "DEPENDS" ) { std::vector<std::string> lval; - cmSystemTools::ExpandListArgument(val.c_str(), lval); + cmSystemTools::ExpandListArgument(val, lval); std::vector<std::string>::iterator crit; for ( crit = lval.begin(); crit != lval.end(); ++ crit ) { @@ -2250,7 +2250,7 @@ bool cmCTestTestHandler::SetTestsProperties( if ( key == "ENVIRONMENT" ) { std::vector<std::string> lval; - cmSystemTools::ExpandListArgument(val.c_str(), lval); + cmSystemTools::ExpandListArgument(val, lval); std::vector<std::string>::iterator crit; for ( crit = lval.begin(); crit != lval.end(); ++ crit ) { @@ -2260,7 +2260,7 @@ bool cmCTestTestHandler::SetTestsProperties( if ( key == "LABELS" ) { std::vector<std::string> lval; - cmSystemTools::ExpandListArgument(val.c_str(), lval); + cmSystemTools::ExpandListArgument(val, lval); std::vector<std::string>::iterator crit; for ( crit = lval.begin(); crit != lval.end(); ++ crit ) { @@ -2284,14 +2284,14 @@ bool cmCTestTestHandler::SetTestsProperties( if ( key == "PASS_REGULAR_EXPRESSION" ) { std::vector<std::string> lval; - cmSystemTools::ExpandListArgument(val.c_str(), lval); + cmSystemTools::ExpandListArgument(val, lval); std::vector<std::string>::iterator crit; for ( crit = lval.begin(); crit != lval.end(); ++ crit ) { rtit->RequiredRegularExpressions.push_back( std::pair<cmsys::RegularExpression, std::string>( cmsys::RegularExpression(crit->c_str()), - std::string(crit->c_str()))); + std::string(*crit))); } } if ( key == "WORKING_DIRECTORY" ) diff --git a/Source/CTest/cmParseMumpsCoverage.cxx b/Source/CTest/cmParseMumpsCoverage.cxx index fe98964..6236211 100644 --- a/Source/CTest/cmParseMumpsCoverage.cxx +++ b/Source/CTest/cmParseMumpsCoverage.cxx @@ -122,7 +122,7 @@ bool cmParseMumpsCoverage::LoadPackages(const char* d) glob.RecurseOn(); std::string pat = d; pat += "/*.m"; - glob.FindFiles(pat.c_str()); + glob.FindFiles(pat); std::vector<std::string>& files = glob.GetFiles(); std::vector<std::string>::iterator fileIt; for ( fileIt = files.begin(); fileIt != files.end(); diff --git a/Source/CursesDialog/cmCursesLabelWidget.cxx b/Source/CursesDialog/cmCursesLabelWidget.cxx index b5ed312..b50eb64 100644 --- a/Source/CursesDialog/cmCursesLabelWidget.cxx +++ b/Source/CursesDialog/cmCursesLabelWidget.cxx @@ -19,7 +19,7 @@ cmCursesLabelWidget::cmCursesLabelWidget(int width, int height, field_opts_off(this->Field, O_EDIT); field_opts_off(this->Field, O_ACTIVE); field_opts_off(this->Field, O_STATIC); - this->SetValue(name.c_str()); + this->SetValue(name); } cmCursesLabelWidget::~cmCursesLabelWidget() diff --git a/Source/CursesDialog/cmCursesOptionsWidget.cxx b/Source/CursesDialog/cmCursesOptionsWidget.cxx index aa680fb..d76ba2a 100644 --- a/Source/CursesDialog/cmCursesOptionsWidget.cxx +++ b/Source/CursesDialog/cmCursesOptionsWidget.cxx @@ -74,7 +74,7 @@ void cmCursesOptionsWidget::NextOption() { this->CurrentOption = 0; } - this->SetValue(this->Options[this->CurrentOption].c_str()); + this->SetValue(this->Options[this->CurrentOption]); } void cmCursesOptionsWidget::PreviousOption() { @@ -86,7 +86,7 @@ void cmCursesOptionsWidget::PreviousOption() { this->CurrentOption--; } - this->SetValue(this->Options[this->CurrentOption].c_str()); + this->SetValue(this->Options[this->CurrentOption]); } void cmCursesOptionsWidget::SetOption(const std::string& value) diff --git a/Source/CursesDialog/cmCursesPathWidget.cxx b/Source/CursesDialog/cmCursesPathWidget.cxx index 893ca99..cd93bc3 100644 --- a/Source/CursesDialog/cmCursesPathWidget.cxx +++ b/Source/CursesDialog/cmCursesPathWidget.cxx @@ -59,7 +59,7 @@ void cmCursesPathWidget::OnTab(cmCursesMainForm* fm, WINDOW* w) } std::vector<std::string> dirs; - cmSystemTools::SimpleGlob(glob.c_str(), dirs, (this->Type == cmCacheManager::PATH?-1:0)); + cmSystemTools::SimpleGlob(glob, dirs, (this->Type == cmCacheManager::PATH?-1:0)); if ( this->CurrentIndex < dirs.size() ) { cstr = dirs[this->CurrentIndex]; @@ -74,7 +74,7 @@ void cmCursesPathWidget::OnTab(cmCursesMainForm* fm, WINDOW* w) cstr += "/"; } - this->SetString(cstr.c_str()); + this->SetString(cstr); touchwin(w); wrefresh(w); form_driver(form, REQ_END_FIELD); diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index 3de04f5..c3a9a16 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -273,7 +273,7 @@ bool cmAddCustomCommandCommand { // Lookup an existing command. if(cmSourceFile* sf = - this->Makefile->GetSourceFileWithOutput(output[0].c_str())) + this->Makefile->GetSourceFileWithOutput(output[0])) { if(cmCustomCommand* cc = sf->GetCustomCommand()) { @@ -288,7 +288,7 @@ bool cmAddCustomCommandCommand cmOStringStream e; e << "given APPEND option with output \"" << output[0].c_str() << "\" which is not already a custom command output."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -305,7 +305,7 @@ bool cmAddCustomCommandCommand { // Source is empty, use the target. std::vector<std::string> no_depends; - this->Makefile->AddCustomCommandToTarget(target.c_str(), no_depends, + this->Makefile->AddCustomCommandToTarget(target, no_depends, commandLines, cctype, comment, working.c_str(), escapeOldStyle); @@ -314,7 +314,7 @@ bool cmAddCustomCommandCommand { // Target is empty, use the output. this->Makefile->AddCustomCommandToOutput(output, depends, - main_dependency.c_str(), + main_dependency, commandLines, comment, working.c_str(), false, escapeOldStyle); @@ -324,7 +324,7 @@ bool cmAddCustomCommandCommand { bool okay = false; if(cmSourceFile* sf = - this->Makefile->GetSourceFileWithOutput(output[0].c_str())) + this->Makefile->GetSourceFileWithOutput(output[0])) { if(cmCustomCommand* cc = sf->GetCustomCommand()) { @@ -337,7 +337,7 @@ bool cmAddCustomCommandCommand cmOStringStream e; e << "could not locate source file with a custom command producing \"" << output[0] << "\" even though this command tried to create it!"; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -367,7 +367,7 @@ bool cmAddCustomCommandCommand { e << "The SOURCE signatures of add_custom_command are no longer " "supported."; - this->Makefile->IssueMessage(messageType, e.str().c_str()); + this->Makefile->IssueMessage(messageType, e.str()); if (messageType == cmake::FATAL_ERROR) { return false; @@ -375,8 +375,8 @@ bool cmAddCustomCommandCommand } // Use the old-style mode for backward compatibility. - this->Makefile->AddCustomCommandOldStyle(target.c_str(), outputs, depends, - source.c_str(), commandLines, + this->Makefile->AddCustomCommandOldStyle(target, outputs, depends, + source, commandLines, comment); } @@ -397,7 +397,7 @@ cmAddCustomCommandCommand { std::string e = "attempted to have a file \"" + *o + "\" in a source directory as an output of custom command."; - this->SetError(e.c_str()); + this->SetError(e); cmSystemTools::SetFatalErrorOccured(); return false; } @@ -409,7 +409,7 @@ cmAddCustomCommandCommand cmOStringStream msg; msg << "called with OUTPUT containing a \"" << (*o)[pos] << "\". This character is not allowed."; - this->SetError(msg.str().c_str()); + this->SetError(msg.str()); return false; } } diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx index ef62523..da02f00 100644 --- a/Source/cmAddCustomTargetCommand.cxx +++ b/Source/cmAddCustomTargetCommand.cxx @@ -34,7 +34,7 @@ bool cmAddCustomTargetCommand e << "called with invalid target name \"" << targetName << "\". Target names may not contain a slash. " << "Use ADD_CUSTOM_COMMAND to generate files."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -149,7 +149,7 @@ bool cmAddCustomTargetCommand cmOStringStream msg; msg << "called with target name containing a \"" << targetName[pos] << "\". This character is not allowed."; - this->SetError(msg.str().c_str()); + this->SetError(msg.str()); return false; } @@ -187,7 +187,7 @@ bool cmAddCustomTargetCommand "\" is reserved or not valid for certain " "CMake features, such as generator expressions, and may result " "in undefined behavior."; - this->Makefile->IssueMessage(messageType, e.str().c_str()); + this->Makefile->IssueMessage(messageType, e.str()); if (messageType == cmake::FATAL_ERROR) { @@ -208,7 +208,7 @@ bool cmAddCustomTargetCommand std::string msg; if(!this->Makefile->EnforceUniqueName(targetName, msg, true)) { - this->SetError(msg.c_str()); + this->SetError(msg); return false; } } @@ -224,7 +224,7 @@ bool cmAddCustomTargetCommand // Add the utility target to the makefile. bool escapeOldStyle = !verbatim; cmTarget* target = - this->Makefile->AddUtilityCommand(targetName.c_str(), excludeFromAll, + this->Makefile->AddUtilityCommand(targetName, excludeFromAll, working_directory.c_str(), depends, commandLines, escapeOldStyle, comment); diff --git a/Source/cmAddDependenciesCommand.cxx b/Source/cmAddDependenciesCommand.cxx index b55334f..e897d81 100644 --- a/Source/cmAddDependenciesCommand.cxx +++ b/Source/cmAddDependenciesCommand.cxx @@ -38,7 +38,7 @@ bool cmAddDependenciesCommand cmOStringStream e; e << "Cannot add target-level dependencies to INTERFACE library " "target \"" << target_name << "\".\n"; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -46,7 +46,7 @@ bool cmAddDependenciesCommand ++s; // skip over target_name for (; s != args.end(); ++s) { - target->AddUtility(s->c_str(), this->Makefile); + target->AddUtility(*s, this->Makefile); } } else diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx index 62b6667..6e48e90 100644 --- a/Source/cmAddExecutableCommand.cxx +++ b/Source/cmAddExecutableCommand.cxx @@ -101,7 +101,7 @@ bool cmAddExecutableCommand "\" is reserved or not valid for certain " "CMake features, such as generator expressions, and may result " "in undefined behavior."; - this->Makefile->IssueMessage(messageType, e.str().c_str()); + this->Makefile->IssueMessage(messageType, e.str()); if (messageType == cmake::FATAL_ERROR) { @@ -132,9 +132,9 @@ bool cmAddExecutableCommand } if (isAlias) { - if(!cmGeneratorExpression::IsValidTargetName(exename.c_str())) + if(!cmGeneratorExpression::IsValidTargetName(exename)) { - this->SetError(("Invalid name for ALIAS: " + exename).c_str()); + this->SetError("Invalid name for ALIAS: " + exename); return false; } if(excludeFromAll) @@ -151,7 +151,7 @@ bool cmAddExecutableCommand { cmOStringStream e; e << "ALIAS requires exactly one target argument."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -161,7 +161,7 @@ bool cmAddExecutableCommand cmOStringStream e; e << "cannot create ALIAS target \"" << exename << "\" because target \"" << aliasedName << "\" is itself an ALIAS."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } cmTarget *aliasedTarget = @@ -172,7 +172,7 @@ bool cmAddExecutableCommand e << "cannot create ALIAS target \"" << exename << "\" because target \"" << aliasedName << "\" does not already " "exist."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } cmTarget::TargetType type = aliasedTarget->GetType(); @@ -182,7 +182,7 @@ bool cmAddExecutableCommand e << "cannot create ALIAS target \"" << exename << "\" because target \"" << aliasedName << "\" is not an " "executable."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } if(aliasedTarget->IsImported()) @@ -190,10 +190,10 @@ bool cmAddExecutableCommand cmOStringStream e; e << "cannot create ALIAS target \"" << exename << "\" because target \"" << aliasedName << "\" is IMPORTED."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } - this->Makefile->AddAlias(exename.c_str(), aliasedTarget); + this->Makefile->AddAlias(exename, aliasedTarget); return true; } @@ -206,12 +206,12 @@ bool cmAddExecutableCommand cmOStringStream e; e << "cannot create imported target \"" << exename << "\" because another target with the same name already exists."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } // Create the imported target. - this->Makefile->AddImportedTarget(exename.c_str(), cmTarget::EXECUTABLE, + this->Makefile->AddImportedTarget(exename, cmTarget::EXECUTABLE, importGlobal); return true; } @@ -221,7 +221,7 @@ bool cmAddExecutableCommand std::string msg; if(!this->Makefile->EnforceUniqueName(exename, msg)) { - this->SetError(msg.c_str()); + this->SetError(msg); return false; } } diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx index 009b1ca..6159f86 100644 --- a/Source/cmAddLibraryCommand.cxx +++ b/Source/cmAddLibraryCommand.cxx @@ -53,7 +53,7 @@ bool cmAddLibraryCommand { cmOStringStream e; e << "INTERFACE library specified with conflicting STATIC type."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } ++s; @@ -66,7 +66,7 @@ bool cmAddLibraryCommand { cmOStringStream e; e << "INTERFACE library specified with conflicting SHARED type."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } ++s; @@ -79,7 +79,7 @@ bool cmAddLibraryCommand { cmOStringStream e; e << "INTERFACE library specified with conflicting MODULE type."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } ++s; @@ -92,7 +92,7 @@ bool cmAddLibraryCommand { cmOStringStream e; e << "INTERFACE library specified with conflicting OBJECT type."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } ++s; @@ -105,7 +105,7 @@ bool cmAddLibraryCommand { cmOStringStream e; e << "INTERFACE library specified with conflicting UNKNOWN type."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } ++s; @@ -118,7 +118,7 @@ bool cmAddLibraryCommand { cmOStringStream e; e << "INTERFACE library specified with conflicting ALIAS type."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } ++s; @@ -130,21 +130,21 @@ bool cmAddLibraryCommand { cmOStringStream e; e << "INTERFACE library specified with conflicting/multiple types."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } if (isAlias) { cmOStringStream e; e << "INTERFACE library specified with conflicting ALIAS type."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } if (excludeFromAll) { cmOStringStream e; e << "INTERFACE library may not be used with EXCLUDE_FROM_ALL."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } ++s; @@ -157,7 +157,7 @@ bool cmAddLibraryCommand { cmOStringStream e; e << "INTERFACE library may not be used with EXCLUDE_FROM_ALL."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } ++s; @@ -177,7 +177,7 @@ bool cmAddLibraryCommand { cmOStringStream e; e << "GLOBAL option may only be used with IMPORTED libraries."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } else @@ -192,14 +192,14 @@ bool cmAddLibraryCommand { cmOStringStream e; e << "INTERFACE library requires no source arguments."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } if (importGlobal && !importTarget) { cmOStringStream e; e << "INTERFACE library specified as GLOBAL, but not as IMPORTED."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -236,7 +236,7 @@ bool cmAddLibraryCommand "\" is reserved or not valid for certain " "CMake features, such as generator expressions, and may result " "in undefined behavior."; - this->Makefile->IssueMessage(messageType, e.str().c_str()); + this->Makefile->IssueMessage(messageType, e.str()); if (messageType == cmake::FATAL_ERROR) { @@ -247,9 +247,9 @@ bool cmAddLibraryCommand if (isAlias) { - if(!cmGeneratorExpression::IsValidTargetName(libName.c_str())) + if(!cmGeneratorExpression::IsValidTargetName(libName)) { - this->SetError(("Invalid name for ALIAS: " + libName).c_str()); + this->SetError("Invalid name for ALIAS: " + libName); return false; } if(excludeFromAll) @@ -266,7 +266,7 @@ bool cmAddLibraryCommand { cmOStringStream e; e << "ALIAS requires exactly one target argument."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -276,7 +276,7 @@ bool cmAddLibraryCommand cmOStringStream e; e << "cannot create ALIAS target \"" << libName << "\" because target \"" << aliasedName << "\" is itself an ALIAS."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } cmTarget *aliasedTarget = @@ -287,7 +287,7 @@ bool cmAddLibraryCommand e << "cannot create ALIAS target \"" << libName << "\" because target \"" << aliasedName << "\" does not already " "exist."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } cmTarget::TargetType aliasedType = aliasedTarget->GetType(); @@ -300,7 +300,7 @@ bool cmAddLibraryCommand cmOStringStream e; e << "cannot create ALIAS target \"" << libName << "\" because target \"" << aliasedName << "\" is not a library."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } if(aliasedTarget->IsImported()) @@ -308,10 +308,10 @@ bool cmAddLibraryCommand cmOStringStream e; e << "cannot create ALIAS target \"" << libName << "\" because target \"" << aliasedName << "\" is IMPORTED."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } - this->Makefile->AddAlias(libName.c_str(), aliasedTarget); + this->Makefile->AddAlias(libName, aliasedTarget); return true; } @@ -364,7 +364,7 @@ bool cmAddLibraryCommand { cmOStringStream e; e << "Invalid name for IMPORTED INTERFACE library target: " << libName; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -375,12 +375,12 @@ bool cmAddLibraryCommand cmOStringStream e; e << "cannot create imported target \"" << libName << "\" because another target with the same name already exists."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } // Create the imported target. - this->Makefile->AddImportedTarget(libName.c_str(), type, importGlobal); + this->Makefile->AddImportedTarget(libName, type, importGlobal); return true; } @@ -399,7 +399,7 @@ bool cmAddLibraryCommand std::string msg; if(!this->Makefile->EnforceUniqueName(libName, msg)) { - this->SetError(msg.c_str()); + this->SetError(msg); return false; } } @@ -413,11 +413,11 @@ bool cmAddLibraryCommand { cmOStringStream e; e << "Invalid name for INTERFACE library target: " << libName; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } - this->Makefile->AddLibrary(libName.c_str(), + this->Makefile->AddLibrary(libName, type, srclists, excludeFromAll); @@ -439,7 +439,7 @@ bool cmAddLibraryCommand ++s; } - this->Makefile->AddLibrary(libName.c_str(), type, srclists, excludeFromAll); + this->Makefile->AddLibrary(libName, type, srclists, excludeFromAll); return true; } diff --git a/Source/cmAddSubDirectoryCommand.cxx b/Source/cmAddSubDirectoryCommand.cxx index 5b1c9c6..4ea2524 100644 --- a/Source/cmAddSubDirectoryCommand.cxx +++ b/Source/cmAddSubDirectoryCommand.cxx @@ -66,7 +66,7 @@ bool cmAddSubDirectoryCommand::InitialPass std::string error = "given source \""; error += srcArg; error += "\" which is not an existing directory."; - this->SetError(error.c_str()); + this->SetError(error); return false; } srcPath = cmSystemTools::CollapseFullPath(srcPath.c_str()); @@ -87,7 +87,7 @@ bool cmAddSubDirectoryCommand::InitialPass << this->Makefile->GetCurrentDirectory() << "\". " << "When specifying an out-of-tree source a binary directory " << "must be explicitly specified."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -121,7 +121,7 @@ bool cmAddSubDirectoryCommand::InitialPass binPath = cmSystemTools::CollapseFullPath(binPath.c_str()); // Add the subdirectory using the computed full paths. - this->Makefile->AddSubDirectory(srcPath.c_str(), binPath.c_str(), + this->Makefile->AddSubDirectory(srcPath, binPath, excludeFromAll, false, true); return true; diff --git a/Source/cmAddTestCommand.cxx b/Source/cmAddTestCommand.cxx index a9165f5..2531a1a 100644 --- a/Source/cmAddTestCommand.cxx +++ b/Source/cmAddTestCommand.cxx @@ -44,7 +44,7 @@ bool cmAddTestCommand // Create the test but add a generator only the first time it is // seen. This preserves behavior from before test generators. - cmTest* test = this->Makefile->GetTest(args[0].c_str()); + cmTest* test = this->Makefile->GetTest(args[0]); if(test) { // If the test was already added by a new-style signature do not @@ -54,13 +54,13 @@ bool cmAddTestCommand cmOStringStream e; e << " given test name \"" << args[0] << "\" which already exists in this directory."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } else { - test = this->Makefile->CreateTest(args[0].c_str()); + test = this->Makefile->CreateTest(args[0]); test->SetOldStyle(true); this->Makefile->AddTestGenerator(new cmTestGenerator(test)); } @@ -137,7 +137,7 @@ bool cmAddTestCommand::HandleNameMode(std::vector<std::string> const& args) { cmOStringStream e; e << " given unknown argument:\n " << args[i] << "\n"; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -157,17 +157,17 @@ bool cmAddTestCommand::HandleNameMode(std::vector<std::string> const& args) } // Require a unique test name within the directory. - if(this->Makefile->GetTest(name.c_str())) + if(this->Makefile->GetTest(name)) { cmOStringStream e; e << " given test NAME \"" << name << "\" which already exists in this directory."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } // Add the test. - cmTest* test = this->Makefile->CreateTest(name.c_str()); + cmTest* test = this->Makefile->CreateTest(name); test->SetOldStyle(false); test->SetCommand(command); if(!working_directory.empty()) diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx index 01f64b7..d8c3c43 100644 --- a/Source/cmAuxSourceDirectoryCommand.cxx +++ b/Source/cmAuxSourceDirectoryCommand.cxx @@ -40,7 +40,7 @@ bool cmAuxSourceDirectoryCommand::InitialPass } // was the list already populated - const char *def = this->Makefile->GetDefinition(args[1].c_str()); + const char *def = this->Makefile->GetDefinition(args[1]); if (def) { sourceListValue = def; @@ -72,7 +72,7 @@ bool cmAuxSourceDirectoryCommand::InitialPass // add the file as a class file so // depends can be done cmSourceFile* sf = - this->Makefile->GetOrCreateSource(fullname.c_str()); + this->Makefile->GetOrCreateSource(fullname); sf->SetProperty("ABSTRACT","0"); if(!sourceListValue.empty()) { @@ -83,7 +83,7 @@ bool cmAuxSourceDirectoryCommand::InitialPass } } } - this->Makefile->AddDefinition(args[1].c_str(), sourceListValue.c_str()); + this->Makefile->AddDefinition(args[1], sourceListValue.c_str()); return true; } diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx index 780ffa8..93f7801 100644 --- a/Source/cmBuildCommand.cxx +++ b/Source/cmBuildCommand.cxx @@ -80,7 +80,7 @@ bool cmBuildCommand { cmOStringStream e; e << "unknown argument \"" << args[i] << "\""; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -136,7 +136,7 @@ bool cmBuildCommand } std::string makecommand = this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator()->GenerateCMakeBuildCommand("", configType.c_str(), + ->GetGlobalGenerator()->GenerateCMakeBuildCommand("", configType, "", true); if(cacheValue) diff --git a/Source/cmBuildNameCommand.cxx b/Source/cmBuildNameCommand.cxx index e3528e1..c64209f 100644 --- a/Source/cmBuildNameCommand.cxx +++ b/Source/cmBuildNameCommand.cxx @@ -25,7 +25,7 @@ bool cmBuildNameCommand this->SetError("called with incorrect number of arguments"); return false; } - const char* cacheValue = this->Makefile->GetDefinition(args[0].c_str()); + const char* cacheValue = this->Makefile->GetDefinition(args[0]); if(cacheValue) { // do we need to correct the value? @@ -36,7 +36,7 @@ bool cmBuildNameCommand cmSystemTools::ReplaceString(cv,"/", "_"); cmSystemTools::ReplaceString(cv,"(", "_"); cmSystemTools::ReplaceString(cv,")", "_"); - this->Makefile->AddCacheDefinition(args[0].c_str(), + this->Makefile->AddCacheDefinition(args[0], cv.c_str(), "Name of build.", cmCacheManager::STRING); @@ -71,7 +71,7 @@ bool cmBuildNameCommand cmSystemTools::ReplaceString(buildname, ")", "_"); - this->Makefile->AddCacheDefinition(args[0].c_str(), + this->Makefile->AddCacheDefinition(args[0], buildname.c_str(), "Name of build.", cmCacheManager::STRING); diff --git a/Source/cmCMakeHostSystemInformationCommand.cxx b/Source/cmCMakeHostSystemInformationCommand.cxx index 62f2383..5234538 100644 --- a/Source/cmCMakeHostSystemInformationCommand.cxx +++ b/Source/cmCMakeHostSystemInformationCommand.cxx @@ -53,7 +53,7 @@ bool cmCMakeHostSystemInformationCommand result_list += value; } - this->Makefile->AddDefinition(variable.c_str(), result_list.c_str()); + this->Makefile->AddDefinition(variable, result_list.c_str()); return true; } @@ -97,7 +97,7 @@ bool cmCMakeHostSystemInformationCommand else { std::string e = "does not recognize <key> " + key; - this->SetError(e.c_str()); + this->SetError(e); return false; } diff --git a/Source/cmCMakeMinimumRequired.cxx b/Source/cmCMakeMinimumRequired.cxx index 6e2ca64..ba3a832 100644 --- a/Source/cmCMakeMinimumRequired.cxx +++ b/Source/cmCMakeMinimumRequired.cxx @@ -80,7 +80,7 @@ bool cmCMakeMinimumRequired { cmOStringStream e; e << "could not parse VERSION \"" << version_string.c_str() << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -135,7 +135,7 @@ bool cmCMakeMinimumRequired::EnforceUnknownArguments() cmOStringStream e; e << "called with unknown argument \"" << this->UnknownArguments[0] << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } return true; diff --git a/Source/cmCMakePolicyCommand.cxx b/Source/cmCMakePolicyCommand.cxx index f4be559..ddd5d6a 100644 --- a/Source/cmCMakePolicyCommand.cxx +++ b/Source/cmCMakePolicyCommand.cxx @@ -58,7 +58,7 @@ bool cmCMakePolicyCommand cmOStringStream e; e << "given unknown first argument \"" << args[0] << "\""; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -84,7 +84,7 @@ bool cmCMakePolicyCommand::HandleSetMode(std::vector<std::string> const& args) { cmOStringStream e; e << "SET given unrecognized policy status \"" << args[2] << "\""; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -116,7 +116,7 @@ bool cmCMakePolicyCommand::HandleGetMode(std::vector<std::string> const& args) cmOStringStream e; e << "GET given policy \"" << id << "\" which is not known to this " << "version of CMake."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -126,15 +126,15 @@ bool cmCMakePolicyCommand::HandleGetMode(std::vector<std::string> const& args) { case cmPolicies::OLD: // Report that the policy is set to OLD. - this->Makefile->AddDefinition(var.c_str(), "OLD"); + this->Makefile->AddDefinition(var, "OLD"); break; case cmPolicies::WARN: // Report that the policy is not set. - this->Makefile->AddDefinition(var.c_str(), ""); + this->Makefile->AddDefinition(var, ""); break; case cmPolicies::NEW: // Report that the policy is set to NEW. - this->Makefile->AddDefinition(var.c_str(), "NEW"); + this->Makefile->AddDefinition(var, "NEW"); break; case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index cb62f21..dd2a1b8 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -557,9 +557,9 @@ void CCONV *cmGetSource(void *arg, const char *name) sf->RealSourceFile = rsf; sf->FullPath = rsf->GetFullPath(); sf->SourceName = - cmSystemTools::GetFilenameWithoutLastExtension(sf->FullPath.c_str()); + cmSystemTools::GetFilenameWithoutLastExtension(sf->FullPath); sf->SourceExtension = - cmSystemTools::GetFilenameLastExtension(sf->FullPath.c_str()); + cmSystemTools::GetFilenameLastExtension(sf->FullPath); // Store the proxy in the map so it can be re-used and deleted later. cmCPluginAPISourceFileMap::value_type entry(rsf, sf); @@ -583,7 +583,7 @@ void * CCONV cmAddSource(void *arg, void *arg2) } // Create the real cmSourceFile instance and copy over saved information. - cmSourceFile* rsf = mf->GetOrCreateSource(osf->FullPath.c_str()); + cmSourceFile* rsf = mf->GetOrCreateSource(osf->FullPath); rsf->GetProperties() = osf->Properties; for(std::vector<std::string>::iterator i = osf->Depends.begin(); i != osf->Depends.end(); ++i) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index ee9b664..678b497 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -649,8 +649,8 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command) { std::string src_dir - = this->GetCTestConfiguration("SourceDirectory").c_str(); - std::string bld_dir = this->GetCTestConfiguration("BuildDirectory").c_str(); + = this->GetCTestConfiguration("SourceDirectory"); + std::string bld_dir = this->GetCTestConfiguration("BuildDirectory"); this->DartVersion = 1; this->DropSiteCDash = false; for(Part p = PartStart; p != PartCount; p = Part(p+1)) @@ -688,7 +688,7 @@ bool cmCTest::InitializeFromCommand(cmCTestStartCommand* command) { std::string m = "Could not find include file: "; m += fname; - command->SetError(m.c_str()); + command->SetError(m); return false; } } @@ -930,7 +930,7 @@ bool cmCTest::AddIfExists(Part part, const char* file) { std::string name = file; name += ".gz"; - if ( this->CTestFileExists(name.c_str()) ) + if ( this->CTestFileExists(name) ) { this->AddSubmitFile(part, file); } @@ -2246,7 +2246,7 @@ bool cmCTest::AddVariableDefinition(const std::string &arg) std::string value; cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED; - if (cmCacheManager::ParseEntry(arg.c_str(), name, value, type)) + if (cmCacheManager::ParseEntry(arg, name, value, type)) { this->Definitions[name] = value; return true; @@ -2611,7 +2611,7 @@ void cmCTest::PopulateCustomVector(cmMakefile* mf, const std::string& def, for ( it = slist.begin(); it != slist.end(); ++it ) { cmCTestLog(this, DEBUG, " -- " << it->c_str() << std::endl); - vec.push_back(it->c_str()); + vec.push_back(*it); } } diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx index 6284cb7..c9490ca 100644 --- a/Source/cmCommandArgumentParserHelper.cxx +++ b/Source/cmCommandArgumentParserHelper.cxx @@ -79,7 +79,7 @@ char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key, { if (this->EscapeQuotes) { - return this->AddString(cmSystemTools::EscapeQuotes(ptr).c_str()); + return this->AddString(cmSystemTools::EscapeQuotes(ptr)); } else { @@ -94,7 +94,7 @@ char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key, { if(this->EscapeQuotes) { - return this->AddString(cmSystemTools::EscapeQuotes(c).c_str()); + return this->AddString(cmSystemTools::EscapeQuotes(c)); } else { @@ -120,7 +120,7 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var) { cmOStringStream ostr; ostr << this->FileLine; - return this->AddString(ostr.str().c_str()); + return this->AddString(ostr.str()); } const char* value = this->Makefile->GetDefinition(var); if(!value && !this->RemoveEmpty) @@ -144,14 +144,14 @@ char* cmCommandArgumentParserHelper::ExpandVariable(const char* var) bt.push_back(lfc); msg << "uninitialized variable \'" << var << "\'"; this->Makefile->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, - msg.str().c_str(), bt); + msg.str(), bt); } } return 0; } if (this->EscapeQuotes && value) { - return this->AddString(cmSystemTools::EscapeQuotes(value).c_str()); + return this->AddString(cmSystemTools::EscapeQuotes(value)); } return this->AddString(value ? value : ""); } @@ -181,7 +181,7 @@ char* cmCommandArgumentParserHelper::ExpandVariableForAt(const char* var) std::string ref = "@"; ref += var; ref += "@"; - return this->AddString(ref.c_str()); + return this->AddString(ref); } char* cmCommandArgumentParserHelper::CombineUnions(char* in1, char* in2) diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 2d1da55..995f191 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -312,7 +312,7 @@ int cmComputeLinkDepends::AddLinkEntry(int depender_index, int index = lei->second; LinkEntry& entry = this->EntryList[index]; entry.Item = item; - entry.Target = this->FindTargetToLink(depender_index, entry.Item.c_str()); + entry.Target = this->FindTargetToLink(depender_index, entry.Item); entry.IsFlag = (!entry.Target && item[0] == '-' && item[1] != 'l' && item.substr(0, 10) != "-framework"); @@ -328,7 +328,7 @@ int cmComputeLinkDepends::AddLinkEntry(int depender_index, // Look for an old-style <item>_LIB_DEPENDS variable. std::string var = entry.Item; var += "_LIB_DEPENDS"; - if(const char* val = this->Makefile->GetDefinition(var.c_str())) + if(const char* val = this->Makefile->GetDefinition(var)) { // The item dependencies are known. Follow them. BFSEntry qe = {index, val}; @@ -435,7 +435,7 @@ void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep) LinkEntry& entry = this->EntryList[lei->second]; entry.Item = dep.Item; entry.Target = this->FindTargetToLink(dep.DependerIndex, - dep.Item.c_str()); + dep.Item); // This item was added specifically because it is a dependent // shared library. It may get special treatment @@ -506,7 +506,7 @@ void cmComputeLinkDepends::AddVarLinkEntries(int depender_index, { std::string var = *di; var += "_LINK_TYPE"; - if(const char* val = this->Makefile->GetDefinition(var.c_str())) + if(const char* val = this->Makefile->GetDefinition(var)) { if(strcmp(val, "debug") == 0) { @@ -1000,7 +1000,7 @@ void cmComputeLinkDepends::CheckWrongConfigItem(int depender_index, // directories of targets linked in another configuration as link // directories. if(cmTarget const* tgt - = this->FindTargetToLink(depender_index, item.c_str())) + = this->FindTargetToLink(depender_index, item)) { if(!tgt->IsImported()) { diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 62eaec2..ea8536f 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -293,7 +293,7 @@ cmComputeLinkInformation std::string loader_flag_var = "CMAKE_SHARED_MODULE_LOADER_"; loader_flag_var += this->LinkLanguage; loader_flag_var += "_FLAG"; - this->LoaderFlag = this->Makefile->GetDefinition(loader_flag_var.c_str()); + this->LoaderFlag = this->Makefile->GetDefinition(loader_flag_var); } // Get options needed to link libraries. @@ -317,8 +317,8 @@ cmComputeLinkInformation rtVar += this->LinkLanguage; rtVar += "_FLAG"; std::string rtSepVar = rtVar + "_SEP"; - this->RuntimeFlag = this->Makefile->GetSafeDefinition(rtVar.c_str()); - this->RuntimeSep = this->Makefile->GetSafeDefinition(rtSepVar.c_str()); + this->RuntimeFlag = this->Makefile->GetSafeDefinition(rtVar); + this->RuntimeSep = this->Makefile->GetSafeDefinition(rtSepVar); this->RuntimeAlways = (this->Makefile-> GetSafeDefinition("CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH")); @@ -330,7 +330,7 @@ cmComputeLinkInformation rlVar += "_RPATH_LINK_"; rlVar += this->LinkLanguage; rlVar += "_FLAG"; - this->RPathLinkFlag = this->Makefile->GetSafeDefinition(rlVar.c_str()); + this->RPathLinkFlag = this->Makefile->GetSafeDefinition(rlVar); } // Check if we need to include the runtime search path at link time. @@ -338,7 +338,7 @@ cmComputeLinkInformation std::string var = "CMAKE_SHARED_LIBRARY_LINK_"; var += this->LinkLanguage; var += "_WITH_RUNTIME_PATH"; - this->LinkWithRuntimePath = this->Makefile->IsOn(var.c_str()); + this->LinkWithRuntimePath = this->Makefile->IsOn(var); } // Check the platform policy for missing soname case. @@ -505,7 +505,7 @@ bool cmComputeLinkInformation::Compute() } // Compute the ordered link line items. - cmComputeLinkDepends cld(this->Target, this->Config.c_str(), + cmComputeLinkDepends cld(this->Target, this->Config, this->HeadTarget); cld.SetOldLinkDirMode(this->OldLinkDirMode); cmComputeLinkDepends::EntryVector const& linkEntries = cld.Compute(); @@ -593,7 +593,7 @@ void cmComputeLinkInformation::AddImplicitLinkInfo(std::string const& lang) std::string libVar = "CMAKE_"; libVar += lang; libVar += "_IMPLICIT_LINK_LIBRARIES"; - if(const char* libs = this->Makefile->GetDefinition(libVar.c_str())) + if(const char* libs = this->Makefile->GetDefinition(libVar)) { std::vector<std::string> libsVec; cmSystemTools::ExpandListArgument(libs, libsVec); @@ -602,7 +602,7 @@ void cmComputeLinkInformation::AddImplicitLinkInfo(std::string const& lang) { if(this->ImplicitLinkLibs.find(*i) == this->ImplicitLinkLibs.end()) { - this->AddItem(i->c_str(), 0); + this->AddItem(*i, 0); } } } @@ -612,7 +612,7 @@ void cmComputeLinkInformation::AddImplicitLinkInfo(std::string const& lang) std::string dirVar = "CMAKE_"; dirVar += lang; dirVar += "_IMPLICIT_LINK_DIRECTORIES"; - if(const char* dirs = this->Makefile->GetDefinition(dirVar.c_str())) + if(const char* dirs = this->Makefile->GetDefinition(dirVar)) { std::vector<std::string> dirsVec; cmSystemTools::ExpandListArgument(dirs, dirsVec); @@ -820,7 +820,7 @@ void cmComputeLinkInformation::ComputeLinkTypeInfo() static_link_type_flag_var += this->LinkLanguage; static_link_type_flag_var += "_FLAGS"; static_link_type_flag = - this->Makefile->GetDefinition(static_link_type_flag_var.c_str()); + this->Makefile->GetDefinition(static_link_type_flag_var); std::string shared_link_type_flag_var = "CMAKE_"; shared_link_type_flag_var += target_type_str; @@ -828,7 +828,7 @@ void cmComputeLinkInformation::ComputeLinkTypeInfo() shared_link_type_flag_var += this->LinkLanguage; shared_link_type_flag_var += "_FLAGS"; shared_link_type_flag = - this->Makefile->GetDefinition(shared_link_type_flag_var.c_str()); + this->Makefile->GetDefinition(shared_link_type_flag_var); } // We can support link type switching only if all needed flags are @@ -1370,7 +1370,7 @@ void cmComputeLinkInformation::AddFrameworkItem(std::string const& item) // Add the item using the -framework option. this->Items.push_back(Item("-framework", false)); - fw = this->LocalGenerator->EscapeForShell(fw.c_str()); + fw = this->LocalGenerator->EscapeForShell(fw); this->Items.push_back(Item(fw, false)); } @@ -1419,7 +1419,7 @@ void cmComputeLinkInformation::ComputeFrameworkInfo() implicitDirVar += this->LinkLanguage; implicitDirVar += "_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES"; if(const char* implicitDirs = - this->Makefile->GetDefinition(implicitDirVar.c_str())) + this->Makefile->GetDefinition(implicitDirVar)) { cmSystemTools::ExpandListArgument(implicitDirs, implicitDirVec); } @@ -1506,9 +1506,9 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item, // Print the warning at most once for this item. std::string wid = "CMP0008-WARNING-GIVEN-"; wid += item; - if(!this->CMakeInstance->GetPropertyAsBool(wid.c_str())) + if(!this->CMakeInstance->GetPropertyAsBool(wid)) { - this->CMakeInstance->SetProperty(wid.c_str(), "1"); + this->CMakeInstance->SetProperty(wid, "1"); cmOStringStream w; w << (this->Makefile->GetPolicies() ->GetPolicyWarning(cmPolicies::CMP0008)) << "\n" @@ -1692,7 +1692,7 @@ void cmComputeLinkInformation::LoadImplicitLinkInfo() implicitDirVar += this->LinkLanguage; implicitDirVar += "_IMPLICIT_LINK_DIRECTORIES"; if(const char* implicitDirs = - this->Makefile->GetDefinition(implicitDirVar.c_str())) + this->Makefile->GetDefinition(implicitDirVar)) { cmSystemTools::ExpandListArgument(implicitDirs, implicitDirVec); } @@ -1710,7 +1710,7 @@ void cmComputeLinkInformation::LoadImplicitLinkInfo() implicitLibVar += this->LinkLanguage; implicitLibVar += "_IMPLICIT_LINK_LIBRARIES"; if(const char* implicitLibs = - this->Makefile->GetDefinition(implicitLibVar.c_str())) + this->Makefile->GetDefinition(implicitLibVar)) { cmSystemTools::ExpandListArgument(implicitLibs, implicitLibVec); } @@ -1978,11 +1978,11 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs, { std::string useVar = "CMAKE_" + *li + "_USE_IMPLICIT_LINK_DIRECTORIES_IN_RUNTIME_PATH"; - if(this->Makefile->IsOn(useVar.c_str())) + if(this->Makefile->IsOn(useVar)) { std::string dirVar = "CMAKE_" + *li + "_IMPLICIT_LINK_DIRECTORIES"; - if(const char* dirs = this->Makefile->GetDefinition(dirVar.c_str())) + if(const char* dirs = this->Makefile->GetDefinition(dirVar)) { cmCLI_ExpandListUnique(dirs, runtimeDirs, emitted); } diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 5c739b8..b4dbce7 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -223,8 +223,8 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) // Don't emit the same library twice for this target. if(emitted.insert(*lib).second) { - this->AddTargetDepend(depender_index, lib->c_str(), true); - this->AddInterfaceDepends(depender_index, lib->c_str(), + this->AddTargetDepend(depender_index, *lib, true); + this->AddInterfaceDepends(depender_index, *lib, true, emitted); } } @@ -235,7 +235,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) it != configs.end(); ++it) { std::vector<std::string> tlibs; - depender->GetDirectLinkLibraries(it->c_str(), tlibs, depender); + depender->GetDirectLinkLibraries(*it, tlibs, depender); // A target should not depend on itself. emitted.insert(depender->GetName()); @@ -245,8 +245,8 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) // Don't emit the same library twice for this target. if(emitted.insert(*lib).second) { - this->AddTargetDepend(depender_index, lib->c_str(), true); - this->AddInterfaceDepends(depender_index, lib->c_str(), + this->AddTargetDepend(depender_index, *lib, true); + this->AddInterfaceDepends(depender_index, *lib, true, emitted); } } @@ -265,7 +265,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) // Don't emit the same utility twice for this target. if(emitted.insert(*util).second) { - this->AddTargetDepend(depender_index, util->c_str(), false); + this->AddTargetDepend(depender_index, *util, false); } } } @@ -288,8 +288,8 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, // Don't emit the same library twice for this target. if(emitted.insert(*lib).second) { - this->AddTargetDepend(depender_index, lib->c_str(), true); - this->AddInterfaceDepends(depender_index, lib->c_str(), + this->AddTargetDepend(depender_index, *lib, true); + this->AddInterfaceDepends(depender_index, *lib, true, emitted); } } @@ -326,7 +326,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index, // A target should not depend on itself. emitted.insert(depender->GetName()); this->AddInterfaceDepends(depender_index, dependee, - it->c_str(), emitted); + *it, emitted); } } } diff --git a/Source/cmConfigureFileCommand.cxx b/Source/cmConfigureFileCommand.cxx index f8ec642..395e6c8 100644 --- a/Source/cmConfigureFileCommand.cxx +++ b/Source/cmConfigureFileCommand.cxx @@ -38,7 +38,7 @@ bool cmConfigureFileCommand e << "input location\n" << " " << this->InputFile << "\n" << "is a directory but a file was expected."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -61,14 +61,14 @@ bool cmConfigureFileCommand { std::string e = "attempted to configure a file: " + this->OutputFile + " into a source directory."; - this->SetError(e.c_str()); + this->SetError(e); cmSystemTools::SetFatalErrorOccured(); return false; } std::string errorMessage; if (!this->NewLineStyle.ReadFromArguments(args, errorMessage)) { - this->SetError(errorMessage.c_str()); + this->SetError(errorMessage); return false; } this->CopyOnly = false; diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index ab7b024..3987283 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -307,13 +307,13 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv) std::string rulesOverrideBase = "CMAKE_USER_MAKE_RULES_OVERRIDE"; std::string rulesOverrideLang = rulesOverrideBase + "_" + *li; if(const char* rulesOverridePath = - this->Makefile->GetDefinition(rulesOverrideLang.c_str())) + this->Makefile->GetDefinition(rulesOverrideLang)) { fprintf(fout, "set(%s \"%s\")\n", rulesOverrideLang.c_str(), rulesOverridePath); } else if(const char* rulesOverridePath2 = - this->Makefile->GetDefinition(rulesOverrideBase.c_str())) + this->Makefile->GetDefinition(rulesOverrideBase)) { fprintf(fout, "set(%s \"%s\")\n", rulesOverrideBase.c_str(), rulesOverridePath2); @@ -325,7 +325,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv) li != testLangs.end(); ++li) { std::string langFlags = "CMAKE_" + *li + "_FLAGS"; - const char* flags = this->Makefile->GetDefinition(langFlags.c_str()); + const char* flags = this->Makefile->GetDefinition(langFlags); fprintf(fout, "set(CMAKE_%s_FLAGS %s)\n", li->c_str(), lg->EscapeForCMake(flags?flags:"").c_str()); fprintf(fout, "set(CMAKE_%s_FLAGS \"${CMAKE_%s_FLAGS}" @@ -484,7 +484,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv) std::string output; // actually do the try compile now that everything is setup int res = this->Makefile->TryCompile(sourceDirectory, - this->BinaryDirectory.c_str(), + this->BinaryDirectory, projectName, targetName, this->SrcFileSignature, @@ -496,14 +496,14 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv) } // set the result var to the return value to indicate success or failure - this->Makefile->AddCacheDefinition(argv[0].c_str(), + this->Makefile->AddCacheDefinition(argv[0], (res == 0 ? "TRUE" : "FALSE"), "Result of TRY_COMPILE", cmCacheManager::INTERNAL); if ( outputVariable.size() > 0 ) { - this->Makefile->AddDefinition(outputVariable.c_str(), output.c_str()); + this->Makefile->AddDefinition(outputVariable, output.c_str()); } if (this->SrcFileSignature) @@ -540,7 +540,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv) if(!copyFileError.empty()) { - this->Makefile->AddDefinition(copyFileError.c_str(), + this->Makefile->AddDefinition(copyFileError, copyFileErrorMessage.c_str()); } } diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx index de20cb7..02fb8cb 100644 --- a/Source/cmCreateTestSourceList.cxx +++ b/Source/cmCreateTestSourceList.cxx @@ -169,13 +169,13 @@ bool cmCreateTestSourceList // Construct the source list. std::string sourceListValue; { - cmSourceFile* sf = this->Makefile->GetOrCreateSource(driver.c_str()); + cmSourceFile* sf = this->Makefile->GetOrCreateSource(driver); sf->SetProperty("ABSTRACT","0"); sourceListValue = args[1]; } for(i = testsBegin; i != tests.end(); ++i) { - cmSourceFile* sf = this->Makefile->GetOrCreateSource(i->c_str()); + cmSourceFile* sf = this->Makefile->GetOrCreateSource(*i); sf->SetProperty("ABSTRACT","0"); sourceListValue += ";"; sourceListValue += *i; diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index d8a756d..b9cf777 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -63,11 +63,11 @@ cmCustomCommandGenerator cmd += " "; if(this->OldStyle) { - cmd += this->LG->EscapeForShellOldStyle(arg.c_str()); + cmd += this->LG->EscapeForShellOldStyle(arg); } else { - cmd += this->LG->EscapeForShell(arg.c_str(), this->MakeVars); + cmd += this->LG->EscapeForShell(arg, this->MakeVars); } } } diff --git a/Source/cmDefinePropertyCommand.cxx b/Source/cmDefinePropertyCommand.cxx index 1ad98af..6b729de 100644 --- a/Source/cmDefinePropertyCommand.cxx +++ b/Source/cmDefinePropertyCommand.cxx @@ -58,7 +58,7 @@ bool cmDefinePropertyCommand << "Valid scopes are " << "GLOBAL, DIRECTORY, TARGET, SOURCE, " << "TEST, VARIABLE, CACHED_VARIABLE."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -102,7 +102,7 @@ bool cmDefinePropertyCommand { cmOStringStream e; e << "given invalid argument \"" << args[i] << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -128,7 +128,7 @@ bool cmDefinePropertyCommand // Actually define the property. this->Makefile->GetCMakeInstance()->DefineProperty - (this->PropertyName.c_str(), scope, + (this->PropertyName, scope, this->BriefDocs.c_str(), this->FullDocs.c_str(), inherited); return true; diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index 51150f2..50a395e 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -47,7 +47,7 @@ bool cmDepends::Write(std::ostream &makeDepends, std::string srcLang = "CMAKE_DEPENDS_CHECK_"; srcLang += this->Language; cmMakefile* mf = this->LocalGenerator->GetMakefile(); - const char* srcStr = mf->GetSafeDefinition(srcLang.c_str()); + const char* srcStr = mf->GetSafeDefinition(srcLang); std::vector<std::string> pairs; cmSystemTools::ExpandListArgument(srcStr, pairs); @@ -61,7 +61,7 @@ bool cmDepends::Write(std::ostream &makeDepends, std::string obj = *si++; // Make sure the object file is relative to the top of the build tree. - obj = this->LocalGenerator->Convert(obj.c_str(), + obj = this->LocalGenerator->Convert(obj, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE); dependencies[obj].insert(src); @@ -305,7 +305,7 @@ void cmDepends::SetIncludePathFromLanguage(const std::string& lang) includePathVar += lang; includePathVar += "_TARGET_INCLUDE_PATH"; cmMakefile* mf = this->LocalGenerator->GetMakefile(); - includePath = mf->GetDefinition(includePathVar.c_str()); + includePath = mf->GetDefinition(includePathVar); if(includePath) { cmSystemTools::ExpandListArgument(includePath, this->IncludePath); @@ -316,7 +316,7 @@ void cmDepends::SetIncludePathFromLanguage(const std::string& lang) includePathVar = "CMAKE_"; includePathVar += lang; includePathVar += "_INCLUDE_PATH"; - includePath = mf->GetDefinition(includePathVar.c_str()); + includePath = mf->GetDefinition(includePathVar); if(includePath) { cmSystemTools::ExpandListArgument(includePath, this->IncludePath); diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 57a66da..56ef6e2 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -54,14 +54,14 @@ cmDependsC::cmDependsC(cmLocalGenerator* lg, std::string scanRegexVar = "CMAKE_"; scanRegexVar += lang; scanRegexVar += "_INCLUDE_REGEX_SCAN"; - if(const char* sr = mf->GetDefinition(scanRegexVar.c_str())) + if(const char* sr = mf->GetDefinition(scanRegexVar)) { scanRegex = sr; } std::string complainRegexVar = "CMAKE_"; complainRegexVar += lang; complainRegexVar += "_INCLUDE_REGEX_COMPLAIN"; - if(const char* cr = mf->GetDefinition(complainRegexVar.c_str())) + if(const char* cr = mf->GetDefinition(complainRegexVar)) { complainRegex = cr; } @@ -274,7 +274,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources, i != dependencies.end(); ++i) { makeDepends << obj << ": " << - this->LocalGenerator->Convert(i->c_str(), + this->LocalGenerator->Convert(*i, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE) << std::endl; diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index b3fbaa2..1d91b4a 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -292,15 +292,15 @@ bool cmDependsFortran::Finalize(std::ostream& makeDepends, stamp += ".mod.stamp"; fcStream << "\n"; fcStream << " \"" << - this->LocalGenerator->Convert(mod_lower.c_str(), + this->LocalGenerator->Convert(mod_lower, cmLocalGenerator::START_OUTPUT) << "\"\n"; fcStream << " \"" << - this->LocalGenerator->Convert(mod_upper.c_str(), + this->LocalGenerator->Convert(mod_upper, cmLocalGenerator::START_OUTPUT) << "\"\n"; fcStream << " \"" << - this->LocalGenerator->Convert(stamp.c_str(), + this->LocalGenerator->Convert(stamp, cmLocalGenerator::START_OUTPUT) << "\"\n"; } @@ -449,7 +449,7 @@ cmDependsFortran i != info.Includes.end(); ++i) { makeDepends << obj << ": " << - this->LocalGenerator->Convert(i->c_str(), + this->LocalGenerator->Convert(*i, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE) << std::endl; @@ -480,7 +480,7 @@ cmDependsFortran proxy += "/"; proxy += *i; proxy += ".mod.proxy"; - proxy = this->LocalGenerator->Convert(proxy.c_str(), + proxy = this->LocalGenerator->Convert(proxy, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE); @@ -497,7 +497,7 @@ cmDependsFortran { // This module is known. Depend on its timestamp file. std::string stampFile = - this->LocalGenerator->Convert(required->second.c_str(), + this->LocalGenerator->Convert(required->second, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE); makeDepends << obj << ": " << stampFile << "\n"; @@ -510,7 +510,7 @@ cmDependsFortran if(this->FindModule(*i, module)) { module = - this->LocalGenerator->Convert(module.c_str(), + this->LocalGenerator->Convert(module, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE); makeDepends << obj << ": " << module << "\n"; @@ -526,7 +526,7 @@ cmDependsFortran proxy += "/"; proxy += *i; proxy += ".mod.proxy"; - proxy = this->LocalGenerator->Convert(proxy.c_str(), + proxy = this->LocalGenerator->Convert(proxy, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE); makeDepends << proxy << ": " << obj << ".provides" << std::endl; @@ -552,7 +552,7 @@ cmDependsFortran modFile += "/"; modFile += *i; modFile = - this->LocalGenerator->Convert(modFile.c_str(), + this->LocalGenerator->Convert(modFile, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::SHELL); std::string stampFile = stamp_dir; @@ -560,7 +560,7 @@ cmDependsFortran stampFile += m; stampFile += ".mod.stamp"; stampFile = - this->LocalGenerator->Convert(stampFile.c_str(), + this->LocalGenerator->Convert(stampFile, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::SHELL); makeDepends << "\t$(CMAKE_COMMAND) -E cmake_copy_f90_mod " @@ -582,7 +582,7 @@ cmDependsFortran // the target finishes building. std::string driver = this->TargetDirectory; driver += "/build"; - driver = this->LocalGenerator->Convert(driver.c_str(), + driver = this->LocalGenerator->Convert(driver, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE); makeDepends << driver << ": " << obj << ".provides.build\n"; diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 96b5f04..a4bc83d 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -672,7 +672,7 @@ bool cmDocumentation::PrintFiles(std::ostream& os, for (std::vector<std::string>::const_iterator i = files.begin(); i != files.end(); ++i) { - found = r.ProcessFile(i->c_str()) || found; + found = r.ProcessFile(*i) || found; } return found; } diff --git a/Source/cmExecProgramCommand.cxx b/Source/cmExecProgramCommand.cxx index 6c11345..9b59088 100644 --- a/Source/cmExecProgramCommand.cxx +++ b/Source/cmExecProgramCommand.cxx @@ -132,14 +132,14 @@ bool cmExecProgramCommand } std::string coutput = std::string(output, first, last-first+1); - this->Makefile->AddDefinition(output_variable.c_str(), coutput.c_str()); + this->Makefile->AddDefinition(output_variable, coutput.c_str()); } if ( return_variable.size() > 0 ) { char buffer[100]; sprintf(buffer, "%d", retVal); - this->Makefile->AddDefinition(return_variable.c_str(), buffer); + this->Makefile->AddDefinition(return_variable, buffer); } return true; diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx index 994c170..40f70b8 100644 --- a/Source/cmExecuteProcessCommand.cxx +++ b/Source/cmExecuteProcessCommand.cxx @@ -191,7 +191,7 @@ bool cmExecuteProcessCommand { cmOStringStream e; e << " given unknown argument \"" << args[i] << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -200,7 +200,7 @@ bool cmExecuteProcessCommand { std::string e = "attempted to output into a file: " + output_file + " into a source directory."; - this->SetError(e.c_str()); + this->SetError(e); cmSystemTools::SetFatalErrorOccured(); return false; } @@ -326,12 +326,12 @@ bool cmExecuteProcessCommand // Store the output obtained. if(!output_variable.empty() && tempOutput.size()) { - this->Makefile->AddDefinition(output_variable.c_str(), + this->Makefile->AddDefinition(output_variable, &*tempOutput.begin()); } if(!merge_output && !error_variable.empty() && tempError.size()) { - this->Makefile->AddDefinition(error_variable.c_str(), + this->Makefile->AddDefinition(error_variable, &*tempError.begin()); } @@ -345,19 +345,19 @@ bool cmExecuteProcessCommand int v = cmsysProcess_GetExitValue(cp); char buf[100]; sprintf(buf, "%d", v); - this->Makefile->AddDefinition(result_variable.c_str(), buf); + this->Makefile->AddDefinition(result_variable, buf); } break; case cmsysProcess_State_Exception: - this->Makefile->AddDefinition(result_variable.c_str(), + this->Makefile->AddDefinition(result_variable, cmsysProcess_GetExceptionString(cp)); break; case cmsysProcess_State_Error: - this->Makefile->AddDefinition(result_variable.c_str(), + this->Makefile->AddDefinition(result_variable, cmsysProcess_GetErrorString(cp)); break; case cmsysProcess_State_Expired: - this->Makefile->AddDefinition(result_variable.c_str(), + this->Makefile->AddDefinition(result_variable, "Process terminated due to timeout"); break; } diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index f991f45..e79206d 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -47,7 +47,7 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) cmOStringStream e; e << "given target \"" << te->GetName() << "\" more than once."; this->Makefile->GetCMakeInstance() - ->IssueMessage(cmake::FATAL_ERROR, e.str().c_str(), this->Backtrace); + ->IssueMessage(cmake::FATAL_ERROR, e.str(), this->Backtrace); return false; } if (te->GetType() == cmTarget::INTERFACE_LIBRARY) @@ -106,7 +106,7 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) ci = this->Configurations.begin(); ci != this->Configurations.end(); ++ci) { - this->GenerateImportConfig(os, ci->c_str(), missingTargets); + this->GenerateImportConfig(os, *ci, missingTargets); } this->GenerateMissingTargetsCheckCode(os, missingTargets); @@ -315,7 +315,7 @@ cmExportBuildFileGenerator << "consider using the APPEND option with multiple separate calls."; this->Makefile->GetCMakeInstance() - ->IssueMessage(cmake::FATAL_ERROR, e.str().c_str(), this->Backtrace); + ->IssueMessage(cmake::FATAL_ERROR, e.str(), this->Backtrace); } std::string @@ -328,7 +328,7 @@ cmExportBuildFileGenerator::InstallNameDir(cmTarget* target, if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME")) { install_name_dir = - target->GetInstallNameDirForBuildTree(config.c_str()); + target->GetInstallNameDirForBuildTree(config); } return install_name_dir; diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index bda8dda..dcb77ba 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -92,7 +92,7 @@ bool cmExportCommand cmOStringStream e; e << "FILE option given filename \"" << this->Filename.GetString() << "\" which does not have an extension of \".cmake\".\n"; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } fname = this->Filename.GetString(); @@ -106,7 +106,7 @@ bool cmExportCommand cmOStringStream e; e << "FILE option given filename \"" << fname << "\" which is in the source tree.\n"; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -128,7 +128,7 @@ bool cmExportCommand { cmOStringStream e; e << "EXPORT signature does not recognise the APPEND option."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -137,7 +137,7 @@ bool cmExportCommand cmOStringStream e; e << "EXPORT signature does not recognise the " "EXPORT_LINK_INTERFACE_LIBRARIES option."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -147,7 +147,7 @@ bool cmExportCommand { cmOStringStream e; e << "Export set \"" << setName << "\" not found."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } this->ExportSet = setMap[setName]; @@ -164,18 +164,18 @@ bool cmExportCommand cmOStringStream e; e << "given ALIAS target \"" << *currentTarget << "\" which may not be exported."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } - if(cmTarget* target = gg->FindTarget(currentTarget->c_str())) + if(cmTarget* target = gg->FindTarget(*currentTarget)) { if(target->GetType() == cmTarget::OBJECT_LIBRARY) { cmOStringStream e; e << "given OBJECT library \"" << *currentTarget << "\" which may not be exported."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -184,7 +184,7 @@ bool cmExportCommand cmOStringStream e; e << "given target \"" << *currentTarget << "\" which is not built by this project."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } targets.push_back(*currentTarget); @@ -229,7 +229,7 @@ bool cmExportCommand ci = configurationTypes.begin(); ci != configurationTypes.end(); ++ci) { - ebfg->AddConfiguration(ci->c_str()); + ebfg->AddConfiguration(*ci); } } else @@ -266,7 +266,7 @@ bool cmExportCommand::HandlePackage(std::vector<std::string> const& args) { cmOStringStream e; e << "PACKAGE given unknown argument: " << args[i]; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -284,7 +284,7 @@ bool cmExportCommand::HandlePackage(std::vector<std::string> const& args) cmOStringStream e; e << "PACKAGE given invalid package name \"" << package << "\". " << "Package names must match \"" << packageExpr << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 3c3c6df..b38c48b 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -275,7 +275,7 @@ static bool checkInterfaceDirs(const std::string &prepro, e << "Target \"" << target->GetName() << "\" " "INTERFACE_INCLUDE_DIRECTORIES property contains relative path:\n" " \"" << *li << "\""; - target->GetMakefile()->IssueMessage(messageType, e.str().c_str()); + target->GetMakefile()->IssueMessage(messageType, e.str()); } if (isSubDirectory(li->c_str(), installDir)) { @@ -286,7 +286,7 @@ static bool checkInterfaceDirs(const std::string &prepro, e << "Target \"" << target->GetName() << "\" " "INTERFACE_INCLUDE_DIRECTORIES property contains path:\n" " \"" << *li << "\"\nwhich is prefixed in the build directory."; - target->GetMakefile()->IssueMessage(messageType, e.str().c_str()); + target->GetMakefile()->IssueMessage(messageType, e.str()); } if (!inSourceBuild) { @@ -295,7 +295,7 @@ static bool checkInterfaceDirs(const std::string &prepro, e << "Target \"" << target->GetName() << "\" " "INTERFACE_INCLUDE_DIRECTORIES property contains path:\n" " \"" << *li << "\"\nwhich is prefixed in the source directory."; - target->GetMakefile()->IssueMessage(messageType, e.str().c_str()); + target->GetMakefile()->IssueMessage(messageType, e.str()); } } } @@ -498,14 +498,14 @@ void cmExportFileGenerator::PopulateCompatibleInterfaceProperties( for (std::vector<std::string>::const_iterator ci = configNames.begin(); ci != configNames.end(); ++ci) { - getCompatibleInterfaceProperties(target, ifaceProperties, ci->c_str()); + getCompatibleInterfaceProperties(target, ifaceProperties, *ci); } } for (std::set<std::string>::const_iterator it = ifaceProperties.begin(); it != ifaceProperties.end(); ++it) { - this->PopulateInterfaceProperty(("INTERFACE_" + *it).c_str(), + this->PopulateInterfaceProperty("INTERFACE_" + *it, target, properties); } } @@ -712,7 +712,7 @@ cmExportFileGenerator const char *propContent; if (const char *prop_suffixed = target->GetProperty( - ("LINK_INTERFACE_LIBRARIES" + suffix).c_str())) + "LINK_INTERFACE_LIBRARIES" + suffix)) { propContent = prop_suffixed; } diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 5e7d5e4..3dc1f6c 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -211,7 +211,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) ci = this->Configurations.begin(); ci != this->Configurations.end(); ++ci) { - if(!this->GenerateImportFileConfig(ci->c_str(), missingTargets)) + if(!this->GenerateImportFileConfig(*ci, missingTargets)) { result = false; } diff --git a/Source/cmExportLibraryDependenciesCommand.cxx b/Source/cmExportLibraryDependenciesCommand.cxx index b04b937..688d2eb 100644 --- a/Source/cmExportLibraryDependenciesCommand.cxx +++ b/Source/cmExportLibraryDependenciesCommand.cxx @@ -138,7 +138,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const break; } std::string lib = li->first; - if(cmTarget* libtgt = global->FindTarget(lib.c_str())) + if(cmTarget* libtgt = global->FindTarget(lib)) { // Handle simple output name changes. This command is // deprecated so we do not support full target name diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx index fe8c8ec..3350d7c 100644 --- a/Source/cmExportTryCompileFileGenerator.cxx +++ b/Source/cmExportTryCompileFileGenerator.cxx @@ -102,7 +102,7 @@ cmExportTryCompileFileGenerator::PopulateProperties(cmTarget const* target, { const std::string libs = i->second.GetValue(); - std::string evalResult = this->FindTargets(i->first.c_str(), + std::string evalResult = this->FindTargets(i->first, target, emitted); std::vector<std::string> depends; @@ -129,7 +129,7 @@ cmExportTryCompileFileGenerator::InstallNameDir(cmTarget* target, if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME")) { install_name_dir = - target->GetInstallNameDirForBuildTree(config.c_str()); + target->GetInstallNameDirForBuildTree(config); } return install_name_dir; diff --git a/Source/cmExternalMakefileProjectGenerator.cxx b/Source/cmExternalMakefileProjectGenerator.cxx index d89a1c8..9264671 100644 --- a/Source/cmExternalMakefileProjectGenerator.cxx +++ b/Source/cmExternalMakefileProjectGenerator.cxx @@ -60,7 +60,7 @@ std::string cmExternalMakefileProjectGenerator::GetGlobalGeneratorName( it != this->SupportedGlobalGenerators.end(); ++it) { - if (this->CreateFullGeneratorName(it->c_str(), this->GetName()) + if (this->CreateFullGeneratorName(*it, this->GetName()) == currentName) { return *it; diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index 03f59c4..edb9c38 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -334,7 +334,7 @@ void cmExtraCodeBlocksGenerator if (strcmp(makefile->GetStartOutputDirectory(), makefile->GetHomeOutputDirectory())==0) { - this->AppendTarget(fout, ti->first.c_str(), 0, + this->AppendTarget(fout, ti->first, 0, make.c_str(), makefile, compiler.c_str()); } } @@ -350,7 +350,7 @@ void cmExtraCodeBlocksGenerator break; } - this->AppendTarget(fout, ti->first.c_str(), 0, + this->AppendTarget(fout, ti->first, 0, make.c_str(), makefile, compiler.c_str()); break; case cmTarget::EXECUTABLE: @@ -359,11 +359,11 @@ void cmExtraCodeBlocksGenerator case cmTarget::MODULE_LIBRARY: case cmTarget::OBJECT_LIBRARY: { - this->AppendTarget(fout, ti->first.c_str(), &ti->second, + this->AppendTarget(fout, ti->first, &ti->second, make.c_str(), makefile, compiler.c_str()); std::string fastTarget = ti->first; fastTarget += "/fast"; - this->AppendTarget(fout, fastTarget.c_str(), &ti->second, + this->AppendTarget(fout, fastTarget, &ti->second, make.c_str(), makefile, compiler.c_str()); } break; @@ -626,7 +626,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, if (!systemIncludeDirs.empty()) { std::vector<std::string> dirs; - cmSystemTools::ExpandListArgument(systemIncludeDirs.c_str(), dirs); + cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs); for(std::vector<std::string>::const_iterator dirIt=dirs.begin(); dirIt != dirs.end(); ++dirIt) @@ -640,7 +640,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, if (!systemIncludeDirs.empty()) { std::vector<std::string> dirs; - cmSystemTools::ExpandListArgument(systemIncludeDirs.c_str(), dirs); + cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs); for(std::vector<std::string>::const_iterator dirIt=dirs.begin(); dirIt != dirs.end(); ++dirIt) @@ -697,7 +697,7 @@ std::string cmExtraCodeBlocksGenerator::GetCBCompilerId(const cmMakefile* mf) std::string hostSystemName = mf->GetSafeDefinition("CMAKE_HOST_SYSTEM_NAME"); std::string systemName = mf->GetSafeDefinition("CMAKE_SYSTEM_NAME"); - std::string compilerId = mf->GetSafeDefinition(compilerIdVar.c_str()); + std::string compilerId = mf->GetSafeDefinition(compilerIdVar); std::string compiler = "gcc"; // default to gcc if (compilerId == "MSVC") { diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index 5a9e125..da397b1 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -404,7 +404,7 @@ cmExtraCodeLiteGenerator::GetCodeLiteCompilerName(const cmMakefile* mf) const compilerIdVar = "CMAKE_C_COMPILER_ID"; } - std::string compilerId = mf->GetSafeDefinition(compilerIdVar.c_str()); + std::string compilerId = mf->GetSafeDefinition(compilerIdVar); std::string compiler = "gnu g++"; // default to g++ // Since we need the compiler for parsing purposes only diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 4aabc7e..d02e54d 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -205,7 +205,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout, std::string cacheEntryName = "CMAKE_ECLIPSE_ENVVAR_"; cacheEntryName += envVar; const char* cacheValue = mf->GetCacheManager()->GetCacheValue( - cacheEntryName.c_str()); + cacheEntryName); // now we have both, decide which one to use std::string valueToUse; @@ -219,7 +219,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout, // The variable is in the env, but not in the cache. Use it and put it // in the cache valueToUse = envVarValue; - mf->AddCacheDefinition(cacheEntryName.c_str(), valueToUse.c_str(), + mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(), cacheEntryName.c_str(), cmCacheManager::STRING, true); mf->GetCacheManager()->SaveCache(mf->GetHomeOutputDirectory()); @@ -240,7 +240,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout, if (valueToUse.find(envVarValue) == std::string::npos) { valueToUse = envVarValue; - mf->AddCacheDefinition(cacheEntryName.c_str(), valueToUse.c_str(), + mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(), cacheEntryName.c_str(), cmCacheManager::STRING, true); mf->GetCacheManager()->SaveCache(mf->GetHomeOutputDirectory()); @@ -981,7 +981,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const std::string systemIncludeDirs = mf->GetSafeDefinition( "CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS"); std::vector<std::string> dirs; - cmSystemTools::ExpandListArgument(systemIncludeDirs.c_str(), dirs); + cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs); this->AppendIncludeDirectories(fout, dirs, emmited); } compiler = mf->GetSafeDefinition("CMAKE_CXX_COMPILER"); @@ -990,7 +990,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const std::string systemIncludeDirs = mf->GetSafeDefinition( "CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS"); std::vector<std::string> dirs; - cmSystemTools::ExpandListArgument(systemIncludeDirs.c_str(), dirs); + cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs); this->AppendIncludeDirectories(fout, dirs, emmited); } diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx index f973a84..ec5ffc2 100644 --- a/Source/cmExtraSublimeTextGenerator.cxx +++ b/Source/cmExtraSublimeTextGenerator.cxx @@ -177,7 +177,7 @@ void cmExtraSublimeTextGenerator:: if (strcmp(makefile->GetStartOutputDirectory(), makefile->GetHomeOutputDirectory())==0) { - this->AppendTarget(fout, ti->first.c_str(), *lg, 0, + this->AppendTarget(fout, ti->first, *lg, 0, make.c_str(), makefile, compiler.c_str(), sourceFileFlags, false); } @@ -194,7 +194,7 @@ void cmExtraSublimeTextGenerator:: break; } - this->AppendTarget(fout, ti->first.c_str(), *lg, 0, + this->AppendTarget(fout, ti->first, *lg, 0, make.c_str(), makefile, compiler.c_str(), sourceFileFlags, false); break; @@ -204,12 +204,12 @@ void cmExtraSublimeTextGenerator:: case cmTarget::MODULE_LIBRARY: case cmTarget::OBJECT_LIBRARY: { - this->AppendTarget(fout, ti->first.c_str(), *lg, &ti->second, + this->AppendTarget(fout, ti->first, *lg, &ti->second, make.c_str(), makefile, compiler.c_str(), sourceFileFlags, false); std::string fastTarget = ti->first; fastTarget += "/fast"; - this->AppendTarget(fout, fastTarget.c_str(), *lg, &ti->second, + this->AppendTarget(fout, fastTarget, *lg, &ti->second, make.c_str(), makefile, compiler.c_str(), sourceFileFlags, false); } @@ -440,7 +440,7 @@ ComputeDefines(cmSourceFile *source, cmLocalGenerator* lg, cmTarget *target, { std::string defPropName = "COMPILE_DEFINITIONS_"; defPropName += cmSystemTools::UpperCase(config); - lg->AppendDefines(defines, source->GetProperty(defPropName.c_str())); + lg->AppendDefines(defines, source->GetProperty(defPropName)); } std::string definesString; diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx index dd99c43..0a36b82 100644 --- a/Source/cmFLTKWrapUICommand.cxx +++ b/Source/cmFLTKWrapUICommand.cxx @@ -48,7 +48,7 @@ bool cmFLTKWrapUICommand for(std::vector<std::string>::iterator i = (newArgs.begin() + 1); i != newArgs.end(); i++) { - cmSourceFile *curr = this->Makefile->GetSource(i->c_str()); + cmSourceFile *curr = this->Makefile->GetSource(*i); // if we should use the source GUI // to generate .cxx and .h files if (!curr || !curr->GetPropertyAsBool("WRAP_EXCLUDE")) @@ -81,16 +81,16 @@ bool cmFLTKWrapUICommand std::string no_main_dependency = ""; const char* no_comment = 0; const char* no_working_dir = 0; - this->Makefile->AddCustomCommandToOutput(cxxres.c_str(), + this->Makefile->AddCustomCommandToOutput(cxxres, depends, no_main_dependency, commandLines, no_comment, no_working_dir); - this->Makefile->AddCustomCommandToOutput(hname.c_str(), + this->Makefile->AddCustomCommandToOutput(hname, depends, no_main_dependency, commandLines, no_comment, no_working_dir); - cmSourceFile *sf = this->Makefile->GetSource(cxxres.c_str()); + cmSourceFile *sf = this->Makefile->GetSource(cxxres); sf->AddDepend(hname.c_str()); sf->AddDepend(origname.c_str()); this->GeneratedSourcesClasses.push_back(sf); @@ -110,7 +110,7 @@ bool cmFLTKWrapUICommand } std::string varName = this->Target; varName += "_FLTK_UI_SRCS"; - this->Makefile->AddDefinition(varName.c_str(), sourceListValue.c_str()); + this->Makefile->AddDefinition(varName, sourceListValue.c_str()); return true; } diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index e79bc6c..9fabdc7 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -174,7 +174,7 @@ bool cmFileCommand } std::string e = "does not recognize sub-command "+subCommand; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -205,7 +205,7 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args, std::string e = "attempted to write a file: " + fileName + " into a source directory."; - this->SetError(e.c_str()); + this->SetError(e); cmSystemTools::SetFatalErrorOccured(); return false; } @@ -235,7 +235,7 @@ bool cmFileCommand::HandleWriteCommand(std::vector<std::string> const& args, std::string error = "Internal CMake error when trying to open file: "; error += fileName.c_str(); error += " for writing."; - this->SetError(error.c_str()); + this->SetError(error); return false; } file << message; @@ -295,7 +295,7 @@ bool cmFileCommand::HandleReadCommand(std::vector<std::string> const& args) std::string error = "Internal CMake error when trying to open file: "; error += fileName.c_str(); error += " for reading."; - this->SetError(error.c_str()); + this->SetError(error); return false; } @@ -359,7 +359,7 @@ bool cmFileCommand::HandleReadCommand(std::vector<std::string> const& args) } } } - this->Makefile->AddDefinition(variable.c_str(), output.c_str()); + this->Makefile->AddDefinition(variable, output.c_str()); return true; } @@ -371,23 +371,23 @@ bool cmFileCommand::HandleHashCommand(std::vector<std::string> const& args) { cmOStringStream e; e << args[0] << " requires a file name and output variable"; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } cmsys::auto_ptr<cmCryptoHash> hash(cmCryptoHash::New(args[0].c_str())); if(hash.get()) { - std::string out = hash->HashFile(args[1].c_str()); + std::string out = hash->HashFile(args[1]); if(!out.empty()) { - this->Makefile->AddDefinition(args[2].c_str(), out.c_str()); + this->Makefile->AddDefinition(args[2], out.c_str()); return true; } cmOStringStream e; e << args[0] << " failed to read file \"" << args[1] << "\": " << cmSystemTools::GetLastSystemError(); - this->SetError(e.str().c_str()); + this->SetError(e.str()); } return false; #else @@ -481,7 +481,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args) cmOStringStream e; e << "STRINGS option LIMIT_INPUT value \"" << args[i] << "\" is not an unsigned integer."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } arg_mode = arg_none; @@ -494,7 +494,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args) cmOStringStream e; e << "STRINGS option LIMIT_OUTPUT value \"" << args[i] << "\" is not an unsigned integer."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } arg_mode = arg_none; @@ -507,7 +507,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args) cmOStringStream e; e << "STRINGS option LIMIT_COUNT value \"" << args[i] << "\" is not an unsigned integer."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } limit_count = count; @@ -521,7 +521,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args) cmOStringStream e; e << "STRINGS option LENGTH_MINIMUM value \"" << args[i] << "\" is not an unsigned integer."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } minlen = len; @@ -535,7 +535,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args) cmOStringStream e; e << "STRINGS option LENGTH_MAXIMUM value \"" << args[i] << "\" is not an unsigned integer."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } maxlen = len; @@ -548,7 +548,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args) cmOStringStream e; e << "STRINGS option REGEX value \"" << args[i] << "\" could not be compiled."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } have_regex = true; @@ -559,7 +559,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args) cmOStringStream e; e << "STRINGS given unknown argument \"" << args[i] << "\""; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -586,7 +586,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args) { cmOStringStream e; e << "STRINGS file \"" << fileName << "\" cannot be read."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -709,7 +709,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args) } // Save the output in a makefile variable. - this->Makefile->AddDefinition(outVar.c_str(), output.c_str()); + this->Makefile->AddDefinition(outVar, output.c_str()); return true; } @@ -844,7 +844,7 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args, } } - this->Makefile->AddDefinition(variable.c_str(), output.c_str()); + this->Makefile->AddDefinition(variable, output.c_str()); return true; } @@ -873,14 +873,14 @@ bool cmFileCommand::HandleMakeDirectoryCommand( { std::string e = "attempted to create a directory: " + *cdir + " into a source directory."; - this->SetError(e.c_str()); + this->SetError(e); cmSystemTools::SetFatalErrorOccured(); return false; } if ( !cmSystemTools::MakeDirectory(cdir->c_str()) ) { std::string error = "problem creating directory: " + *cdir; - this->SetError(error.c_str()); + this->SetError(error); return false; } } @@ -926,7 +926,7 @@ cmFileCommand::HandleDifferentCommand(std::vector<std::string> const& args) { cmOStringStream e; e << "DIFFERENT given unknown argument " << args[i]; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -1041,7 +1041,7 @@ protected: { cmOStringStream e; e << this->Name << " cannot set permissions on \"" << toFile << "\""; - this->FileCommand->SetError(e.str().c_str()); + this->FileCommand->SetError(e.str()); return false; } return true; @@ -1065,7 +1065,7 @@ protected: { cmOStringStream e; e << this->Name << " given invalid permission \"" << arg << "\"."; - this->FileCommand->SetError(e.str().c_str()); + this->FileCommand->SetError(e.str()); return false; } return true; @@ -1092,7 +1092,7 @@ protected: // The input file does not exist and installation is not optional. cmOStringStream e; e << this->Name << " cannot find \"" << fromFile << "\"."; - this->FileCommand->SetError(e.str().c_str()); + this->FileCommand->SetError(e.str()); return false; } @@ -1125,14 +1125,14 @@ protected: { cmOStringStream e; e << "option " << arg << " may not appear before PATTERN or REGEX."; - this->FileCommand->SetError(e.str().c_str()); + this->FileCommand->SetError(e.str()); this->Doing = DoingError; } void NotAfterMatch(std::string const& arg) { cmOStringStream e; e << "option " << arg << " may not appear after PATTERN or REGEX."; - this->FileCommand->SetError(e.str().c_str()); + this->FileCommand->SetError(e.str()); this->Doing = DoingError; } virtual void DefaultFilePermissions() @@ -1170,7 +1170,7 @@ bool cmFileCopier::Parse(std::vector<std::string> const& args) { cmOStringStream e; e << "called with unknown argument \"" << args[i] << "\"."; - this->FileCommand->SetError(e.str().c_str()); + this->FileCommand->SetError(e.str()); return false; } @@ -1186,7 +1186,7 @@ bool cmFileCopier::Parse(std::vector<std::string> const& args) { cmOStringStream e; e << this->Name << " given no DESTINATION"; - this->FileCommand->SetError(e.str().c_str()); + this->FileCommand->SetError(e.str()); return false; } @@ -1366,7 +1366,7 @@ bool cmFileCopier::CheckValue(std::string const& arg) { cmOStringStream e; e << "could not compile PATTERN \"" << arg << "\"."; - this->FileCommand->SetError(e.str().c_str()); + this->FileCommand->SetError(e.str()); this->Doing = DoingError; } } @@ -1382,7 +1382,7 @@ bool cmFileCopier::CheckValue(std::string const& arg) { cmOStringStream e; e << "could not compile REGEX \"" << arg << "\"."; - this->FileCommand->SetError(e.str().c_str()); + this->FileCommand->SetError(e.str()); this->Doing = DoingError; } break; @@ -1462,7 +1462,7 @@ bool cmFileCopier::Install(const char* fromFile, const char* toFile) { cmOStringStream e; e << "INSTALL encountered an empty string input file name."; - this->FileCommand->SetError(e.str().c_str()); + this->FileCommand->SetError(e.str()); return false; } @@ -1504,7 +1504,7 @@ bool cmFileCopier::InstallSymlink(const char* fromFile, const char* toFile) cmOStringStream e; e << this->Name << " cannot read symlink \"" << fromFile << "\" to duplicate at \"" << toFile << "\"."; - this->FileCommand->SetError(e.str().c_str()); + this->FileCommand->SetError(e.str()); return false; } @@ -1537,7 +1537,7 @@ bool cmFileCopier::InstallSymlink(const char* fromFile, const char* toFile) cmOStringStream e; e << this->Name << " cannot duplicate symlink \"" << fromFile << "\" at \"" << toFile << "\"."; - this->FileCommand->SetError(e.str().c_str()); + this->FileCommand->SetError(e.str()); return false; } } @@ -1569,7 +1569,7 @@ bool cmFileCopier::InstallFile(const char* fromFile, const char* toFile, cmOStringStream e; e << this->Name << " cannot copy file \"" << fromFile << "\" to \"" << toFile << "\"."; - this->FileCommand->SetError(e.str().c_str()); + this->FileCommand->SetError(e.str()); return false; } @@ -1588,7 +1588,7 @@ bool cmFileCopier::InstallFile(const char* fromFile, const char* toFile, cmOStringStream e; e << this->Name << " cannot set modification time on \"" << toFile << "\""; - this->FileCommand->SetError(e.str().c_str()); + this->FileCommand->SetError(e.str()); return false; } } @@ -1619,7 +1619,7 @@ bool cmFileCopier::InstallDirectory(const char* source, cmOStringStream e; e << this->Name << " cannot make directory \"" << destination << "\": " << cmSystemTools::GetLastSystemError(); - this->FileCommand->SetError(e.str().c_str()); + this->FileCommand->SetError(e.str()); return false; } @@ -1910,7 +1910,7 @@ bool cmFileInstaller::CheckKeyword(std::string const& arg) e << "INSTALL called with old-style " << arg << " argument. " << "This script was generated with an older version of CMake. " << "Re-run this cmake version on your build tree."; - this->FileCommand->SetError(e.str().c_str()); + this->FileCommand->SetError(e.str()); this->Doing = DoingError; } else @@ -1976,7 +1976,7 @@ bool cmFileInstaller { cmOStringStream e; e << "Option TYPE given unknown value \"" << stype << "\"."; - this->FileCommand->SetError(e.str().c_str()); + this->FileCommand->SetError(e.str()); return false; } return true; @@ -2047,7 +2047,7 @@ bool cmFileInstaller::HandleInstallDestination() "absolute path or remove DESTDIR environment variable." "\nDESTINATION=\n"; message += destination; - this->FileCommand->SetError(message.c_str()); + this->FileCommand->SetError(message); return false; } } @@ -2061,7 +2061,7 @@ bool cmFileInstaller::HandleInstallDestination() { std::string errstring = "cannot create directory: " + destination + ". Maybe need administrative privileges."; - this->FileCommand->SetError(errstring.c_str()); + this->FileCommand->SetError(errstring); return false; } } @@ -2069,7 +2069,7 @@ bool cmFileInstaller::HandleInstallDestination() { std::string errstring = "INSTALL destination: " + destination + " is not a directory."; - this->FileCommand->SetError(errstring.c_str()); + this->FileCommand->SetError(errstring); return false; } return true; @@ -2118,7 +2118,7 @@ cmFileCommand::HandleRPathChangeCommand(std::vector<std::string> const& args) { cmOStringStream e; e << "RPATH_CHANGE given unknown argument " << args[i]; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -2141,7 +2141,7 @@ cmFileCommand::HandleRPathChangeCommand(std::vector<std::string> const& args) { cmOStringStream e; e << "RPATH_CHANGE given FILE \"" << file << "\" that does not exist."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } bool success = true; @@ -2157,7 +2157,7 @@ cmFileCommand::HandleRPathChangeCommand(std::vector<std::string> const& args) << "to the file:\n" << " " << file << "\n" << emsg; - this->SetError(e.str().c_str()); + this->SetError(e.str()); success = false; } if(success) @@ -2203,7 +2203,7 @@ cmFileCommand::HandleRPathRemoveCommand(std::vector<std::string> const& args) { cmOStringStream e; e << "RPATH_REMOVE given unknown argument " << args[i]; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -2216,7 +2216,7 @@ cmFileCommand::HandleRPathRemoveCommand(std::vector<std::string> const& args) { cmOStringStream e; e << "RPATH_REMOVE given FILE \"" << file << "\" that does not exist."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } bool success = true; @@ -2230,7 +2230,7 @@ cmFileCommand::HandleRPathRemoveCommand(std::vector<std::string> const& args) e << "RPATH_REMOVE could not remove RPATH from file:\n" << " " << file << "\n" << emsg; - this->SetError(e.str().c_str()); + this->SetError(e.str()); success = false; } if(success) @@ -2284,7 +2284,7 @@ cmFileCommand::HandleRPathCheckCommand(std::vector<std::string> const& args) { cmOStringStream e; e << "RPATH_CHECK given unknown argument " << args[i]; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -2337,7 +2337,7 @@ bool cmFileCommand::HandleRelativePathCommand( std::string errstring = "RELATIVE_PATH must be passed a full path to the directory: " + directoryName; - this->SetError(errstring.c_str()); + this->SetError(errstring); return false; } if(!cmSystemTools::FileIsFullPath(fileName.c_str())) @@ -2345,13 +2345,13 @@ bool cmFileCommand::HandleRelativePathCommand( std::string errstring = "RELATIVE_PATH must be passed a full path to the file: " + fileName; - this->SetError(errstring.c_str()); + this->SetError(errstring); return false; } std::string res = cmSystemTools::RelativePath(directoryName.c_str(), fileName.c_str()); - this->Makefile->AddDefinition(outVar.c_str(), + this->Makefile->AddDefinition(outVar, res.c_str()); return true; } @@ -2389,7 +2389,7 @@ bool cmFileCommand::HandleRename(std::vector<std::string> const& args) << "to\n" << " " << newname << "\n" << "because: " << err << "\n"; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } return true; @@ -2649,7 +2649,7 @@ namespace { { \ std::string e(errstr); \ e += ::curl_easy_strerror(result); \ - this->SetError(e.c_str()); \ + this->SetError(e); \ return false; \ } @@ -2785,7 +2785,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) std::string err = "DOWNLOAD EXPECTED_HASH expects ALGO=value but got: "; err += *i; - this->SetError(err.c_str()); + this->SetError(err); return false; } std::string algo = i->substr(0, pos); @@ -2795,7 +2795,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) { std::string err = "DOWNLOAD EXPECTED_HASH given unknown ALGO: "; err += algo; - this->SetError(err.c_str()); + this->SetError(err); return false; } hashMatchMSG = algo + " hash"; @@ -2809,7 +2809,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) if(cmSystemTools::FileExists(file.c_str()) && hash.get()) { std::string msg; - std::string actualHash = hash->HashFile(file.c_str()); + std::string actualHash = hash->HashFile(file); if(actualHash == expectedHash) { msg = "returning early; file already exists with expected "; @@ -2819,7 +2819,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) { cmOStringStream result; result << (int)0 << ";\"" << msg; - this->Makefile->AddDefinition(statusVar.c_str(), + this->Makefile->AddDefinition(statusVar, result.str().c_str()); } return true; @@ -2828,14 +2828,14 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) // Make sure parent directory exists so we can write to the file // as we receive downloaded bits from curl... // - std::string dir = cmSystemTools::GetFilenamePath(file.c_str()); + std::string dir = cmSystemTools::GetFilenamePath(file); if(!cmSystemTools::FileExists(dir.c_str()) && !cmSystemTools::MakeDirectory(dir.c_str())) { std::string errstring = "DOWNLOAD error: cannot create directory '" + dir + "' - Specify file by full path name and verify that you " "have directory creation and file write privileges."; - this->SetError(errstring.c_str()); + this->SetError(errstring); return false; } @@ -2954,7 +2954,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) { cmOStringStream result; result << (int)res << ";\"" << ::curl_easy_strerror(res) << "\""; - this->Makefile->AddDefinition(statusVar.c_str(), + this->Makefile->AddDefinition(statusVar, result.str().c_str()); } @@ -2969,7 +2969,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) // if (hash.get()) { - std::string actualHash = hash->HashFile(file.c_str()); + std::string actualHash = hash->HashFile(file); if (actualHash.size() == 0) { this->SetError("DOWNLOAD cannot compute hash on downloaded file"); @@ -2986,7 +2986,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) << " status: [" << (int)res << ";\"" << ::curl_easy_strerror(res) << "\"]" << std::endl ; - this->SetError(oss.str().c_str()); + this->SetError(oss.str()); return false; } } @@ -3000,12 +3000,12 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) if(verboseLog.size()) { - this->Makefile->AddDefinition(verboseLog.c_str(), + this->Makefile->AddDefinition(verboseLog, &*chunkDebug.begin()); } } - this->Makefile->AddDefinition(verboseLog.c_str(), + this->Makefile->AddDefinition(verboseLog, &*chunkDebug.begin()); } @@ -3102,7 +3102,7 @@ cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args) { std::string errStr = "UPLOAD cannot open file '"; errStr += filename + "' for reading."; - this->SetError(errStr.c_str()); + this->SetError(errStr); return false; } @@ -3111,7 +3111,7 @@ cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args) { std::string errStr = "UPLOAD cannot stat file '"; errStr += filename + "'."; - this->SetError(errStr.c_str()); + this->SetError(errStr); fclose(fin); return false; } @@ -3217,7 +3217,7 @@ cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args) { cmOStringStream result; result << (int)res << ";\"" << ::curl_easy_strerror(res) << "\""; - this->Makefile->AddDefinition(statusVar.c_str(), + this->Makefile->AddDefinition(statusVar, result.str().c_str()); } @@ -3246,7 +3246,7 @@ cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args) log += "\n"; } - this->Makefile->AddDefinition(logVar.c_str(), log.c_str()); + this->Makefile->AddDefinition(logVar, log.c_str()); } return true; @@ -3368,7 +3368,7 @@ bool cmFileCommand::HandleTimestampCommand( { std::string e = " TIMESTAMP sub-command does not recognize option " + args[argsIndex] + "."; - this->SetError(e.c_str()); + this->SetError(e); return false; } } @@ -3376,7 +3376,7 @@ bool cmFileCommand::HandleTimestampCommand( cmTimestamp timestamp; std::string result = timestamp.FileModificationTime( filename.c_str(), formatString, utcFlag); - this->Makefile->AddDefinition(outputVariable.c_str(), result.c_str()); + this->Makefile->AddDefinition(outputVariable, result.c_str()); return true; } diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index 86fd54b..e4e819a 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -237,7 +237,7 @@ void cmFindBase::AddPrefixPaths(std::vector<std::string> const& in_paths, for(std::vector<std::string>::const_iterator it = in_paths.begin(); it != in_paths.end(); ++it) { - std::string dir = it->c_str(); + std::string dir = *it; if(!subdir.empty() && !dir.empty() && dir[dir.size()-1] != '/') { dir += "/"; @@ -323,7 +323,7 @@ void cmFindBase::AddCMakeVariablePath() var += this->CMakePathName; var += "_PATH"; this->AddCMakePrefixPath("CMAKE_PREFIX_PATH"); - this->AddCMakePath(var.c_str()); + this->AddCMakePath(var); if(this->CMakePathName == "PROGRAM") { @@ -360,7 +360,7 @@ void cmFindBase::AddCMakeSystemVariablePath() var += this->CMakePathName; var += "_PATH"; this->AddCMakePrefixPath("CMAKE_SYSTEM_PREFIX_PATH"); - this->AddCMakePath(var.c_str()); + this->AddCMakePath(var); if(this->CMakePathName == "PROGRAM") { @@ -466,7 +466,7 @@ void cmFindBase::PrintFindStuff() bool cmFindBase::CheckForVariableInCache() { if(const char* cacheValue = - this->Makefile->GetDefinition(this->VariableName.c_str())) + this->Makefile->GetDefinition(this->VariableName)) { cmCacheManager::CacheIterator it = this->Makefile->GetCacheManager()-> diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx index bd75e10..10241f2 100644 --- a/Source/cmFindCommon.cxx +++ b/Source/cmFindCommon.cxx @@ -51,7 +51,7 @@ void cmFindCommon::SelectDefaultRootPathMode() std::string findRootPathVar = "CMAKE_FIND_ROOT_PATH_MODE_"; findRootPathVar += this->CMakePathName; std::string rootPathMode = - this->Makefile->GetSafeDefinition(findRootPathVar.c_str()); + this->Makefile->GetSafeDefinition(findRootPathVar); if (rootPathMode=="NEVER") { this->FindRootPathMode = RootPathModeNoRootPath; @@ -361,7 +361,7 @@ void cmFindCommon::AddUserPath(std::string const& p, // Expand using the view of the target application. std::string expanded = p; cmSystemTools::ExpandRegistryValues(expanded, view); - cmSystemTools::GlobDirs(expanded.c_str(), paths); + cmSystemTools::GlobDirs(expanded, paths); // Executables can be either 32-bit or 64-bit, so expand using the // alternative view. @@ -369,7 +369,7 @@ void cmFindCommon::AddUserPath(std::string const& p, { expanded = p; cmSystemTools::ExpandRegistryValues(expanded, other_view); - cmSystemTools::GlobDirs(expanded.c_str(), paths); + cmSystemTools::GlobDirs(expanded, paths); } } @@ -433,7 +433,7 @@ void cmFindCommon::AddPathInternal(std::string const& in_path, // Insert the path if has not already been emitted. if(this->SearchPathsEmitted.insert(fullPath).second) { - this->SearchPaths.push_back(fullPath.c_str()); + this->SearchPaths.push_back(fullPath); } } diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index 9345d15..fe5e45f 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -37,7 +37,7 @@ bool cmFindLibraryCommand // value. if(this->AlreadyInCacheWithoutMetaInfo) { - this->Makefile->AddCacheDefinition(this->VariableName.c_str(), "", + this->Makefile->AddCacheDefinition(this->VariableName, "", this->VariableDocumentation.c_str(), cmCacheManager::FILEPATH); } @@ -69,14 +69,14 @@ bool cmFindLibraryCommand if(library != "") { // Save the value in the cache - this->Makefile->AddCacheDefinition(this->VariableName.c_str(), + this->Makefile->AddCacheDefinition(this->VariableName, library.c_str(), this->VariableDocumentation.c_str(), cmCacheManager::FILEPATH); return true; } std::string notfound = this->VariableName + "-NOTFOUND"; - this->Makefile->AddCacheDefinition(this->VariableName.c_str(), + this->Makefile->AddCacheDefinition(this->VariableName, notfound.c_str(), this->VariableDocumentation.c_str(), cmCacheManager::FILEPATH); diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 7a4e7f4..1d4e30c 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -223,7 +223,7 @@ bool cmFindPackageCommand } std::string req_var = this->Name + "_FIND_REQUIRED_" + args[i]; - this->AddFindDefinition(req_var.c_str(), isRequired); + this->AddFindDefinition(req_var, isRequired); // Append to the list of required components. components += components_sep; @@ -255,7 +255,7 @@ bool cmFindPackageCommand e << "given CONFIGS option followed by invalid file name \"" << args[i] << "\". The names given must be file names without " << "a path and with a \".cmake\" extension."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } this->Configs.push_back(args[i]); @@ -269,7 +269,7 @@ bool cmFindPackageCommand { cmOStringStream e; e << "called with invalid argument \"" << args[i].c_str() << "\""; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -286,7 +286,7 @@ bool cmFindPackageCommand { e << " " << doubledComponents[i] << "\n"; } - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -309,7 +309,7 @@ bool cmFindPackageCommand e << " " << args[*si] << "\n"; } e << "The options are incompatible."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -327,7 +327,7 @@ bool cmFindPackageCommand // another find_package(<name>) call. std::string mod = this->Name; mod += "_FIND_MODULE"; - if(this->Makefile->IsOn(mod.c_str())) + if(this->Makefile->IsOn(mod)) { if(this->Version.empty()) { @@ -335,17 +335,17 @@ bool cmFindPackageCommand // Requested version string. std::string ver = this->Name; ver += "_FIND_VERSION"; - this->Version = this->Makefile->GetSafeDefinition(ver.c_str()); + this->Version = this->Makefile->GetSafeDefinition(ver); // Whether an exact version is required. std::string exact = this->Name; exact += "_FIND_VERSION_EXACT"; - this->VersionExact = this->Makefile->IsOn(exact.c_str()); + this->VersionExact = this->Makefile->IsOn(exact); } if(components.empty()) { std::string components_var = this->Name + "_FIND_COMPONENTS"; - components = this->Makefile->GetSafeDefinition(components_var.c_str()); + components = this->Makefile->GetSafeDefinition(components_var); } } } @@ -373,7 +373,7 @@ bool cmFindPackageCommand std::string disableFindPackageVar = "CMAKE_DISABLE_FIND_PACKAGE_"; disableFindPackageVar += this->Name; - if(this->Makefile->IsOn(disableFindPackageVar.c_str())) + if(this->Makefile->IsOn(disableFindPackageVar)) { if (this->Required) { @@ -381,7 +381,7 @@ bool cmFindPackageCommand e << "for module " << this->Name << " called with REQUIRED, but " << disableFindPackageVar << " is enabled. A REQUIRED package cannot be disabled."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -488,7 +488,7 @@ void cmFindPackageCommand::SetModuleVariables(const std::string& components) // Store the list of components. std::string components_var = this->Name + "_FIND_COMPONENTS"; - this->AddFindDefinition(components_var.c_str(), components.c_str()); + this->AddFindDefinition(components_var, components.c_str()); if(this->Quiet) { @@ -496,7 +496,7 @@ void cmFindPackageCommand::SetModuleVariables(const std::string& components) // quietly. std::string quietly = this->Name; quietly += "_FIND_QUIETLY"; - this->AddFindDefinition(quietly.c_str(), "1"); + this->AddFindDefinition(quietly, "1"); } if(this->Required) @@ -505,7 +505,7 @@ void cmFindPackageCommand::SetModuleVariables(const std::string& components) // a fatal error if the package is not found. std::string req = this->Name; req += "_FIND_REQUIRED"; - this->AddFindDefinition(req.c_str(), "1"); + this->AddFindDefinition(req, "1"); } if(!this->Version.empty()) @@ -514,23 +514,23 @@ void cmFindPackageCommand::SetModuleVariables(const std::string& components) // package has been requested. std::string ver = this->Name; ver += "_FIND_VERSION"; - this->AddFindDefinition(ver.c_str(), this->Version.c_str()); + this->AddFindDefinition(ver, this->Version.c_str()); char buf[64]; sprintf(buf, "%u", this->VersionMajor); - this->AddFindDefinition((ver+"_MAJOR").c_str(), buf); + this->AddFindDefinition(ver+"_MAJOR", buf); sprintf(buf, "%u", this->VersionMinor); - this->AddFindDefinition((ver+"_MINOR").c_str(), buf); + this->AddFindDefinition(ver+"_MINOR", buf); sprintf(buf, "%u", this->VersionPatch); - this->AddFindDefinition((ver+"_PATCH").c_str(), buf); + this->AddFindDefinition(ver+"_PATCH", buf); sprintf(buf, "%u", this->VersionTweak); - this->AddFindDefinition((ver+"_TWEAK").c_str(), buf); + this->AddFindDefinition(ver+"_TWEAK", buf); sprintf(buf, "%u", this->VersionCount); - this->AddFindDefinition((ver+"_COUNT").c_str(), buf); + this->AddFindDefinition(ver+"_COUNT", buf); // Tell the module whether an exact version has been requested. std::string exact = this->Name; exact += "_FIND_VERSION_EXACT"; - this->AddFindDefinition(exact.c_str(), this->VersionExact? "1":"0"); + this->AddFindDefinition(exact, this->VersionExact? "1":"0"); } } @@ -559,11 +559,11 @@ void cmFindPackageCommand::RestoreFindDefinitions() OriginalDef const& od = i->second; if(od.exists) { - this->Makefile->AddDefinition(i->first.c_str(), od.value.c_str()); + this->Makefile->AddDefinition(i->first, od.value.c_str()); } else { - this->Makefile->RemoveDefinition(i->first.c_str()); + this->Makefile->RemoveDefinition(i->first); } } } @@ -582,9 +582,9 @@ bool cmFindPackageCommand::FindModule(bool& found) found = true; std::string var = this->Name; var += "_FIND_MODULE"; - this->Makefile->AddDefinition(var.c_str(), "1"); + this->Makefile->AddDefinition(var, "1"); bool result = this->ReadListFile(mfile.c_str(), DoPolicyScope); - this->Makefile->RemoveDefinition(var.c_str()); + this->Makefile->RemoveDefinition(var); return result; } return true; @@ -602,7 +602,7 @@ bool cmFindPackageCommand::HandlePackageMode() upperFound += "_FOUND"; // Try to find the config file. - const char* def = this->Makefile->GetDefinition(this->Variable.c_str()); + const char* def = this->Makefile->GetDefinition(this->Variable); // Try to load the config file if the directory is known bool fileFound = false; @@ -627,14 +627,14 @@ bool cmFindPackageCommand::HandlePackageMode() this->FileFound = file; fileFound = true; } - def = this->Makefile->GetDefinition(this->Variable.c_str()); + def = this->Makefile->GetDefinition(this->Variable); } // Search for the config file if it is not already found. if(cmSystemTools::IsOff(def) || !fileFound) { fileFound = this->FindConfig(); - def = this->Makefile->GetDefinition(this->Variable.c_str()); + def = this->Makefile->GetDefinition(this->Variable); } // Sanity check. @@ -659,16 +659,16 @@ bool cmFindPackageCommand::HandlePackageMode() if(fileFound) { - if ((this->Makefile->IsDefinitionSet(foundVar.c_str())) - && (this->Makefile->IsOn(foundVar.c_str()) == false)) + if ((this->Makefile->IsDefinitionSet(foundVar)) + && (this->Makefile->IsOn(foundVar) == false)) { // by removing Foo_FOUND here if it is FALSE, we don't really change // the situation for the Config file which is about to be included, // but we make it possible to detect later on whether the Config file // has set Foo_FOUND to FALSE itself: - this->Makefile->RemoveDefinition(foundVar.c_str()); + this->Makefile->RemoveDefinition(foundVar); } - this->Makefile->RemoveDefinition(notFoundMessageVar.c_str()); + this->Makefile->RemoveDefinition(notFoundMessageVar); // Set the version variables before loading the config file. // It may override them. @@ -681,14 +681,14 @@ bool cmFindPackageCommand::HandlePackageMode() found = true; // Check whether the Config file has set Foo_FOUND to FALSE: - if ((this->Makefile->IsDefinitionSet(foundVar.c_str())) - && (this->Makefile->IsOn(foundVar.c_str()) == false)) + if ((this->Makefile->IsDefinitionSet(foundVar)) + && (this->Makefile->IsOn(foundVar) == false)) { // we get here if the Config file has set Foo_FOUND actively to FALSE found = false; configFileSetFOUNDFalse = true; notFoundMessage = this->Makefile->GetSafeDefinition( - notFoundMessageVar.c_str()); + notFoundMessageVar); } } else @@ -810,18 +810,18 @@ bool cmFindPackageCommand::HandlePackageMode() } // Set a variable marking whether the package was found. - this->Makefile->AddDefinition(foundVar.c_str(), found? "1":"0"); + this->Makefile->AddDefinition(foundVar, found? "1":"0"); // Set a variable naming the configuration file that was found. std::string fileVar = this->Name; fileVar += "_CONFIG"; if(found) { - this->Makefile->AddDefinition(fileVar.c_str(), this->FileFound.c_str()); + this->Makefile->AddDefinition(fileVar, this->FileFound.c_str()); } else { - this->Makefile->RemoveDefinition(fileVar.c_str()); + this->Makefile->RemoveDefinition(fileVar); } std::string consideredConfigsVar = this->Name; @@ -843,10 +843,10 @@ bool cmFindPackageCommand::HandlePackageMode() sep = ";"; } - this->Makefile->AddDefinition(consideredConfigsVar.c_str(), + this->Makefile->AddDefinition(consideredConfigsVar, consideredConfigFiles.c_str()); - this->Makefile->AddDefinition(consideredVersionsVar.c_str(), + this->Makefile->AddDefinition(consideredVersionsVar, consideredVersions.c_str()); return result; @@ -906,7 +906,7 @@ bool cmFindPackageCommand::FindConfig() help += this->Name; help += "."; // We force the value since we do not get here if it was already set. - this->Makefile->AddCacheDefinition(this->Variable.c_str(), + this->Makefile->AddCacheDefinition(this->Variable, init.c_str(), help.c_str(), cmCacheManager::PATH, true); return found; @@ -968,7 +968,7 @@ bool cmFindPackageCommand::ReadListFile(const char* f, PolicyScopeRule psr) std::string e = "Error reading CMake code from \""; e += f; e += "\"."; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -1048,14 +1048,14 @@ void cmFindPackageCommand::AppendSuccessInformation() std::string transitivePropName = "_CMAKE_"; transitivePropName += this->Name + "_TRANSITIVE_DEPENDENCY"; this->Makefile->GetCMakeInstance() - ->SetProperty(transitivePropName.c_str(), "False"); + ->SetProperty(transitivePropName, "False"); } std::string found = this->Name; found += "_FOUND"; std::string upperFound = cmSystemTools::UpperCase(found); - const char* upperResult = this->Makefile->GetDefinition(upperFound.c_str()); - const char* result = this->Makefile->GetDefinition(found.c_str()); + const char* upperResult = this->Makefile->GetDefinition(upperFound); + const char* result = this->Makefile->GetDefinition(found); bool packageFound = ((cmSystemTools::IsOn(result)) || (cmSystemTools::IsOn(upperResult))); @@ -1066,7 +1066,7 @@ void cmFindPackageCommand::AppendSuccessInformation() std::string quietInfoPropName = "_CMAKE_"; quietInfoPropName += this->Name; quietInfoPropName += "_QUIET"; - this->Makefile->GetCMakeInstance()->SetProperty(quietInfoPropName.c_str(), + this->Makefile->GetCMakeInstance()->SetProperty(quietInfoPropName, this->Quiet ? "TRUE" : "FALSE"); // set a global property to record the required version of this package @@ -1080,7 +1080,7 @@ void cmFindPackageCommand::AppendSuccessInformation() versionInfo += " "; versionInfo += this->Version; } - this->Makefile->GetCMakeInstance()->SetProperty(versionInfoPropName.c_str(), + this->Makefile->GetCMakeInstance()->SetProperty(versionInfoPropName, versionInfo.c_str()); if (this->Required) { @@ -1088,7 +1088,7 @@ void cmFindPackageCommand::AppendSuccessInformation() requiredInfoPropName += this->Name; requiredInfoPropName += "_TYPE"; this->Makefile->GetCMakeInstance()->SetProperty( - requiredInfoPropName.c_str(), "REQUIRED"); + requiredInfoPropName, "REQUIRED"); } @@ -1648,25 +1648,25 @@ void cmFindPackageCommand::StoreVersionFound() ver += "_VERSION"; if(this->VersionFound.empty()) { - this->Makefile->RemoveDefinition(ver.c_str()); + this->Makefile->RemoveDefinition(ver); } else { - this->Makefile->AddDefinition(ver.c_str(), this->VersionFound.c_str()); + this->Makefile->AddDefinition(ver, this->VersionFound.c_str()); } // Store the version components. char buf[64]; sprintf(buf, "%u", this->VersionFoundMajor); - this->Makefile->AddDefinition((ver+"_MAJOR").c_str(), buf); + this->Makefile->AddDefinition(ver+"_MAJOR", buf); sprintf(buf, "%u", this->VersionFoundMinor); - this->Makefile->AddDefinition((ver+"_MINOR").c_str(), buf); + this->Makefile->AddDefinition(ver+"_MINOR", buf); sprintf(buf, "%u", this->VersionFoundPatch); - this->Makefile->AddDefinition((ver+"_PATCH").c_str(), buf); + this->Makefile->AddDefinition(ver+"_PATCH", buf); sprintf(buf, "%u", this->VersionFoundTweak); - this->Makefile->AddDefinition((ver+"_TWEAK").c_str(), buf); + this->Makefile->AddDefinition(ver+"_TWEAK", buf); sprintf(buf, "%u", this->VersionFoundCount); - this->Makefile->AddDefinition((ver+"_COUNT").c_str(), buf); + this->Makefile->AddDefinition(ver+"_COUNT", buf); } //---------------------------------------------------------------------------- diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx index caaf1d3..5531cdf 100644 --- a/Source/cmFindPathCommand.cxx +++ b/Source/cmFindPathCommand.cxx @@ -38,7 +38,7 @@ bool cmFindPathCommand if(this->AlreadyInCacheWithoutMetaInfo) { this->Makefile->AddCacheDefinition( - this->VariableName.c_str(), "", + this->VariableName, "", this->VariableDocumentation.c_str(), (this->IncludeFileInPath ? cmCacheManager::FILEPATH :cmCacheManager::PATH) @@ -51,14 +51,14 @@ bool cmFindPathCommand if(result.size() != 0) { this->Makefile->AddCacheDefinition - (this->VariableName.c_str(), result.c_str(), + (this->VariableName, result.c_str(), this->VariableDocumentation.c_str(), (this->IncludeFileInPath) ? cmCacheManager::FILEPATH :cmCacheManager::PATH); return true; } this->Makefile->AddCacheDefinition - (this->VariableName.c_str(), + (this->VariableName, (this->VariableName + "-NOTFOUND").c_str(), this->VariableDocumentation.c_str(), (this->IncludeFileInPath) ? diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx index bb27753..f6e37f6 100644 --- a/Source/cmFindProgramCommand.cxx +++ b/Source/cmFindProgramCommand.cxx @@ -35,7 +35,7 @@ bool cmFindProgramCommand // value. if(this->AlreadyInCacheWithoutMetaInfo) { - this->Makefile->AddCacheDefinition(this->VariableName.c_str(), "", + this->Makefile->AddCacheDefinition(this->VariableName, "", this->VariableDocumentation.c_str(), cmCacheManager::FILEPATH); } @@ -46,14 +46,14 @@ bool cmFindProgramCommand if(result != "") { // Save the value in the cache - this->Makefile->AddCacheDefinition(this->VariableName.c_str(), + this->Makefile->AddCacheDefinition(this->VariableName, result.c_str(), this->VariableDocumentation.c_str(), cmCacheManager::FILEPATH); return true; } - this->Makefile->AddCacheDefinition(this->VariableName.c_str(), + this->Makefile->AddCacheDefinition(this->VariableName, (this->VariableName + "-NOTFOUND").c_str(), this->VariableDocumentation.c_str(), cmCacheManager::FILEPATH); diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx index d697067..e3f66c1 100644 --- a/Source/cmForEachCommand.cxx +++ b/Source/cmForEachCommand.cxx @@ -35,9 +35,9 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, // at end of for each execute recorded commands // store the old value std::string oldDef; - if (mf.GetDefinition(this->Args[0].c_str())) + if (mf.GetDefinition(this->Args[0])) { - oldDef = mf.GetDefinition(this->Args[0].c_str()); + oldDef = mf.GetDefinition(this->Args[0]); } std::vector<std::string>::const_iterator j = this->Args.begin(); ++j; @@ -47,7 +47,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, for( ; j != this->Args.end(); ++j) { // set the variable to the loop value - mf.AddDefinition(this->Args[0].c_str(),j->c_str()); + mf.AddDefinition(this->Args[0],j->c_str()); // Invoke all the functions that were collected in the block. cmExecutionStatus status; for(unsigned int c = 0; c < this->Functions.size(); ++c) @@ -58,13 +58,13 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, { inStatus.SetReturnInvoked(true); // restore the variable to its prior value - mf.AddDefinition(this->Args[0].c_str(),oldDef.c_str()); + mf.AddDefinition(this->Args[0],oldDef.c_str()); return true; } if (status.GetBreakInvoked()) { // restore the variable to its prior value - mf.AddDefinition(this->Args[0].c_str(),oldDef.c_str()); + mf.AddDefinition(this->Args[0],oldDef.c_str()); return true; } if(cmSystemTools::GetFatalErrorOccured() ) @@ -74,7 +74,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, } } // restore the variable to its prior value - mf.AddDefinition(this->Args[0].c_str(),oldDef.c_str()); + mf.AddDefinition(this->Args[0],oldDef.c_str()); return true; } else @@ -166,7 +166,7 @@ bool cmForEachCommand cmOStringStream str; str << "called with incorrect range specification: start "; str << start << ", stop " << stop << ", step " << step; - this->SetError(str.str().c_str()); + this->SetError(str.str()); return false; } std::vector<std::string> range; @@ -226,7 +226,7 @@ bool cmForEachCommand::HandleInMode(std::vector<std::string> const& args) } else if(doing == DoingLists) { - const char* value = this->Makefile->GetDefinition(args[i].c_str()); + const char* value = this->Makefile->GetDefinition(args[i]); if(value && *value) { cmSystemTools::ExpandListArgument(value, f->Args, true); diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index 9b981a3..3ff527d 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -89,7 +89,7 @@ bool cmFunctionHelperCommand::InvokeInitialPass std::string errorMsg = "Function invoked with incorrect arguments for function named: "; errorMsg += this->Args[0]; - this->SetError(errorMsg.c_str()); + this->SetError(errorMsg); return false; } @@ -113,15 +113,15 @@ bool cmFunctionHelperCommand::InvokeInitialPass { cmOStringStream tmpStream; tmpStream << "ARGV" << t; - this->Makefile->AddDefinition(tmpStream.str().c_str(), + this->Makefile->AddDefinition(tmpStream.str(), expandedArgs[t].c_str()); - this->Makefile->MarkVariableAsUsed(tmpStream.str().c_str()); + this->Makefile->MarkVariableAsUsed(tmpStream.str()); } // define the formal arguments for (unsigned int j = 1; j < this->Args.size(); ++j) { - this->Makefile->AddDefinition(this->Args[j].c_str(), + this->Makefile->AddDefinition(this->Args[j], expandedArgs[j-1].c_str()); } @@ -219,8 +219,8 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, } std::string newName = "_" + this->Args[0]; - mf.GetCMakeInstance()->RenameCommand(this->Args[0].c_str(), - newName.c_str()); + mf.GetCMakeInstance()->RenameCommand(this->Args[0], + newName); mf.AddCommand(f); // remove the function blocker now that the function is defined diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index e4187d2..e127f3a 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -379,7 +379,7 @@ void cmGeneratorExpression::Split(const std::string &input, } if(!part.empty()) { - cmSystemTools::ExpandListArgument(part.c_str(), output); + cmSystemTools::ExpandListArgument(part, output); } } pos += 2; diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx index 04f36b4..07efba9 100644 --- a/Source/cmGeneratorExpressionDAGChecker.cxx +++ b/Source/cmGeneratorExpressionDAGChecker.cxx @@ -92,7 +92,7 @@ void cmGeneratorExpressionDAGChecker::ReportError( << "Self reference on target \"" << context->HeadTarget->GetName() << "\".\n"; context->Makefile->GetCMakeInstance() - ->IssueMessage(cmake::FATAL_ERROR, e.str().c_str(), + ->IssueMessage(cmake::FATAL_ERROR, e.str(), parent->Backtrace); return; } @@ -103,7 +103,7 @@ void cmGeneratorExpressionDAGChecker::ReportError( << " " << expr << "\n" << "Dependency loop found."; context->Makefile->GetCMakeInstance() - ->IssueMessage(cmake::FATAL_ERROR, e.str().c_str(), + ->IssueMessage(cmake::FATAL_ERROR, e.str(), context->Backtrace); } @@ -116,7 +116,7 @@ void cmGeneratorExpressionDAGChecker::ReportError( << (parent->Content ? parent->Content->GetOriginalExpression() : expr) << "\n"; context->Makefile->GetCMakeInstance() - ->IssueMessage(cmake::FATAL_ERROR, e.str().c_str(), + ->IssueMessage(cmake::FATAL_ERROR, e.str(), parent->Backtrace); parent = parent->Parent; ++loopStep; diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx index 90ce27c..d41285d 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.cxx +++ b/Source/cmGeneratorExpressionEvaluationFile.cxx @@ -50,7 +50,7 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, cmOStringStream e; e << "Evaluation file condition \"" << rawCondition << "\" did " "not evaluate to valid content. Got \"" << condResult << "\"."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } } @@ -72,7 +72,7 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, cmOStringStream e; e << "Evaluation file to be written multiple times for different " "configurations with different content:\n " << outputFileName; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } @@ -85,7 +85,7 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, { cmOStringStream e; e << "Evaluation file \"" << outputFileName << "\" cannot be written."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } @@ -109,7 +109,7 @@ void cmGeneratorExpressionEvaluationFile::Generate() { cmOStringStream e; e << "Evaluation file \"" << this->Input << "\" cannot be read."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } @@ -142,7 +142,7 @@ void cmGeneratorExpressionEvaluationFile::Generate() for(std::vector<std::string>::const_iterator li = allConfigs.begin(); li != allConfigs.end(); ++li) { - this->Generate(li->c_str(), inputExpression.get(), outputFiles); + this->Generate(*li, inputExpression.get(), outputFiles); if(cmSystemTools::GetFatalErrorOccured()) { return; diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 43c1794..14b2a1a 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -39,7 +39,7 @@ void reportError(cmGeneratorExpressionContext *context, << " " << expr << "\n" << result; context->Makefile->GetCMakeInstance() - ->IssueMessage(cmake::FATAL_ERROR, e.str().c_str(), + ->IssueMessage(cmake::FATAL_ERROR, e.str(), context->Backtrace); } @@ -393,8 +393,8 @@ struct CompilerIdNode : public cmGeneratorExpressionNode const std::string &lang) const { const char *compilerId = context->Makefile ? - context->Makefile->GetSafeDefinition(( - "CMAKE_" + lang + "_COMPILER_ID").c_str()) : ""; + context->Makefile->GetSafeDefinition( + "CMAKE_" + lang + "_COMPILER_ID") : ""; if (parameters.size() == 0) { return compilerId ? compilerId : ""; @@ -428,7 +428,7 @@ struct CompilerIdNode : public cmGeneratorExpressionNode ->GetPolicyWarning(cmPolicies::CMP0044); context->Makefile->GetCMakeInstance() ->IssueMessage(cmake::AUTHOR_WARNING, - e.str().c_str(), context->Backtrace); + e.str(), context->Backtrace); } case cmPolicies::OLD: return "1"; @@ -500,8 +500,8 @@ struct CompilerVersionNode : public cmGeneratorExpressionNode const std::string &lang) const { const char *compilerVersion = context->Makefile ? - context->Makefile->GetSafeDefinition(( - "CMAKE_" + lang + "_COMPILER_VERSION").c_str()) : ""; + context->Makefile->GetSafeDefinition( + "CMAKE_" + lang + "_COMPILER_VERSION") : ""; if (parameters.size() == 0) { return compilerVersion ? compilerVersion : ""; @@ -747,7 +747,7 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode std::string mapProp = "MAP_IMPORTED_CONFIG_"; mapProp += cmSystemTools::UpperCase(context->Config); if(const char* mapValue = - context->CurrentTarget->GetProperty(mapProp.c_str())) + context->CurrentTarget->GetProperty(mapProp)) { cmSystemTools::ExpandListArgument(cmSystemTools::UpperCase(mapValue), mappedConfigs); @@ -1022,7 +1022,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode break; } - const char *prop = target->GetProperty(propertyName.c_str()); + const char *prop = target->GetProperty(propertyName); if (dagCheckerParent) { diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index eb67f91..db88749 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -688,7 +688,7 @@ void cmTargetTraceDependencies::FollowName(std::string const& name) if(i == this->NameMap.end()) { // Check if we know how to generate this file. - cmSourceFile* sf = this->Makefile->GetSourceFileWithOutput(name.c_str()); + cmSourceFile* sf = this->Makefile->GetSourceFileWithOutput(name); NameMapType::value_type entry(name, sf); i = this->NameMap.insert(entry).first; } @@ -750,7 +750,7 @@ bool cmTargetTraceDependencies::IsUtility(std::string const& dep) tLocation = cmSystemTools::CollapseFullPath(tLocation.c_str()); if(depLocation == tLocation) { - this->Target->AddUtility(util.c_str()); + this->Target->AddUtility(util); return true; } } @@ -759,7 +759,7 @@ bool cmTargetTraceDependencies::IsUtility(std::string const& dep) { // The original name of the dependency was not a full path. It // must name a target, so add the target-level dependency. - this->Target->AddUtility(util.c_str()); + this->Target->AddUtility(util); return true; } } @@ -793,7 +793,7 @@ cmTargetTraceDependencies // this project. Add the target-level dependency to make // sure the executable is up to date before this custom // command possibly runs. - this->Target->AddUtility(command.c_str()); + this->Target->AddUtility(command); } } @@ -872,7 +872,7 @@ void cmGeneratorTarget::GetAppleArchs(const std::string& config, { std::string defVarName = "OSX_ARCHITECTURES_"; defVarName += cmSystemTools::UpperCase(config); - archs = this->Target->GetProperty(defVarName.c_str()); + archs = this->Target->GetProperty(defVarName); } if(!archs) { @@ -1048,7 +1048,7 @@ void cmGeneratorTarget::ConstructSourceFileFlags() const for(std::vector<std::string>::iterator it = relFiles.begin(); it != relFiles.end(); ++it) { - if(cmSourceFile* sf = this->Makefile->GetSource(it->c_str())) + if(cmSourceFile* sf = this->Makefile->GetSource(*it)) { SourceFileFlags& flags = this->SourceFlagsMap[sf]; flags.MacFolder = "Headers"; @@ -1066,7 +1066,7 @@ void cmGeneratorTarget::ConstructSourceFileFlags() const for(std::vector<std::string>::iterator it = relFiles.begin(); it != relFiles.end(); ++it) { - if(cmSourceFile* sf = this->Makefile->GetSource(it->c_str())) + if(cmSourceFile* sf = this->Makefile->GetSource(*it)) { SourceFileFlags& flags = this->SourceFlagsMap[sf]; flags.MacFolder = "PrivateHeaders"; @@ -1083,7 +1083,7 @@ void cmGeneratorTarget::ConstructSourceFileFlags() const for(std::vector<std::string>::iterator it = relFiles.begin(); it != relFiles.end(); ++it) { - if(cmSourceFile* sf = this->Makefile->GetSource(it->c_str())) + if(cmSourceFile* sf = this->Makefile->GetSource(*it)) { SourceFileFlags& flags = this->SourceFlagsMap[sf]; flags.MacFolder = "Resources"; diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx index 5aaf1c6..e88f498 100644 --- a/Source/cmGetCMakePropertyCommand.cxx +++ b/Source/cmGetCMakePropertyCommand.cxx @@ -66,14 +66,14 @@ bool cmGetCMakePropertyCommand else { const char *prop = - this->Makefile->GetCMakeInstance()->GetProperty(args[1].c_str()); + this->Makefile->GetCMakeInstance()->GetProperty(args[1]); if (prop) { output = prop; } } - this->Makefile->AddDefinition(variable.c_str(), output.c_str()); + this->Makefile->AddDefinition(variable, output.c_str()); return true; } diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx index 9e76e1b..fcc3da1 100644 --- a/Source/cmGetDirectoryPropertyCommand.cxx +++ b/Source/cmGetDirectoryPropertyCommand.cxx @@ -54,7 +54,7 @@ bool cmGetDirectoryPropertyCommand // lookup the makefile from the directory name cmLocalGenerator *lg = this->Makefile->GetLocalGenerator()->GetGlobalGenerator()-> - FindLocalGenerator(sd.c_str()); + FindLocalGenerator(sd); if (!lg) { this->SetError @@ -79,18 +79,18 @@ bool cmGetDirectoryPropertyCommand "providing the name of the variable to get."); return false; } - output = dir->GetSafeDefinition(i->c_str()); - this->Makefile->AddDefinition(variable.c_str(), output.c_str()); + output = dir->GetSafeDefinition(*i); + this->Makefile->AddDefinition(variable, output.c_str()); return true; } - const char *prop = dir->GetProperty(i->c_str()); + const char *prop = dir->GetProperty(*i); if (prop) { - this->Makefile->AddDefinition(variable.c_str(), prop); + this->Makefile->AddDefinition(variable, prop); return true; } - this->Makefile->AddDefinition(variable.c_str(), ""); + this->Makefile->AddDefinition(variable, ""); return true; } diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx index 1d7fefc..10406d2 100644 --- a/Source/cmGetFilenameComponentCommand.cxx +++ b/Source/cmGetFilenameComponentCommand.cxx @@ -26,7 +26,7 @@ bool cmGetFilenameComponentCommand // already, if so use that value if(args.size() == 4 && args[3] == "CACHE") { - const char* cacheValue = this->Makefile->GetDefinition(args[0].c_str()); + const char* cacheValue = this->Makefile->GetDefinition(args[0]); if(cacheValue && !cmSystemTools::IsNOTFOUND(cacheValue)) { return true; @@ -107,7 +107,7 @@ bool cmGetFilenameComponentCommand else { std::string err = "unknown component " + args[2]; - this->SetError(err.c_str()); + this->SetError(err); return false; } @@ -116,12 +116,12 @@ bool cmGetFilenameComponentCommand if(programArgs.size() && storeArgs.size()) { this->Makefile->AddCacheDefinition - (storeArgs.c_str(), programArgs.c_str(), + (storeArgs, programArgs.c_str(), "", args[2] == "PATH" ? cmCacheManager::FILEPATH : cmCacheManager::STRING); } this->Makefile->AddCacheDefinition - (args[0].c_str(), result.c_str(), "", + (args[0], result.c_str(), "", args[2] == "PATH" ? cmCacheManager::FILEPATH : cmCacheManager::STRING); } @@ -129,9 +129,9 @@ bool cmGetFilenameComponentCommand { if(programArgs.size() && storeArgs.size()) { - this->Makefile->AddDefinition(storeArgs.c_str(), programArgs.c_str()); + this->Makefile->AddDefinition(storeArgs, programArgs.c_str()); } - this->Makefile->AddDefinition(args[0].c_str(), result.c_str()); + this->Makefile->AddDefinition(args[0], result.c_str()); } return true; diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 30bec16..6dd40c9 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -73,7 +73,7 @@ bool cmGetPropertyCommand e << "given invalid scope " << args[1] << ". " << "Valid scopes are " << "GLOBAL, DIRECTORY, TARGET, SOURCE, TEST, VARIABLE, CACHE."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -120,7 +120,7 @@ bool cmGetPropertyCommand { cmOStringStream e; e << "given invalid argument \"" << args[i] << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -139,7 +139,7 @@ bool cmGetPropertyCommand std::string output; if(cmPropertyDefinition* def = this->Makefile->GetCMakeInstance()-> - GetPropertyDefinition(this->PropertyName.c_str(), scope)) + GetPropertyDefinition(this->PropertyName, scope)) { output = def->GetShortDescription(); } @@ -147,7 +147,7 @@ bool cmGetPropertyCommand { output = "NOTFOUND"; } - this->Makefile->AddDefinition(this->Variable.c_str(), output.c_str()); + this->Makefile->AddDefinition(this->Variable, output.c_str()); } else if(this->InfoType == OutFullDoc) { @@ -155,7 +155,7 @@ bool cmGetPropertyCommand std::string output; if(cmPropertyDefinition* def = this->Makefile->GetCMakeInstance()-> - GetPropertyDefinition(this->PropertyName.c_str(), scope)) + GetPropertyDefinition(this->PropertyName, scope)) { output = def->GetFullDescription(); } @@ -163,19 +163,19 @@ bool cmGetPropertyCommand { output = "NOTFOUND"; } - this->Makefile->AddDefinition(this->Variable.c_str(), output.c_str()); + this->Makefile->AddDefinition(this->Variable, output.c_str()); } else if(this->InfoType == OutDefined) { // Lookup if the property is defined if(this->Makefile->GetCMakeInstance()-> - GetPropertyDefinition(this->PropertyName.c_str(), scope)) + GetPropertyDefinition(this->PropertyName, scope)) { - this->Makefile->AddDefinition(this->Variable.c_str(), "1"); + this->Makefile->AddDefinition(this->Variable, "1"); } else { - this->Makefile->AddDefinition(this->Variable.c_str(), "0"); + this->Makefile->AddDefinition(this->Variable, "0"); } } else @@ -204,17 +204,17 @@ bool cmGetPropertyCommand::StoreResult(const char* value) { if(this->InfoType == OutSet) { - this->Makefile->AddDefinition(this->Variable.c_str(), value? "1":"0"); + this->Makefile->AddDefinition(this->Variable, value? "1":"0"); } else // if(this->InfoType == OutValue) { if(value) { - this->Makefile->AddDefinition(this->Variable.c_str(), value); + this->Makefile->AddDefinition(this->Variable, value); } else { - this->Makefile->RemoveDefinition(this->Variable.c_str()); + this->Makefile->RemoveDefinition(this->Variable); } } return true; @@ -231,7 +231,7 @@ bool cmGetPropertyCommand::HandleGlobalMode() // Get the property. cmake* cm = this->Makefile->GetCMakeInstance(); - return this->StoreResult(cm->GetProperty(this->PropertyName.c_str())); + return this->StoreResult(cm->GetProperty(this->PropertyName)); } //---------------------------------------------------------------------------- @@ -259,7 +259,7 @@ bool cmGetPropertyCommand::HandleDirectoryMode() // Lookup the generator. if(cmLocalGenerator* lg = (this->Makefile->GetLocalGenerator() - ->GetGlobalGenerator()->FindLocalGenerator(dir.c_str()))) + ->GetGlobalGenerator()->FindLocalGenerator(dir))) { // Use the makefile for the directory found. mf = lg->GetMakefile(); @@ -276,7 +276,7 @@ bool cmGetPropertyCommand::HandleDirectoryMode() } // Get the property. - return this->StoreResult(mf->GetProperty(this->PropertyName.c_str())); + return this->StoreResult(mf->GetProperty(this->PropertyName)); } //---------------------------------------------------------------------------- @@ -302,14 +302,14 @@ bool cmGetPropertyCommand::HandleTargetMode() } if(cmTarget* target = this->Makefile->FindTargetToUse(this->Name)) { - return this->StoreResult(target->GetProperty(this->PropertyName.c_str())); + return this->StoreResult(target->GetProperty(this->PropertyName)); } else { cmOStringStream e; e << "could not find TARGET " << this->Name << ". Perhaps it has not yet been created."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -325,17 +325,17 @@ bool cmGetPropertyCommand::HandleSourceMode() // Get the source file. if(cmSourceFile* sf = - this->Makefile->GetOrCreateSource(this->Name.c_str())) + this->Makefile->GetOrCreateSource(this->Name)) { return - this->StoreResult(sf->GetPropertyForUser(this->PropertyName.c_str())); + this->StoreResult(sf->GetPropertyForUser(this->PropertyName)); } else { cmOStringStream e; e << "given SOURCE name that could not be found or created: " << this->Name; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -350,15 +350,15 @@ bool cmGetPropertyCommand::HandleTestMode() } // Loop over all tests looking for matching names. - if(cmTest* test = this->Makefile->GetTest(this->Name.c_str())) + if(cmTest* test = this->Makefile->GetTest(this->Name)) { - return this->StoreResult(test->GetProperty(this->PropertyName.c_str())); + return this->StoreResult(test->GetProperty(this->PropertyName)); } // If not found it is an error. cmOStringStream e; e << "given TEST name that does not exist: " << this->Name; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -372,7 +372,7 @@ bool cmGetPropertyCommand::HandleVariableMode() } return this->StoreResult - (this->Makefile->GetDefinition(this->PropertyName.c_str())); + (this->Makefile->GetDefinition(this->PropertyName)); } //---------------------------------------------------------------------------- @@ -389,7 +389,7 @@ bool cmGetPropertyCommand::HandleCacheMode() this->Makefile->GetCacheManager()->GetCacheIterator(this->Name.c_str()); if(!it.IsAtEnd()) { - value = it.GetProperty(this->PropertyName.c_str()); + value = it.GetProperty(this->PropertyName); } this->StoreResult(value); return true; diff --git a/Source/cmGetSourceFilePropertyCommand.cxx b/Source/cmGetSourceFilePropertyCommand.cxx index a6e4fcc..8a96289 100644 --- a/Source/cmGetSourceFilePropertyCommand.cxx +++ b/Source/cmGetSourceFilePropertyCommand.cxx @@ -38,7 +38,7 @@ bool cmGetSourceFilePropertyCommand this->Makefile->AddDefinition(var, sf->GetLanguage().c_str()); return true; } - const char *prop = sf->GetPropertyForUser(args[2].c_str()); + const char *prop = sf->GetPropertyForUser(args[2]); if (prop) { this->Makefile->AddDefinition(var, prop); diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx index b64f847..e3ec0bc 100644 --- a/Source/cmGetTargetPropertyCommand.cxx +++ b/Source/cmGetTargetPropertyCommand.cxx @@ -20,7 +20,7 @@ bool cmGetTargetPropertyCommand this->SetError("called with incorrect number of arguments"); return false; } - std::string var = args[0].c_str(); + std::string var = args[0]; const std::string& targetName = args[1]; std::string prop; @@ -38,7 +38,7 @@ bool cmGetTargetPropertyCommand else if(cmTarget* tgt = this->Makefile->FindTargetToUse(targetName)) { cmTarget& target = *tgt; - const char* prop_cstr = target.GetProperty(args[2].c_str()); + const char* prop_cstr = target.GetProperty(args[2]); if(prop_cstr) { prop = prop_cstr; @@ -67,7 +67,7 @@ bool cmGetTargetPropertyCommand { e << "get_target_property() called with non-existent target \"" << targetName << "\"."; - this->Makefile->IssueMessage(messageType, e.str().c_str()); + this->Makefile->IssueMessage(messageType, e.str()); if (messageType == cmake::FATAL_ERROR) { return false; @@ -76,10 +76,10 @@ bool cmGetTargetPropertyCommand } if (!prop.empty()) { - this->Makefile->AddDefinition(var.c_str(), prop.c_str()); + this->Makefile->AddDefinition(var, prop.c_str()); return true; } - this->Makefile->AddDefinition(var.c_str(), (var+"-NOTFOUND").c_str()); + this->Makefile->AddDefinition(var, (var+"-NOTFOUND").c_str()); return true; } diff --git a/Source/cmGetTestPropertyCommand.cxx b/Source/cmGetTestPropertyCommand.cxx index 0e0e2c0..b3df4c3 100644 --- a/Source/cmGetTestPropertyCommand.cxx +++ b/Source/cmGetTestPropertyCommand.cxx @@ -26,17 +26,17 @@ bool cmGetTestPropertyCommand std::string testName = args[0]; std::string var = args[2]; - cmTest *test = this->Makefile->GetTest(testName.c_str()); + cmTest *test = this->Makefile->GetTest(testName); if (test) { - const char *prop = test->GetProperty(args[1].c_str()); + const char *prop = test->GetProperty(args[1]); if (prop) { - this->Makefile->AddDefinition(var.c_str(), prop); + this->Makefile->AddDefinition(var, prop); return true; } } - this->Makefile->AddDefinition(var.c_str(), "NOTFOUND"); + this->Makefile->AddDefinition(var, "NOTFOUND"); return true; } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index faed66a..b67da5b 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -123,7 +123,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang, langComp += lang; langComp += "_COMPILER"; - if(!mf->GetDefinition(langComp.c_str())) + if(!mf->GetDefinition(langComp)) { if(!optional) { @@ -132,7 +132,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang, } return; } - const char* name = mf->GetRequiredDefinition(langComp.c_str()); + const char* name = mf->GetRequiredDefinition(langComp); std::string path; if(!cmSystemTools::FileIsFullPath(name)) { @@ -150,7 +150,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang, std::string doc = lang; doc += " compiler."; const char* cname = this->GetCMakeInstance()-> - GetCacheManager()->GetCacheValue(langComp.c_str()); + GetCacheManager()->GetCacheValue(langComp); std::string changeVars; if(cname && !optional) { @@ -185,7 +185,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang, changeVars.c_str()); } } - mf->AddCacheDefinition(langComp.c_str(), path.c_str(), + mf->AddCacheDefinition(langComp, path.c_str(), doc.c_str(), cmCacheManager::FILEPATH); } @@ -457,7 +457,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages, std::string loadedLang = "CMAKE_"; loadedLang += lang; loadedLang += "_COMPILER_LOADED"; - if(!mf->GetDefinition(loadedLang.c_str())) + if(!mf->GetDefinition(loadedLang)) { fpath = rootBin; fpath += "/CMake"; @@ -518,9 +518,9 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages, std::string compilerEnv = "CMAKE_"; compilerEnv += lang; compilerEnv += "_COMPILER_ENV_VAR"; - std::string envVar = mf->GetRequiredDefinition(compilerEnv.c_str()); + std::string envVar = mf->GetRequiredDefinition(compilerEnv); std::string envVarValue = - mf->GetRequiredDefinition(compilerName.c_str()); + mf->GetRequiredDefinition(compilerName); std::string env = envVar; env += "="; env += envVarValue; @@ -578,7 +578,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages, compilerEnv += lang; compilerEnv += "_COMPILER_ENV_VAR"; cmOStringStream noCompiler; - const char* compilerFile = mf->GetDefinition(compilerName.c_str()); + const char* compilerFile = mf->GetDefinition(compilerName); if(!compilerFile || !*compilerFile || cmSystemTools::IsNOTFOUND(compilerFile)) { @@ -621,7 +621,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages, if(!this->CMakeInstance->GetIsInTryCompile()) { this->PrintCompilerAdvice(noCompiler, lang, - mf->GetDefinition(compilerEnv.c_str())); + mf->GetDefinition(compilerEnv)); mf->IssueMessage(cmake::FATAL_ERROR, noCompiler.str()); fatalError = true; } @@ -631,7 +631,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages, std::string langLoadedVar = "CMAKE_"; langLoadedVar += lang; langLoadedVar += "_INFORMATION_LOADED"; - if (!mf->GetDefinition(langLoadedVar.c_str())) + if (!mf->GetDefinition(langLoadedVar)) { fpath = "CMake"; fpath += lang; @@ -678,7 +678,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages, // if the compiler did not work, then remove the // CMake(LANG)Compiler.cmake file so that it will get tested the // next time cmake is run - if(!mf->IsOn(compilerWorks.c_str())) + if(!mf->IsOn(compilerWorks)) { std::string compilerLangFile = rootBin; compilerLangFile += "/CMake"; @@ -693,7 +693,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages, sharedLibFlagsVar += lang; sharedLibFlagsVar += "_FLAGS"; const char* sharedLibFlags = - mf->GetSafeDefinition(sharedLibFlagsVar.c_str()); + mf->GetSafeDefinition(sharedLibFlagsVar); if (sharedLibFlags) { this->LanguageToOriginalSharedLibFlags[lang] = sharedLibFlags; @@ -753,7 +753,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf, std::string const& lang) const { std::string compilerIdVar = "CMAKE_" + lang + "_COMPILER_ID"; - const char* compilerId = mf->GetDefinition(compilerIdVar.c_str()); + const char* compilerId = mf->GetDefinition(compilerIdVar); if(!compilerId) { return; @@ -776,7 +776,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf, } case cmPolicies::OLD: // OLD behavior is to convert AppleClang to Clang. - mf->AddDefinition(compilerIdVar.c_str(), "Clang"); + mf->AddDefinition(compilerIdVar, "Clang"); break; case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: @@ -807,7 +807,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(cmMakefile* mf, } case cmPolicies::OLD: // OLD behavior is to convert QCC to GNU. - mf->AddDefinition(compilerIdVar.c_str(), "GNU"); + mf->AddDefinition(compilerIdVar, "GNU"); break; case cmPolicies::REQUIRED_IF_USED: case cmPolicies::REQUIRED_ALWAYS: @@ -917,7 +917,7 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const std::string& l, std::string linkerPrefVar = std::string("CMAKE_") + std::string(l) + std::string("_LINKER_PREFERENCE"); - const char* linkerPref = mf->GetDefinition(linkerPrefVar.c_str()); + const char* linkerPref = mf->GetDefinition(linkerPrefVar); int preference = 0; if(linkerPref) { @@ -950,7 +950,7 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const std::string& l, std::string outputExtensionVar = std::string("CMAKE_") + std::string(l) + std::string("_OUTPUT_EXTENSION"); - const char* outputExtension = mf->GetDefinition(outputExtensionVar.c_str()); + const char* outputExtension = mf->GetDefinition(outputExtensionVar); if(outputExtension) { this->LanguageToOutputExtension[l] = outputExtension; @@ -968,7 +968,7 @@ void cmGlobalGenerator::SetLanguageEnabledMaps(const std::string& l, std::string ignoreExtensionsVar = std::string("CMAKE_") + std::string(l) + std::string("_IGNORE_EXTENSIONS"); - std::string ignoreExts = mf->GetSafeDefinition(ignoreExtensionsVar.c_str()); + std::string ignoreExts = mf->GetSafeDefinition(ignoreExtensionsVar); std::vector<std::string> extensionList; cmSystemTools::ExpandListArgument(ignoreExts, extensionList); for(std::vector<std::string>::iterator i = extensionList.begin(); @@ -984,7 +984,7 @@ void cmGlobalGenerator::FillExtensionToLanguageMap(const std::string& l, { std::string extensionsVar = std::string("CMAKE_") + std::string(l) + std::string("_SOURCE_FILE_EXTENSIONS"); - std::string exts = mf->GetSafeDefinition(extensionsVar.c_str()); + std::string exts = mf->GetSafeDefinition(extensionsVar); std::vector<std::string> extensionList; cmSystemTools::ExpandListArgument(exts, extensionList); for(std::vector<std::string>::iterator i = extensionList.begin(); @@ -1389,8 +1389,8 @@ void cmGlobalGenerator::FinalizeTargetCompileInfo() { std::string defPropName = "COMPILE_DEFINITIONS_"; defPropName += cmSystemTools::UpperCase(*ci); - t->AppendProperty(defPropName.c_str(), - mf->GetProperty(defPropName.c_str())); + t->AppendProperty(defPropName, + mf->GetProperty(defPropName)); } } } @@ -1572,7 +1572,7 @@ void cmGlobalGenerator::CheckLocalGenerators() std::string incDirs = cmGeneratorExpression::Preprocess(incDirProp, cmGeneratorExpression::StripAllGeneratorExpressions); - cmSystemTools::ExpandListArgument(incDirs.c_str(), incs); + cmSystemTools::ExpandListArgument(incDirs, incs); for( std::vector<std::string>::const_iterator incDir = incs.begin(); incDir != incs.end(); ++incDir) @@ -1665,7 +1665,7 @@ int cmGlobalGenerator::TryCompile(const std::string& srcdir, std::string config = mf->GetSafeDefinition("CMAKE_TRY_COMPILE_CONFIGURATION"); return this->Build(srcdir,bindir,projectName, - newTarget.c_str(), + newTarget, output,"",config,false,fast, this->TryCompileTimeout); } @@ -2115,7 +2115,7 @@ cmGlobalGenerator::NameResolvesToFramework(const std::string& libname) const return true; } - if(cmTarget* tgt = this->FindTarget(libname.c_str())) + if(cmTarget* tgt = this->FindTarget(libname)) { if(tgt->IsFrameworkOnApple()) { @@ -2325,7 +2325,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) { ostr << "Only default component available"; } - singleLine.push_back(ostr.str().c_str()); + singleLine.push_back(ostr.str()); (*targets)["list_install_components"] = this->CreateGlobalTarget("list_install_components", ostr.str().c_str(), @@ -2356,7 +2356,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets) // automatically convert this name to the build-time location. cmd = "cmake"; } - singleLine.push_back(cmd.c_str()); + singleLine.push_back(cmd); if ( cmakeCfgIntDir && *cmakeCfgIntDir && cmakeCfgIntDir[0] != '.' ) { std::string cfgArg = "-DBUILD_TYPE="; @@ -2494,7 +2494,7 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget( std::vector<std::string>::iterator dit; for ( dit = depends.begin(); dit != depends.end(); ++ dit ) { - target.AddUtility(dit->c_str()); + target.AddUtility(*dit); } // Organize in the "predefined targets" folder: @@ -2754,7 +2754,7 @@ cmGlobalGenerator::AddRuleHash(const std::vector<std::string>& outputs, // Shorten the output name (in expected use case). cmLocalGenerator* lg = this->GetLocalGenerators()[0]; - std::string fname = lg->Convert(outputs[0].c_str(), + std::string fname = lg->Convert(outputs[0], cmLocalGenerator::HOME_OUTPUT); // Associate the hash with this output. diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx index 71e08cc..2e856ba 100644 --- a/Source/cmGlobalKdevelopGenerator.cxx +++ b/Source/cmGlobalKdevelopGenerator.cxx @@ -183,7 +183,7 @@ bool cmGlobalKdevelopGenerator (strstr(tmp.c_str(), cmake::GetCMakeFilesDirectoryPostSlash())==0)) { - files.insert(tmp.c_str()); + files.insert(tmp); } } } diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 785b902..0a05f5a 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -1159,7 +1159,7 @@ void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os) { WriteRule(*this->RulesFileStream, "CLEAN", - (ninjaCmd() + " -t clean").c_str(), + ninjaCmd() + " -t clean", "Cleaning all built files...", "Rule for cleaning all built files.", /*depfile=*/ "", @@ -1182,7 +1182,7 @@ void cmGlobalNinjaGenerator::WriteTargetHelp(std::ostream& os) { WriteRule(*this->RulesFileStream, "HELP", - (ninjaCmd() + " -t targets").c_str(), + ninjaCmd() + " -t targets", "All primary targets available:", "Rule for printing all primary targets available.", /*depfile=*/ "", diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 2cdc976..4a19c0c 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -356,14 +356,14 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() << "# The top level Makefile was generated from the following files:\n" << "set(CMAKE_MAKEFILE_DEPENDS\n" << " \"" - << lg->Convert(cache.c_str(), + << lg->Convert(cache, cmLocalGenerator::START_OUTPUT).c_str() << "\"\n"; for(std::vector<std::string>::const_iterator i = lfiles.begin(); i != lfiles.end(); ++i) { cmakefileStream << " \"" - << lg->Convert(i->c_str(), cmLocalGenerator::START_OUTPUT).c_str() + << lg->Convert(*i, cmLocalGenerator::START_OUTPUT).c_str() << "\"\n"; } cmakefileStream @@ -379,10 +379,10 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() << "# The corresponding makefile is:\n" << "set(CMAKE_MAKEFILE_OUTPUTS\n" << " \"" - << lg->Convert(makefileName.c_str(), + << lg->Convert(makefileName, cmLocalGenerator::START_OUTPUT).c_str() << "\"\n" << " \"" - << lg->Convert(check.c_str(), + << lg->Convert(check, cmLocalGenerator::START_OUTPUT).c_str() << "\"\n"; cmakefileStream << " )\n\n"; @@ -397,7 +397,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() k != outfiles.end(); ++k) { cmakefileStream << " \"" << - lg->Convert(k->c_str(),cmLocalGenerator::HOME_OUTPUT).c_str() + lg->Convert(*k,cmLocalGenerator::HOME_OUTPUT).c_str() << "\"\n"; } @@ -411,7 +411,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() tmpStr += cmake::GetCMakeFilesDirectory(); tmpStr += "/CMakeDirectoryInformation.cmake"; cmakefileStream << " \"" << - lg->Convert(tmpStr.c_str(),cmLocalGenerator::HOME_OUTPUT).c_str() + lg->Convert(tmpStr,cmLocalGenerator::HOME_OUTPUT).c_str() << "\"\n"; } cmakefileStream << " )\n\n"; @@ -494,7 +494,7 @@ cmGlobalUnixMakefileGenerator3 if((!check_all || !gtarget->GetPropertyAsBool("EXCLUDE_FROM_ALL")) && (!check_relink || gtarget->Target - ->NeedRelinkBeforeInstall(lg->ConfigurationName.c_str()))) + ->NeedRelinkBeforeInstall(lg->ConfigurationName))) { std::string tname = lg->GetRelativeTargetDirectory(*gtarget->Target); tname += "/"; @@ -530,7 +530,7 @@ cmGlobalUnixMakefileGenerator3 doc += "\" pass in the directory."; std::vector<std::string> no_commands; lg->WriteMakeRule(ruleFileStream, doc.c_str(), - makeTarget.c_str(), depends, no_commands, true); + makeTarget, depends, no_commands, true); } //---------------------------------------------------------------------------- @@ -547,7 +547,7 @@ cmGlobalUnixMakefileGenerator3 // Begin the directory-level rules section. std::string dir = lg->GetMakefile()->GetStartOutputDirectory(); - dir = lg->Convert(dir.c_str(), cmLocalGenerator::HOME_OUTPUT, + dir = lg->Convert(dir, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE); lg->WriteDivider(ruleFileStream); ruleFileStream @@ -612,7 +612,7 @@ void cmGlobalUnixMakefileGenerator3 { tname += "/fast"; } - tname = lg->Convert(tname.c_str(),cmLocalGenerator::HOME_OUTPUT); + tname = lg->Convert(tname,cmLocalGenerator::HOME_OUTPUT); cmSystemTools::ConvertToOutputSlashes(tname); makeCommand.push_back(tname); if (!this->LocalGenerators.size()) @@ -697,14 +697,14 @@ cmGlobalUnixMakefileGenerator3 localName = name; localName += "/fast"; commands.push_back(lg->GetRecursiveMakeCall - (makefileName.c_str(), makeTargetName.c_str())); + (makefileName.c_str(), makeTargetName)); lg->WriteMakeRule(ruleFileStream, "fast build rule for target.", - localName.c_str(), depends, commands, true); + localName, depends, commands, true); // Add a local name for the rule to relink the target before // installation. if(gtarget->Target - ->NeedRelinkBeforeInstall(lg->ConfigurationName.c_str())) + ->NeedRelinkBeforeInstall(lg->ConfigurationName)) { makeTargetName = lg->GetRelativeTargetDirectory(*gtarget->Target); makeTargetName += "/preinstall"; @@ -713,10 +713,10 @@ cmGlobalUnixMakefileGenerator3 depends.clear(); commands.clear(); commands.push_back(lg->GetRecursiveMakeCall - (makefileName.c_str(), makeTargetName.c_str())); + (makefileName.c_str(), makeTargetName)); lg->WriteMakeRule(ruleFileStream, "Manual pre-install relink rule for target.", - localName.c_str(), depends, commands, true); + localName, depends, commands, true); } } } @@ -778,7 +778,7 @@ cmGlobalUnixMakefileGenerator3 makeTargetName = localName; makeTargetName += "/depend"; commands.push_back(lg->GetRecursiveMakeCall - (makefileName.c_str(),makeTargetName.c_str())); + (makefileName.c_str(),makeTargetName)); // add requires if we need it for this generator if (needRequiresStep) @@ -786,12 +786,12 @@ cmGlobalUnixMakefileGenerator3 makeTargetName = localName; makeTargetName += "/requires"; commands.push_back(lg->GetRecursiveMakeCall - (makefileName.c_str(),makeTargetName.c_str())); + (makefileName.c_str(),makeTargetName)); } makeTargetName = localName; makeTargetName += "/build"; commands.push_back(lg->GetRecursiveMakeCall - (makefileName.c_str(),makeTargetName.c_str())); + (makefileName.c_str(),makeTargetName)); // Write the rule. localName += "/all"; @@ -804,7 +804,7 @@ cmGlobalUnixMakefileGenerator3 cmOStringStream progCmd; progCmd << "$(CMAKE_COMMAND) -E cmake_progress_report "; // all target counts - progCmd << lg->Convert(progressDir.c_str(), + progCmd << lg->Convert(progressDir, cmLocalGenerator::FULL, cmLocalGenerator::SHELL); progCmd << " "; @@ -823,7 +823,7 @@ cmGlobalUnixMakefileGenerator3 this->AppendGlobalTargetDepends(depends,*gtarget->Target); lg->WriteMakeRule(ruleFileStream, "All Build rule for target.", - localName.c_str(), depends, commands, true); + localName, depends, commands, true); // add the all/all dependency if(!this->IsExcluded(this->LocalGenerators[0], *gtarget->Target)) @@ -845,7 +845,7 @@ cmGlobalUnixMakefileGenerator3 cmOStringStream progCmd; progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # in target - progCmd << lg->Convert(progressDir.c_str(), + progCmd << lg->Convert(progressDir, cmLocalGenerator::FULL, cmLocalGenerator::SHELL); // @@ -857,11 +857,11 @@ cmGlobalUnixMakefileGenerator3 std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash(); tmp += "Makefile2"; commands.push_back(lg->GetRecursiveMakeCall - (tmp.c_str(),localName.c_str())); + (tmp.c_str(),localName)); { cmOStringStream progCmd; progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0 - progCmd << lg->Convert(progressDir.c_str(), + progCmd << lg->Convert(progressDir, cmLocalGenerator::FULL, cmLocalGenerator::SHELL); progCmd << " 0"; @@ -873,7 +873,7 @@ cmGlobalUnixMakefileGenerator3 localName += "/rule"; lg->WriteMakeRule(ruleFileStream, "Build rule for subdir invocation for target.", - localName.c_str(), depends, commands, true); + localName, depends, commands, true); // Add a target with the canonical name (no prefix, suffix or path). commands.clear(); @@ -884,17 +884,17 @@ cmGlobalUnixMakefileGenerator3 // Add rules to prepare the target for installation. if(gtarget->Target - ->NeedRelinkBeforeInstall(lg->ConfigurationName.c_str())) + ->NeedRelinkBeforeInstall(lg->ConfigurationName)) { localName = lg->GetRelativeTargetDirectory(*gtarget->Target); localName += "/preinstall"; depends.clear(); commands.clear(); commands.push_back(lg->GetRecursiveMakeCall - (makefileName.c_str(), localName.c_str())); + (makefileName.c_str(), localName)); lg->WriteMakeRule(ruleFileStream, "Pre-install relink rule for target.", - localName.c_str(), depends, commands, true); + localName, depends, commands, true); if(!this->IsExcluded(this->LocalGenerators[0], *gtarget->Target)) { @@ -913,9 +913,9 @@ cmGlobalUnixMakefileGenerator3 depends.clear(); commands.clear(); commands.push_back(lg->GetRecursiveMakeCall - (makefileName.c_str(), makeTargetName.c_str())); + (makefileName.c_str(), makeTargetName)); lg->WriteMakeRule(ruleFileStream, "clean rule for target.", - makeTargetName.c_str(), depends, commands, true); + makeTargetName, depends, commands, true); commands.clear(); depends.push_back(makeTargetName); lg->WriteMakeRule(ruleFileStream, "clean rule for target.", @@ -1121,7 +1121,7 @@ bool cmGlobalUnixMakefileGenerator3 std::string var = "CMAKE_NEEDS_REQUIRES_STEP_"; var += *l; var += "_FLAG"; - if(target.GetMakefile()->GetDefinition(var.c_str())) + if(target.GetMakefile()->GetDefinition(var)) { return true; } diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index 22cba89..824e9e7 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -192,7 +192,7 @@ void cmGraphVizWriter::WriteTargetDependersFiles(const char* fileName) std::cout << "Writing " << currentFilename << "..." << std::endl; this->WriteHeader(str); - this->WriteDependerConnections(ptrIt->first.c_str(), + this->WriteDependerConnections(ptrIt->first, insertedNodes, insertedConnections, str); this->WriteFooter(str); @@ -241,7 +241,7 @@ void cmGraphVizWriter::WritePerTargetFiles(const char* fileName) std::cout << "Writing " << currentFilename << "..." << std::endl; this->WriteHeader(str); - this->WriteConnections(ptrIt->first.c_str(), + this->WriteConnections(ptrIt->first, insertedNodes, insertedConnections, str); this->WriteFooter(str); } @@ -280,7 +280,7 @@ void cmGraphVizWriter::WriteGlobalFile(const char* fileName) continue; } - this->WriteConnections(ptrIt->first.c_str(), + this->WriteConnections(ptrIt->first, insertedNodes, insertedConnections, str); } this->WriteFooter(str); @@ -407,7 +407,7 @@ void cmGraphVizWriter::WriteDependerConnections(const std::string& targetName, llit != ll->end(); ++ llit ) { - std::string libName = llit->first.c_str(); + std::string libName = llit->first; if (libName == targetName) { // So this target links against targetName. @@ -424,13 +424,13 @@ void cmGraphVizWriter::WriteDependerConnections(const std::string& targetName, insertedConnections.end()) { insertedConnections.insert(connectionName); - this->WriteNode(dependerIt->first.c_str(), dependerIt->second, + this->WriteNode(dependerIt->first, dependerIt->second, insertedNodes, str); str << " \"" << dependerNodeNameIt->second << "\" -> \"" << myNodeName << "\""; str << " // " <<targetName<< " -> " <<dependerIt->first<<std::endl; - this->WriteDependerConnections(dependerIt->first.c_str(), + this->WriteDependerConnections(dependerIt->first, insertedNodes, insertedConnections, str); } diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index bd12327..06c4b89 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -26,7 +26,7 @@ static std::string cmIfCommandError( i != args.end(); ++i) { err += " "; - err += lg->EscapeForCMake(i->c_str()); + err += lg->EscapeForCMake(*i); } err += "\n"; return err; @@ -199,7 +199,7 @@ bool cmIfCommand err += errorString; if (status == cmake::FATAL_ERROR) { - this->SetError(err.c_str()); + this->SetError(err); cmSystemTools::SetFatalErrorOccured(); return false; } @@ -261,7 +261,7 @@ namespace } // Check definition. - const char* def = mf->GetDefinition(arg.c_str()); + const char* def = mf->GetDefinition(arg); return !cmSystemTools::IsOff(def); } @@ -277,12 +277,12 @@ namespace else if(arg == "1") { return true; } else - { return !cmSystemTools::IsOff(mf->GetDefinition(arg.c_str())); } + { return !cmSystemTools::IsOff(mf->GetDefinition(arg)); } } else { // Old GetVariableOrNumber behavior. - const char* def = mf->GetDefinition(arg.c_str()); + const char* def = mf->GetDefinition(arg); if(!def && atoi(arg.c_str())) { def = arg.c_str(); @@ -559,7 +559,7 @@ namespace } else { - bdef = makefile->IsDefinitionSet((argP1)->c_str()); + bdef = makefile->IsDefinitionSet(*(argP1)); } HandlePredicate(bdef, reducible, arg, newArgs, argP1, argP2); } diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx index e8ee33f..4d9935c 100644 --- a/Source/cmIncludeCommand.cxx +++ b/Source/cmIncludeCommand.cxx @@ -65,7 +65,7 @@ bool cmIncludeCommand { std::string errorText = "called with invalid argument: "; errorText += args[i]; - this->SetError(errorText.c_str()); + this->SetError(errorText); return false; } } @@ -121,7 +121,7 @@ bool cmIncludeCommand "command. It " << modal << " not be used as the argument to the " "include() command. Use ALIAS targets instead to refer to targets " "by alternative names.\n"; - this->Makefile->IssueMessage(messageType, e.str().c_str()); + this->Makefile->IssueMessage(messageType, e.str()); if (messageType == cmake::FATAL_ERROR) { return false; @@ -139,7 +139,7 @@ bool cmIncludeCommand // add the location of the included file if a result variable was given if (resultVarName.size()) { - this->Makefile->AddDefinition(resultVarName.c_str(), + this->Makefile->AddDefinition(resultVarName, readit?fullFilePath.c_str():"NOTFOUND"); } @@ -149,7 +149,7 @@ bool cmIncludeCommand "could not find load file:\n" " "; m += fname; - this->SetError(m.c_str()); + this->SetError(m); return false; } return true; diff --git a/Source/cmIncludeRegularExpressionCommand.cxx b/Source/cmIncludeRegularExpressionCommand.cxx index ef6e8c6..d6dfdd2 100644 --- a/Source/cmIncludeRegularExpressionCommand.cxx +++ b/Source/cmIncludeRegularExpressionCommand.cxx @@ -24,7 +24,7 @@ bool cmIncludeRegularExpressionCommand if(args.size() > 1) { - this->Makefile->SetComplainRegularExpression(args[1].c_str()); + this->Makefile->SetComplainRegularExpression(args[1]); } return true; diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 94d2091..0041122 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -99,7 +99,7 @@ bool cmInstallCommand::InitialPass(std::vector<std::string> const& args, // Unknown mode. std::string e = "called with unknown mode "; e += args[0]; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -269,7 +269,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) // Unknown argument. cmOStringStream e; e << "TARGETS given unknown argument \"" << unknownArgs[0] << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -370,7 +370,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) cmOStringStream e; e << "TARGETS given target \"" << (*targetIt) << "\" which is an alias."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } // Lookup this target in the current directory. @@ -387,7 +387,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) cmOStringStream e; e << "TARGETS given target \"" << (*targetIt) << "\" which is not an executable, library, or module."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } else if(target->GetType() == cmTarget::OBJECT_LIBRARY) @@ -395,7 +395,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) cmOStringStream e; e << "TARGETS given OBJECT library \"" << (*targetIt) << "\" which may not be installed."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } // Store the target in the list to be installed. @@ -407,7 +407,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) cmOStringStream e; e << "TARGETS given target \"" << (*targetIt) << "\" which does not exist in this directory."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -499,7 +499,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) cmOStringStream e; e << "TARGETS given no FRAMEWORK DESTINATION for shared library " "FRAMEWORK target \"" << target.GetName() << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -519,7 +519,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) cmOStringStream e; e << "TARGETS given no LIBRARY DESTINATION for shared library " "target \"" << target.GetName() << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -539,7 +539,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) cmOStringStream e; e << "TARGETS given no ARCHIVE DESTINATION for static library " "target \"" << target.GetName() << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -560,7 +560,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) cmOStringStream e; e << "TARGETS given no LIBRARY DESTINATION for module target \"" << target.GetName() << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -595,7 +595,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) cmOStringStream e; e << "TARGETS given no BUNDLE DESTINATION for MACOSX_BUNDLE " "executable target \"" << target.GetName() << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -612,7 +612,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) cmOStringStream e; e << "TARGETS given no RUNTIME DESTINATION for executable " "target \"" << target.GetName() << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -851,7 +851,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args) // Unknown argument. cmOStringStream e; e << args[0] << " given unknown argument \"" << unknownArgs[0] << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -866,7 +866,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args) // The rename option works only with one file. cmOStringStream e; e << args[0] << " given RENAME option with more than one file."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -886,7 +886,7 @@ bool cmInstallCommand::HandleFilesMode(std::vector<std::string> const& args) // A destination is required. cmOStringStream e; e << args[0] << " given no DESTINATION!"; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -927,7 +927,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) cmOStringStream e; e << args[0] << " does not allow \"" << args[i] << "\" after PATTERN or REGEX."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -941,7 +941,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) cmOStringStream e; e << args[0] << " does not allow \"" << args[i] << "\" after PATTERN or REGEX."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -969,7 +969,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) cmOStringStream e; e << args[0] << " does not allow \"" << args[i] << "\" before a PATTERN or REGEX is given."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } literal_args += " EXCLUDE"; @@ -982,7 +982,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) cmOStringStream e; e << args[0] << " does not allow \"" << args[i] << "\" before a PATTERN or REGEX is given."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -997,7 +997,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) cmOStringStream e; e << args[0] << " does not allow \"" << args[i] << "\" after PATTERN or REGEX."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1011,7 +1011,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) cmOStringStream e; e << args[0] << " does not allow \"" << args[i] << "\" after PATTERN or REGEX."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1025,7 +1025,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) cmOStringStream e; e << args[0] << " does not allow \"" << args[i] << "\" after PATTERN or REGEX."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1040,7 +1040,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) cmOStringStream e; e << args[0] << " does not allow \"" << args[i] << "\" after PATTERN or REGEX."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1055,7 +1055,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) cmOStringStream e; e << args[0] << " does not allow \"" << args[i] << "\" after PATTERN or REGEX."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1069,7 +1069,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) cmOStringStream e; e << args[0] << " does not allow \"" << args[i] << "\" after PATTERN or REGEX."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1094,7 +1094,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) cmOStringStream e; e << args[0] << " given non-directory \"" << args[i] << "\" to install."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1150,7 +1150,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) cmOStringStream e; e << args[0] << " given invalid file permission \"" << args[i] << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -1162,7 +1162,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) cmOStringStream e; e << args[0] << " given invalid directory permission \"" << args[i] << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -1174,7 +1174,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) cmOStringStream e; e << args[0] << " given invalid permission \"" << args[i] << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -1183,7 +1183,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) // Unknown argument. cmOStringStream e; e << args[0] << " given unknown argument \"" << args[i] << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -1204,7 +1204,7 @@ cmInstallCommand::HandleDirectoryMode(std::vector<std::string> const& args) // A destination is required. cmOStringStream e; e << args[0] << " given no DESTINATION!"; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1247,7 +1247,7 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args) // Unknown argument. cmOStringStream e; e << args[0] << " given unknown argument \"" << unknownArgs[0] << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1262,7 +1262,7 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args) // A destination is required. cmOStringStream e; e << args[0] << " given no DESTINATION!"; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1274,7 +1274,7 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args) e << args[0] << " given invalid export file name \"" << fname << "\". " << "The FILE argument may not contain a path. " << "Specify the path in the DESTINATION argument."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1285,7 +1285,7 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args) cmOStringStream e; e << args[0] << " given invalid export file name \"" << fname << "\". " << "The FILE argument must specify a name ending in \".cmake\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -1302,7 +1302,7 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args) << "This name cannot be safely converted to a file name. " << "Specify a different export name or use the FILE option to set " << "a file name explicitly."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -1327,7 +1327,7 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args) << "EXPORT_LINK_INTERFACE_LIBRARIES" << "\", but target \"" << te->Target->GetName() << "\" does not have policy CMP0022 set to NEW."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -1368,7 +1368,7 @@ bool cmInstallCommand::MakeFilesFullPath(const char* modeName, { cmOStringStream e; e << modeName << " given directory \"" << (*fileIt) << "\" to install."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } // Store the file for installation. diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index d2737a1..9a17052 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -94,7 +94,7 @@ void cmInstallExportGenerator::ComputeTempDir() { // Replace the destination path with a hash to keep it short. this->TempDir += - cmSystemTools::ComputeStringMD5(this->Destination.c_str()); + cmSystemTools::ComputeStringMD5(this->Destination); } else { @@ -138,7 +138,7 @@ void cmInstallExportGenerator::GenerateScript(std::ostream& os) // Generate the import file for this export set. this->EFGen->SetExportFile(this->MainImportFile.c_str()); - this->EFGen->SetNamespace(this->Namespace.c_str()); + this->EFGen->SetNamespace(this->Namespace); this->EFGen->SetExportOld(this->ExportOld); if(this->ConfigurationTypes->empty()) { @@ -157,7 +157,7 @@ void cmInstallExportGenerator::GenerateScript(std::ostream& os) ci = this->ConfigurationTypes->begin(); ci != this->ConfigurationTypes->end(); ++ci) { - this->EFGen->AddConfiguration(ci->c_str()); + this->EFGen->AddConfiguration(*ci); } } this->EFGen->GenerateImportFile(); @@ -182,7 +182,7 @@ cmInstallExportGenerator::GenerateScriptConfigs(std::ostream& os, i != this->EFGen->GetConfigImportFiles().end(); ++i) { files.push_back(i->second); - std::string config_test = this->CreateConfigTest(i->first.c_str()); + std::string config_test = this->CreateConfigTest(i->first); os << indent << "if(" << config_test << ")\n"; this->AddInstallRule(os, cmInstallType_FILES, files, false, this->FilePermissions.c_str(), 0, 0, 0, diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx index 488d486..7eabbef 100644 --- a/Source/cmInstallFilesCommand.cxx +++ b/Source/cmInstallFilesCommand.cxx @@ -100,9 +100,9 @@ void cmInstallFilesCommand::FinalPass() else // reg exp list { std::vector<std::string> files; - std::string regex = this->FinalArgs[0].c_str(); + std::string regex = this->FinalArgs[0]; cmSystemTools::Glob(this->Makefile->GetCurrentDirectory(), - regex.c_str(), files); + regex, files); std::vector<std::string>::iterator s = files.begin(); // for each argument, get the files diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx index 54d903a..597f7ee 100644 --- a/Source/cmInstallProgramsCommand.cxx +++ b/Source/cmInstallProgramsCommand.cxx @@ -68,7 +68,7 @@ void cmInstallProgramsCommand::FinalPass() { std::vector<std::string> programs; cmSystemTools::Glob(this->Makefile->GetCurrentDirectory(), - this->FinalArgs[0].c_str(), programs); + this->FinalArgs[0], programs); std::vector<std::string>::iterator s = programs.begin(); // for each argument, get the programs diff --git a/Source/cmInstallTargetsCommand.cxx b/Source/cmInstallTargetsCommand.cxx index 277ccea..b738844 100644 --- a/Source/cmInstallTargetsCommand.cxx +++ b/Source/cmInstallTargetsCommand.cxx @@ -52,7 +52,7 @@ bool cmInstallTargetsCommand else { std::string str = "Cannot find target: \"" + *s + "\" to install."; - this->SetError(str.c_str()); + this->SetError(str); return false; } } diff --git a/Source/cmLinkDirectoriesCommand.cxx b/Source/cmLinkDirectoriesCommand.cxx index 4412414..3644d93 100644 --- a/Source/cmLinkDirectoriesCommand.cxx +++ b/Source/cmLinkDirectoriesCommand.cxx @@ -66,5 +66,5 @@ void cmLinkDirectoriesCommand::AddLinkDir(std::string const& dir) unixPath = tmp; } } - this->Makefile->AddLinkDirectory(unixPath.c_str()); + this->Makefile->AddLinkDirectory(unixPath); } diff --git a/Source/cmLinkLibrariesCommand.cxx b/Source/cmLinkLibrariesCommand.cxx index 2f1db2a..996b538 100644 --- a/Source/cmLinkLibrariesCommand.cxx +++ b/Source/cmLinkLibrariesCommand.cxx @@ -33,7 +33,7 @@ bool cmLinkLibrariesCommand "a library"); return false; } - this->Makefile->AddLinkLibrary(i->c_str(), + this->Makefile->AddLinkLibrary(*i, cmTarget::DEBUG); } else if (*i == "optimized") @@ -45,12 +45,12 @@ bool cmLinkLibrariesCommand "a library"); return false; } - this->Makefile->AddLinkLibrary(i->c_str(), + this->Makefile->AddLinkLibrary(*i, cmTarget::OPTIMIZED); } else { - this->Makefile->AddLinkLibrary(i->c_str()); + this->Makefile->AddLinkLibrary(*i); } } diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 20e760a..f1ea088 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -69,7 +69,7 @@ bool cmListCommand } std::string e = "does not recognize sub-command "+subCommand; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -176,12 +176,12 @@ bool cmListCommand::HandleLengthCommand(std::vector<std::string> const& args) // do not check the return value here // if the list var is not found varArgsExpanded will have size 0 // and we will return 0 - this->GetList(varArgsExpanded, listName.c_str()); + this->GetList(varArgsExpanded, listName); size_t length = varArgsExpanded.size(); char buffer[1024]; sprintf(buffer, "%d", static_cast<int>(length)); - this->Makefile->AddDefinition(variableName.c_str(), buffer); + this->Makefile->AddDefinition(variableName, buffer); return true; } @@ -198,9 +198,9 @@ bool cmListCommand::HandleGetCommand(std::vector<std::string> const& args) const std::string& variableName = args[args.size() - 1]; // expand the variable std::vector<std::string> varArgsExpanded; - if ( !this->GetList(varArgsExpanded, listName.c_str()) ) + if ( !this->GetList(varArgsExpanded, listName) ) { - this->Makefile->AddDefinition(variableName.c_str(), "NOTFOUND"); + this->Makefile->AddDefinition(variableName, "NOTFOUND"); return true; } // FIXME: Add policy to make non-existing lists an error like empty lists. @@ -229,13 +229,13 @@ bool cmListCommand::HandleGetCommand(std::vector<std::string> const& args) str << "index: " << item << " out of range (-" << varArgsExpanded.size() << ", " << varArgsExpanded.size()-1 << ")"; - this->SetError(str.str().c_str()); + this->SetError(str.str()); return false; } value += varArgsExpanded[item]; } - this->Makefile->AddDefinition(variableName.c_str(), value.c_str()); + this->Makefile->AddDefinition(variableName, value.c_str()); return true; } @@ -253,7 +253,7 @@ bool cmListCommand::HandleAppendCommand(std::vector<std::string> const& args) const std::string& listName = args[1]; // expand the variable std::string listString; - this->GetListString(listString, listName.c_str()); + this->GetListString(listString, listName); size_t cc; for ( cc = 2; cc < args.size(); ++ cc ) { @@ -264,7 +264,7 @@ bool cmListCommand::HandleAppendCommand(std::vector<std::string> const& args) listString += args[cc]; } - this->Makefile->AddDefinition(listName.c_str(), listString.c_str()); + this->Makefile->AddDefinition(listName, listString.c_str()); return true; } @@ -281,9 +281,9 @@ bool cmListCommand::HandleFindCommand(std::vector<std::string> const& args) const std::string& variableName = args[args.size() - 1]; // expand the variable std::vector<std::string> varArgsExpanded; - if ( !this->GetList(varArgsExpanded, listName.c_str()) ) + if ( !this->GetList(varArgsExpanded, listName) ) { - this->Makefile->AddDefinition(variableName.c_str(), "-1"); + this->Makefile->AddDefinition(variableName, "-1"); return true; } @@ -295,13 +295,13 @@ bool cmListCommand::HandleFindCommand(std::vector<std::string> const& args) { char indexString[32]; sprintf(indexString, "%d", index); - this->Makefile->AddDefinition(variableName.c_str(), indexString); + this->Makefile->AddDefinition(variableName, indexString); return true; } index++; } - this->Makefile->AddDefinition(variableName.c_str(), "-1"); + this->Makefile->AddDefinition(variableName, "-1"); return true; } @@ -319,12 +319,12 @@ bool cmListCommand::HandleInsertCommand(std::vector<std::string> const& args) // expand the variable int item = atoi(args[2].c_str()); std::vector<std::string> varArgsExpanded; - if((!this->GetList(varArgsExpanded, listName.c_str()) + if((!this->GetList(varArgsExpanded, listName) || varArgsExpanded.empty()) && item != 0) { cmOStringStream str; str << "index: " << item << " out of range (0, 0)"; - this->SetError(str.str().c_str()); + this->SetError(str.str()); return false; } @@ -341,7 +341,7 @@ bool cmListCommand::HandleInsertCommand(std::vector<std::string> const& args) str << "index: " << item << " out of range (-" << varArgsExpanded.size() << ", " << (varArgsExpanded.size() == 0?0:(varArgsExpanded.size()-1)) << ")"; - this->SetError(str.str().c_str()); + this->SetError(str.str()); return false; } } @@ -362,7 +362,7 @@ bool cmListCommand::HandleInsertCommand(std::vector<std::string> const& args) sep = ";"; } - this->Makefile->AddDefinition(listName.c_str(), value.c_str()); + this->Makefile->AddDefinition(listName, value.c_str()); return true; } @@ -379,7 +379,7 @@ bool cmListCommand const std::string& listName = args[1]; // expand the variable std::vector<std::string> varArgsExpanded; - if ( !this->GetList(varArgsExpanded, listName.c_str()) ) + if ( !this->GetList(varArgsExpanded, listName) ) { this->SetError("sub-command REMOVE_ITEM requires list to be present."); return false; @@ -411,7 +411,7 @@ bool cmListCommand sep = ";"; } - this->Makefile->AddDefinition(listName.c_str(), value.c_str()); + this->Makefile->AddDefinition(listName, value.c_str()); return true; } @@ -430,7 +430,7 @@ bool cmListCommand const std::string& listName = args[1]; // expand the variable std::vector<std::string> varArgsExpanded; - if ( !this->GetList(varArgsExpanded, listName.c_str()) ) + if ( !this->GetList(varArgsExpanded, listName) ) { this->SetError("sub-command REVERSE requires list to be present."); return false; @@ -446,7 +446,7 @@ bool cmListCommand sep = ";"; } - this->Makefile->AddDefinition(listName.c_str(), value.c_str()); + this->Makefile->AddDefinition(listName, value.c_str()); return true; } @@ -465,7 +465,7 @@ bool cmListCommand const std::string& listName = args[1]; // expand the variable std::vector<std::string> varArgsExpanded; - if ( !this->GetList(varArgsExpanded, listName.c_str()) ) + if ( !this->GetList(varArgsExpanded, listName) ) { this->SetError( "sub-command REMOVE_DUPLICATES requires list to be present."); @@ -491,7 +491,7 @@ bool cmListCommand } - this->Makefile->AddDefinition(listName.c_str(), value.c_str()); + this->Makefile->AddDefinition(listName, value.c_str()); return true; } @@ -510,7 +510,7 @@ bool cmListCommand const std::string& listName = args[1]; // expand the variable std::vector<std::string> varArgsExpanded; - if ( !this->GetList(varArgsExpanded, listName.c_str()) ) + if ( !this->GetList(varArgsExpanded, listName) ) { this->SetError("sub-command SORT requires list to be present."); return false; @@ -528,7 +528,7 @@ bool cmListCommand sep = ";"; } - this->Makefile->AddDefinition(listName.c_str(), value.c_str()); + this->Makefile->AddDefinition(listName, value.c_str()); return true; } @@ -546,7 +546,7 @@ bool cmListCommand::HandleRemoveAtCommand( const std::string& listName = args[1]; // expand the variable std::vector<std::string> varArgsExpanded; - if ( !this->GetList(varArgsExpanded, listName.c_str()) ) + if ( !this->GetList(varArgsExpanded, listName) ) { this->SetError("sub-command REMOVE_AT requires list to be present."); return false; @@ -574,7 +574,7 @@ bool cmListCommand::HandleRemoveAtCommand( str << "index: " << item << " out of range (-" << varArgsExpanded.size() << ", " << varArgsExpanded.size()-1 << ")"; - this->SetError(str.str().c_str()); + this->SetError(str.str()); return false; } removed.push_back(static_cast<size_t>(item)); @@ -602,7 +602,7 @@ bool cmListCommand::HandleRemoveAtCommand( } } - this->Makefile->AddDefinition(listName.c_str(), value.c_str()); + this->Makefile->AddDefinition(listName, value.c_str()); return true; } diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 7461d37..34781d3 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -397,12 +397,12 @@ bool cmListFileParser::AddArgument(cmListFileLexer_Token* token, << "Argument not separated from preceding token by whitespace."; if(isError) { - this->Makefile->IssueMessage(cmake::FATAL_ERROR, m.str().c_str()); + this->Makefile->IssueMessage(cmake::FATAL_ERROR, m.str()); return false; } else { - this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, m.str().c_str()); + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, m.str()); return true; } } diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx index 806d821..427e29d 100644 --- a/Source/cmLoadCacheCommand.cxx +++ b/Source/cmLoadCacheCommand.cxx @@ -81,7 +81,7 @@ bool cmLoadCacheCommand { break; } - this->Makefile->GetCacheManager()->LoadCache(args[i].c_str(), false, + this->Makefile->GetCacheManager()->LoadCache(args[i], false, excludes, includes); } @@ -104,7 +104,7 @@ bool cmLoadCacheCommand::ReadWithPrefix(std::vector<std::string> const& args) if(!cmSystemTools::FileExists(cacheFile.c_str())) { std::string e = "Cannot load cache file from " + cacheFile; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -186,11 +186,11 @@ void cmLoadCacheCommand::CheckLine(const char* line) var = this->Prefix + var; if(value.length()) { - this->Makefile->AddDefinition(var.c_str(), value.c_str()); + this->Makefile->AddDefinition(var, value.c_str()); } else { - this->Makefile->RemoveDefinition(var.c_str()); + this->Makefile->RemoveDefinition(var); } } } diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx index 36e9980..a4063a6 100644 --- a/Source/cmLoadCommandCommand.cxx +++ b/Source/cmLoadCommandCommand.cxx @@ -201,7 +201,7 @@ bool cmLoadCommandCommand // Start by removing the definition in case of failure. std::string reportVar = "CMAKE_LOADED_COMMAND_"; reportVar += args[0]; - this->Makefile->RemoveDefinition(reportVar.c_str()); + this->Makefile->RemoveDefinition(reportVar); // the file must exist std::string moduleName = @@ -219,7 +219,7 @@ bool cmLoadCommandCommand cmSystemTools::ExpandRegistryValues(exp); // Glob the entry in case of wildcards. - cmSystemTools::GlobDirs(exp.c_str(), path); + cmSystemTools::GlobDirs(exp, path); } // Try to find the program. @@ -229,7 +229,7 @@ bool cmLoadCommandCommand cmOStringStream e; e << "Attempt to load command failed from file \"" << moduleName << "\""; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -246,12 +246,12 @@ bool cmLoadCommandCommand err += " Additional error info is:\n"; err += error; } - this->SetError(err.c_str()); + this->SetError(err); return false; } // Report what file was loaded for this command. - this->Makefile->AddDefinition(reportVar.c_str(), fullPath.c_str()); + this->Makefile->AddDefinition(reportVar, fullPath.c_str()); // find the init function std::string initFuncName = args[0] + "Init"; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 761db48..21957f9 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -325,7 +325,7 @@ void cmLocalGenerator::GenerateTestFiles() fout << "subdirs("; std::string outP = this->Children[i]->GetMakefile()->GetStartOutputDirectory(); - fout << this->Convert(outP.c_str(),START_OUTPUT); + fout << this->Convert(outP,START_OUTPUT); fout << ")" << std::endl; } } @@ -577,20 +577,20 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, cmGeneratorTarget& target) { std::string objectDir = cmSystemTools::GetFilenamePath(std::string(ofname)); - objectDir = this->Convert(objectDir.c_str(),START_OUTPUT,SHELL); + objectDir = this->Convert(objectDir,START_OUTPUT,SHELL); std::string objectFile = this->Convert(ofname,START_OUTPUT,SHELL); std::string sourceFile = - this->Convert(source.GetFullPath().c_str(),START_OUTPUT,SHELL,true); + this->Convert(source.GetFullPath(),START_OUTPUT,SHELL,true); std::string varString = "CMAKE_"; varString += lang; varString += "_COMPILE_OBJECT"; std::vector<std::string> rules; - rules.push_back(this->Makefile->GetRequiredDefinition(varString.c_str())); + rules.push_back(this->Makefile->GetRequiredDefinition(varString)); varString = "CMAKE_"; varString += lang; varString += "_FLAGS"; std::string flags; - flags += this->Makefile->GetSafeDefinition(varString.c_str()); + flags += this->Makefile->GetSafeDefinition(varString); flags += " "; { std::vector<std::string> includes; @@ -646,7 +646,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, this->Makefile->AddCustomCommandToOutput( ofname, depends, - source.GetFullPath().c_str(), + source.GetFullPath(), commandLines, comment.c_str(), this->Makefile->GetStartOutputDirectory() @@ -681,7 +681,7 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, objVector.push_back(ofname); this->AddCustomCommandToCreateObject(ofname.c_str(), llang, *(*i), target); - objs += this->Convert(ofname.c_str(),START_OUTPUT,MAKEFILE); + objs += this->Convert(ofname,START_OUTPUT,MAKEFILE); objs += " "; } } @@ -718,7 +718,7 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, cmCustomCommandLines commandLines; std::vector<std::string> rules; - rules.push_back(this->Makefile->GetRequiredDefinition(createRule.c_str())); + rules.push_back(this->Makefile->GetRequiredDefinition(createRule)); std::vector<std::string> commands; cmSystemTools::ExpandList(rules, commands); for(std::vector<std::string>::iterator i = commands.begin(); @@ -743,9 +743,9 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, std::string comment = "Linking "; comment += llang; comment += " target "; - comment += this->Convert(targetFullPath.c_str(), START_OUTPUT); + comment += this->Convert(targetFullPath, START_OUTPUT); this->Makefile->AddCustomCommandToOutput( - targetFullPath.c_str(), + targetFullPath, objVector, "", commandLines, @@ -753,7 +753,7 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, this->Makefile->GetStartOutputDirectory() ); target.Target->AddSourceFile - (this->Makefile->GetSource(targetFullPath.c_str())); + (this->Makefile->GetSource(targetFullPath)); } @@ -1081,28 +1081,28 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable, { std::string arg1 = actualReplace + "_ARG1"; cmSystemTools::ReplaceString(arg1, "${LANG}", lang); - compilerArg1 = this->Makefile->GetDefinition(arg1.c_str()); + compilerArg1 = this->Makefile->GetDefinition(arg1); compilerTarget = this->Makefile->GetDefinition( - (std::string("CMAKE_") + lang + "_COMPILER_TARGET").c_str()); + std::string("CMAKE_") + lang + "_COMPILER_TARGET"); compilerOptionTarget = this->Makefile->GetDefinition( - (std::string("CMAKE_") + lang + - "_COMPILE_OPTIONS_TARGET").c_str()); + std::string("CMAKE_") + lang + + "_COMPILE_OPTIONS_TARGET"); compilerExternalToolchain = this->Makefile->GetDefinition( - (std::string("CMAKE_") + lang + - "_COMPILER_EXTERNAL_TOOLCHAIN").c_str()); + std::string("CMAKE_") + lang + + "_COMPILER_EXTERNAL_TOOLCHAIN"); compilerOptionExternalToolchain = this->Makefile->GetDefinition( - (std::string("CMAKE_") + lang + - "_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN").c_str()); + std::string("CMAKE_") + lang + + "_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN"); compilerSysroot = this->Makefile->GetDefinition("CMAKE_SYSROOT"); compilerOptionSysroot = this->Makefile->GetDefinition( - (std::string("CMAKE_") + lang + - "_COMPILE_OPTIONS_SYSROOT").c_str()); + std::string("CMAKE_") + lang + + "_COMPILE_OPTIONS_SYSROOT"); } if(actualReplace.find("${LANG}") != actualReplace.npos) { @@ -1111,11 +1111,11 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable, if(actualReplace == variable) { std::string replace = - this->Makefile->GetSafeDefinition(variable.c_str()); + this->Makefile->GetSafeDefinition(variable); // if the variable is not a FLAG then treat it like a path if(variable.find("_FLAG") == variable.npos) { - std::string ret = this->ConvertToOutputForExisting(replace.c_str()); + std::string ret = this->ConvertToOutputForExisting(replace); // if there is a required first argument to the compiler add it // to the compiler string if(compilerArg1) @@ -1243,7 +1243,7 @@ cmLocalGenerator::ConvertToOutputForExistingCommon(const std::string& remote, std::string tmp; if(cmSystemTools::GetShortPath(remote.c_str(), tmp)) { - return this->Convert(tmp.c_str(), NONE, format, true); + return this->Convert(tmp, NONE, format, true); } } @@ -1283,7 +1283,7 @@ std::string cmLocalGenerator::ConvertToIncludeReference(std::string const& path, OutputFormat format) { - return this->ConvertToOutputForExisting(path.c_str(), START_OUTPUT, format); + return this->ConvertToOutputForExisting(path, START_OUTPUT, format); } //---------------------------------------------------------------------------- @@ -1305,10 +1305,10 @@ std::string cmLocalGenerator::GetIncludeFlags( std::string flagVar = "CMAKE_INCLUDE_FLAG_"; flagVar += lang; const char* includeFlag = - this->Makefile->GetSafeDefinition(flagVar.c_str()); + this->Makefile->GetSafeDefinition(flagVar); flagVar = "CMAKE_INCLUDE_FLAG_SEP_"; flagVar += lang; - const char* sep = this->Makefile->GetDefinition(flagVar.c_str()); + const char* sep = this->Makefile->GetDefinition(flagVar); bool quotePaths = false; if(this->Makefile->GetDefinition("CMAKE_QUOTE_INCLUDE_PATHS")) { @@ -1334,14 +1334,14 @@ std::string cmLocalGenerator::GetIncludeFlags( const char* sysIncludeFlag = 0; if(repeatFlag) { - sysIncludeFlag = this->Makefile->GetDefinition(sysFlagVar.c_str()); + sysIncludeFlag = this->Makefile->GetDefinition(sysFlagVar); } std::string fwSearchFlagVar = "CMAKE_"; fwSearchFlagVar += lang; fwSearchFlagVar += "_FRAMEWORK_SEARCH_FLAG"; const char* fwSearchFlag = - this->Makefile->GetDefinition(fwSearchFlagVar.c_str()); + this->Makefile->GetDefinition(fwSearchFlagVar); bool flagUsed = false; std::set<std::string> emitted; @@ -1360,7 +1360,7 @@ std::string cmLocalGenerator::GetIncludeFlags( if(emitted.insert(frameworkDir).second) { includeFlags - << fwSearchFlag << this->Convert(frameworkDir.c_str(), + << fwSearchFlag << this->Convert(frameworkDir, START_OUTPUT, shellFormat, true) << " "; } @@ -1421,7 +1421,7 @@ void cmLocalGenerator::AddCompileOptions( { std::string langFlagRegexVar = std::string("CMAKE_")+lang+"_FLAG_REGEX"; if(const char* langFlagRegexStr = - this->Makefile->GetDefinition(langFlagRegexVar.c_str())) + this->Makefile->GetDefinition(langFlagRegexVar)) { // Filter flags acceptable to this language. cmsys::RegularExpression r(langFlagRegexStr); @@ -1438,7 +1438,7 @@ void cmLocalGenerator::AddCompileOptions( { // (Re-)Escape this flag. COMPILE_FLAGS were already parsed // as a command line above, and COMPILE_OPTIONS are escaped. - this->AppendFlagEscape(flags, i->c_str()); + this->AppendFlagEscape(flags, *i); } } } @@ -1456,7 +1456,7 @@ void cmLocalGenerator::AddCompileOptions( i != opts.end(); ++i) { // COMPILE_OPTIONS are escaped. - this->AppendFlagEscape(flags, i->c_str()); + this->AppendFlagEscape(flags, *i); } } } @@ -1521,7 +1521,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs, std::string impDirVar = "CMAKE_"; impDirVar += lang; impDirVar += "_IMPLICIT_INCLUDE_DIRECTORIES"; - if(const char* value = this->Makefile->GetDefinition(impDirVar.c_str())) + if(const char* value = this->Makefile->GetDefinition(impDirVar)) { std::vector<std::string> impDirVec; cmSystemTools::ExpandListArgument(value, impDirVec); @@ -1596,13 +1596,13 @@ void cmLocalGenerator::GetStaticLibraryFlags(std::string& flags, if(!config.empty()) { std::string name = "CMAKE_STATIC_LINKER_FLAGS_" + config; - this->AppendFlags(flags, this->Makefile->GetSafeDefinition(name.c_str())); + this->AppendFlags(flags, this->Makefile->GetSafeDefinition(name)); } this->AppendFlags(flags, target->GetProperty("STATIC_LIBRARY_FLAGS")); if(!config.empty()) { std::string name = "STATIC_LIBRARY_FLAGS_" + config; - this->AppendFlags(flags, target->GetProperty(name.c_str())); + this->AppendFlags(flags, target->GetProperty(name)); } } @@ -1635,7 +1635,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, std::string build = libraryLinkVariable; build += "_"; build += buildType; - linkFlags += this->Makefile->GetSafeDefinition(build.c_str()); + linkFlags += this->Makefile->GetSafeDefinition(build); linkFlags += " "; } if(this->Makefile->IsOn("WIN32") && @@ -1651,7 +1651,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, { linkFlags += this->Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG"); - linkFlags += this->Convert(sf->GetFullPath().c_str(), + linkFlags += this->Convert(sf->GetFullPath(), FULL, SHELL); linkFlags += " "; } @@ -1667,7 +1667,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, { std::string configLinkFlags = "LINK_FLAGS_"; configLinkFlags += buildType; - targetLinkFlags = target->GetProperty(configLinkFlags.c_str()); + targetLinkFlags = target->GetProperty(configLinkFlags); if(targetLinkFlags) { linkFlags += targetLinkFlags; @@ -1687,7 +1687,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, { std::string build = "CMAKE_EXE_LINKER_FLAGS_"; build += buildType; - linkFlags += this->Makefile->GetSafeDefinition(build.c_str()); + linkFlags += this->Makefile->GetSafeDefinition(build); linkFlags += " "; } std::string linkLanguage = target->Target->GetLinkerLanguage(); @@ -1706,7 +1706,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, { std::string sFlagVar = std::string("CMAKE_SHARED_BUILD_") + linkLanguage + std::string("_FLAGS"); - linkFlags += this->Makefile->GetSafeDefinition(sFlagVar.c_str()); + linkFlags += this->Makefile->GetSafeDefinition(sFlagVar); linkFlags += " "; } if ( target->GetPropertyAsBool("WIN32_EXECUTABLE") ) @@ -1728,7 +1728,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, exportFlagVar += "_FLAG"; linkFlags += - this->Makefile->GetSafeDefinition(exportFlagVar.c_str()); + this->Makefile->GetSafeDefinition(exportFlagVar); linkFlags += " "; } const char* targetLinkFlags = target->GetProperty("LINK_FLAGS"); @@ -1741,7 +1741,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, { std::string configLinkFlags = "LINK_FLAGS_"; configLinkFlags += buildType; - targetLinkFlags = target->GetProperty(configLinkFlags.c_str()); + targetLinkFlags = target->GetProperty(configLinkFlags); if(targetLinkFlags) { linkFlags += targetLinkFlags; @@ -1785,7 +1785,7 @@ std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib, #endif // Normal behavior. - return this->Convert(lib.c_str(), START_OUTPUT, format); + return this->Convert(lib, START_OUTPUT, format); } /** @@ -1827,7 +1827,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, linkFlagsVar += "_FLAGS"; if( tgt.GetType() == cmTarget::EXECUTABLE ) { - linkLibs = this->Makefile->GetSafeDefinition(linkFlagsVar.c_str()); + linkLibs = this->Makefile->GetSafeDefinition(linkFlagsVar); linkLibs += " "; } @@ -1836,7 +1836,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, fwSearchFlagVar += linkLanguage; fwSearchFlagVar += "_FRAMEWORK_SEARCH_FLAG"; const char* fwSearchFlag = - this->Makefile->GetDefinition(fwSearchFlagVar.c_str()); + this->Makefile->GetDefinition(fwSearchFlagVar); if(fwSearchFlag && *fwSearchFlag) { std::vector<std::string> const& fwDirs = cli.GetFrameworkPaths(); @@ -1844,7 +1844,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, fdi != fwDirs.end(); ++fdi) { frameworkPath += fwSearchFlag; - frameworkPath += this->Convert(fdi->c_str(), NONE, shellFormat, false); + frameworkPath += this->Convert(*fdi, NONE, shellFormat, false); frameworkPath += " "; } } @@ -1854,7 +1854,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, for(std::vector<std::string>::const_iterator libDir = libDirs.begin(); libDir != libDirs.end(); ++libDir) { - std::string libpath = this->ConvertToOutputForExisting(libDir->c_str(), + std::string libpath = this->ConvertToOutputForExisting(*libDir, START_OUTPUT, shellFormat); linkPath += " " + libPathFlag; @@ -1899,7 +1899,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, ri != runtimeDirs.end(); ++ri) { rpath += cli.GetRuntimeFlag(); - rpath += this->Convert(ri->c_str(), NONE, shellFormat, false); + rpath += this->Convert(*ri, NONE, shellFormat, false); rpath += " "; } fout << rpath; @@ -1913,7 +1913,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, if(!rpath.empty()) { fout << cli.GetRuntimeFlag(); - fout << this->EscapeForShell(rpath.c_str(), escapeAllowMakeVars); + fout << this->EscapeForShell(rpath, escapeAllowMakeVars); fout << " "; } } @@ -1923,7 +1923,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, if(!cli.GetRPathLinkFlag().empty() && !rpath_link.empty()) { fout << cli.GetRPathLinkFlag(); - fout << this->EscapeForShell(rpath_link.c_str(), escapeAllowMakeVars); + fout << this->EscapeForShell(rpath_link, escapeAllowMakeVars); fout << " "; } @@ -1932,7 +1932,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, standardLibsVar += cli.GetLinkLanguage(); standardLibsVar += "_STANDARD_LIBRARIES"; if(const char* stdLibs = - this->Makefile->GetDefinition(standardLibsVar.c_str())) + this->Makefile->GetDefinition(standardLibsVar)) { fout << stdLibs << " "; } @@ -1963,13 +1963,13 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags, std::string sysrootFlagVar = std::string("CMAKE_") + lang + "_SYSROOT_FLAG"; const char* sysrootFlag = - this->Makefile->GetDefinition(sysrootFlagVar.c_str()); + this->Makefile->GetDefinition(sysrootFlagVar); const char* deploymentTarget = this->Makefile->GetDefinition("CMAKE_OSX_DEPLOYMENT_TARGET"); std::string deploymentTargetFlagVar = std::string("CMAKE_") + lang + "_OSX_DEPLOYMENT_TARGET_FLAG"; const char* deploymentTargetFlag = - this->Makefile->GetDefinition(deploymentTargetFlagVar.c_str()); + this->Makefile->GetDefinition(deploymentTargetFlagVar); if(!archs.empty() && !lang.empty() && (lang[0] =='C' || lang[0] == 'F')) { for(std::vector<std::string>::iterator i = archs.begin(); @@ -2008,7 +2008,7 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags, std::string flagsVar = "CMAKE_"; flagsVar += lang; flagsVar += "_FLAGS"; - this->AddConfigVariableFlags(flags, flagsVar.c_str(), config); + this->AddConfigVariableFlags(flags, flagsVar, config); } //---------------------------------------------------------------------------- @@ -2124,7 +2124,7 @@ void cmLocalGenerator::AddSharedFlags(std::string& flags, flagsVar = "CMAKE_SHARED_LIBRARY_"; flagsVar += lang; flagsVar += "_FLAGS"; - this->AppendFlags(flags, this->Makefile->GetDefinition(flagsVar.c_str())); + this->AppendFlags(flags, this->Makefile->GetDefinition(flagsVar)); } } @@ -2134,14 +2134,14 @@ static void AddVisibilityCompileOption(std::string &flags, cmTarget* target, { std::string l(lang); std::string compileOption = "CMAKE_" + l + "_COMPILE_OPTIONS_VISIBILITY"; - const char *opt = lg->GetMakefile()->GetDefinition(compileOption.c_str()); + const char *opt = lg->GetMakefile()->GetDefinition(compileOption); if (!opt) { return; } std::string flagDefine = l + "_VISIBILITY_PRESET"; - const char *prop = target->GetProperty(flagDefine.c_str()); + const char *prop = target->GetProperty(flagDefine); if (!prop) { return; @@ -2167,7 +2167,7 @@ static void AddInlineVisibilityCompileOption(std::string &flags, { std::string compileOption = "CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN"; - const char *opt = lg->GetMakefile()->GetDefinition(compileOption.c_str()); + const char *opt = lg->GetMakefile()->GetDefinition(compileOption); if (!opt) { return; @@ -2220,7 +2220,7 @@ void cmLocalGenerator::AddCMP0018Flags(std::string &flags, cmTarget* target, if (this->GetShouldUseOldFlags(shared, lang)) { - this->AddSharedFlags(flags, lang.c_str(), shared); + this->AddSharedFlags(flags, lang, shared); } else { @@ -2241,7 +2241,7 @@ void cmLocalGenerator::AddCMP0018Flags(std::string &flags, cmTarget* target, } if (shared) { - this->AppendFeatureOptions(flags, lang.c_str(), "DLL"); + this->AppendFeatureOptions(flags, lang, "DLL"); } } } @@ -2258,7 +2258,7 @@ bool cmLocalGenerator::GetShouldUseOldFlags(bool shared, flagsVar += lang; flagsVar += "_FLAGS"; const char* flags = - this->Makefile->GetSafeDefinition(flagsVar.c_str()); + this->Makefile->GetSafeDefinition(flagsVar); if (flags && flags != originalFlags) { @@ -2303,14 +2303,14 @@ void cmLocalGenerator::AddPositionIndependentFlags(std::string& flags, std::string flagsVar = "CMAKE_"; flagsVar += lang; flagsVar += "_COMPILE_OPTIONS_PIE"; - picFlags = this->Makefile->GetSafeDefinition(flagsVar.c_str()); + picFlags = this->Makefile->GetSafeDefinition(flagsVar); } if (!picFlags) { std::string flagsVar = "CMAKE_"; flagsVar += lang; flagsVar += "_COMPILE_OPTIONS_PIC"; - picFlags = this->Makefile->GetSafeDefinition(flagsVar.c_str()); + picFlags = this->Makefile->GetSafeDefinition(flagsVar); } if (picFlags) { @@ -2319,7 +2319,7 @@ void cmLocalGenerator::AddPositionIndependentFlags(std::string& flags, for(std::vector<std::string>::const_iterator oi = options.begin(); oi != options.end(); ++oi) { - this->AppendFlagEscape(flags, oi->c_str()); + this->AppendFlagEscape(flags, *oi); } } } @@ -2331,13 +2331,13 @@ void cmLocalGenerator::AddConfigVariableFlags(std::string& flags, { // Add the flags from the variable itself. std::string flagsVar = var; - this->AppendFlags(flags, this->Makefile->GetDefinition(flagsVar.c_str())); + this->AppendFlags(flags, this->Makefile->GetDefinition(flagsVar)); // Add the flags from the build-type specific variable. if(!config.empty()) { flagsVar += "_"; flagsVar += cmSystemTools::UpperCase(config); - this->AppendFlags(flags, this->Makefile->GetDefinition(flagsVar.c_str())); + this->AppendFlags(flags, this->Makefile->GetDefinition(flagsVar)); } } @@ -2407,7 +2407,7 @@ void cmLocalGenerator::JoinDefines(const std::set<std::string>& defines, std::string defineFlagVar = "CMAKE_"; defineFlagVar += lang; defineFlagVar += "_DEFINE_FLAG"; - const char* df = this->Makefile->GetDefinition(defineFlagVar.c_str()); + const char* df = this->Makefile->GetDefinition(defineFlagVar); if(df && *df) { dflag = df; @@ -2468,14 +2468,14 @@ void cmLocalGenerator::AppendFeatureOptions( optVar += lang; optVar += "_COMPILE_OPTIONS_"; optVar += feature; - if(const char* optionList = this->Makefile->GetDefinition(optVar.c_str())) + if(const char* optionList = this->Makefile->GetDefinition(optVar)) { std::vector<std::string> options; cmSystemTools::ExpandListArgument(optionList, options); for(std::vector<std::string>::const_iterator oi = options.begin(); oi != options.end(); ++oi) { - this->AppendFlagEscape(flags, oi->c_str()); + this->AppendFlagEscape(flags, *oi); } } } @@ -2501,7 +2501,7 @@ cmLocalGenerator::ConstructComment(const cmCustomCommand& cc, o != cc.GetOutputs().end(); ++o) { comment += sep; - comment += this->Convert(o->c_str(), cmLocalGenerator::START_OUTPUT); + comment += this->Convert(*o, cmLocalGenerator::START_OUTPUT); sep = ", "; } return comment; @@ -2556,24 +2556,24 @@ std::string cmLocalGenerator::Convert(const std::string& source, case HOME: //result = cmSystemTools::CollapseFullPath(result.c_str()); result = this->ConvertToRelativePath(this->HomeDirectoryComponents, - result.c_str()); + result); break; case START: //result = cmSystemTools::CollapseFullPath(result.c_str()); result = this->ConvertToRelativePath(this->StartDirectoryComponents, - result.c_str()); + result); break; case HOME_OUTPUT: //result = cmSystemTools::CollapseFullPath(result.c_str()); result = this->ConvertToRelativePath(this->HomeOutputDirectoryComponents, - result.c_str()); + result); break; case START_OUTPUT: //result = cmSystemTools::CollapseFullPath(result.c_str()); result = this->ConvertToRelativePath(this->StartOutputDirectoryComponents, - result.c_str()); + result); break; case FULL: result = cmSystemTools::CollapseFullPath(result.c_str()); @@ -2582,7 +2582,7 @@ std::string cmLocalGenerator::Convert(const std::string& source, break; } } - return this->ConvertToOutputFormat(result.c_str(), output); + return this->ConvertToOutputFormat(result, output); } //---------------------------------------------------------------------------- @@ -2617,11 +2617,11 @@ std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source, pos++; } } - result = this->EscapeForShell(result.c_str(), true, false); + result = this->EscapeForShell(result, true, false); } else if(output == RESPONSE) { - result = this->EscapeForShell(result.c_str(), false, false); + result = this->EscapeForShell(result, false, false); } return result; } @@ -2642,7 +2642,7 @@ std::string cmLocalGenerator::Convert(RelativeRoot remote, std::vector<std::string> components; cmSystemTools::SplitPath(local.c_str(), components); std::string result = this->ConvertToRelativePath(components, remotePath); - return this->ConvertToOutputFormat(result.c_str(), output); + return this->ConvertToOutputFormat(result, output); } else { @@ -3150,7 +3150,7 @@ cmLocalGenerator std::string repVar = "CMAKE_"; repVar += lang; repVar += "_OUTPUT_EXTENSION_REPLACE"; - replaceExt = this->Makefile->IsOn(repVar.c_str()); + replaceExt = this->Makefile->IsOn(repVar); } } @@ -3175,7 +3175,7 @@ cmLocalGenerator } // Convert to a safe name. - return this->CreateSafeUniqueObjectFileName(objectName.c_str(), dir_max); + return this->CreateSafeUniqueObjectFileName(objectName, dir_max); } //---------------------------------------------------------------------------- @@ -3470,7 +3470,7 @@ static void cmLGInfoProp(cmMakefile* mf, cmTarget* target, { if(const char* val = target->GetProperty(prop)) { - mf->AddDefinition(prop.c_str(), val); + mf->AddDefinition(prop, val); } } diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 862823f..acaacdd 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -146,14 +146,14 @@ std::string cmLocalNinjaGenerator::ConvertToLinkReference(std::string const& lib, OutputFormat format) { - return this->Convert(lib.c_str(), HOME_OUTPUT, format); + return this->Convert(lib, HOME_OUTPUT, format); } std::string cmLocalNinjaGenerator::ConvertToIncludeReference(std::string const& path, OutputFormat format) { - return this->Convert(path.c_str(), HOME_OUTPUT, format); + return this->Convert(path, HOME_OUTPUT, format); } //---------------------------------------------------------------------------- @@ -310,7 +310,7 @@ void cmLocalNinjaGenerator::AppendCustomCommandDeps(const cmCustomCommand *cc, for (std::vector<std::string>::const_iterator i = deps.begin(); i != deps.end(); ++i) { std::string dep; - if (this->GetRealDependency(i->c_str(), this->GetConfigName(), dep)) + if (this->GetRealDependency(*i, this->GetConfigName(), dep)) ninjaDeps.push_back(ConvertToNinjaPath(dep.c_str())); } } @@ -382,7 +382,7 @@ void cmLocalNinjaGenerator::AppendCustomCommandLines(const cmCustomCommand *cc, for (unsigned i = 0; i != ccg.GetNumberOfCommands(); ++i) { cmdLines.push_back(launcher + - this->ConvertToOutputFormat(ccg.GetCommand(i).c_str(), SHELL)); + this->ConvertToOutputFormat(ccg.GetCommand(i), SHELL)); std::string& cmd = cmdLines.back(); ccg.AppendArguments(i, cmd); @@ -493,7 +493,7 @@ std::string cmLocalNinjaGenerator::MakeCustomLauncher( RelativeRoot relative_root = cc.GetWorkingDirectory() ? NONE : START_OUTPUT; - output = this->Convert(outputs[0].c_str(), relative_root, SHELL); + output = this->Convert(outputs[0], relative_root, SHELL); } vars.Output = output.c_str(); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index f7088c2..5dd2bb1 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -339,7 +339,7 @@ cmLocalUnixMakefileGenerator3 depends.push_back(output); std::vector<std::string> no_commands; this->WriteMakeRule(ruleFileStream, 0, - outNoExt.c_str(), depends, no_commands, true, true); + outNoExt, depends, no_commands, true, true); inHelp = false; } @@ -355,7 +355,7 @@ cmLocalUnixMakefileGenerator3 targetName += "/"; targetName += output; commands.push_back( - this->GetRecursiveMakeCall(tgtMakefileName.c_str(), targetName.c_str()) + this->GetRecursiveMakeCall(tgtMakefileName.c_str(), targetName) ); } this->CreateCDCommand(commands, @@ -407,12 +407,12 @@ void cmLocalUnixMakefileGenerator3 std::string makefile2 = cmake::GetCMakeFilesDirectoryPostSlash(); makefile2 += "Makefile2"; commands.push_back(this->GetRecursiveMakeCall - (makefile2.c_str(),localName.c_str())); + (makefile2.c_str(),localName)); this->CreateCDCommand(commands, this->Makefile->GetHomeOutputDirectory(), cmLocalGenerator::START_OUTPUT); this->WriteMakeRule(ruleFileStream, "Convenience name for target.", - localName.c_str(), depends, commands, true); + localName, depends, commands, true); // Add a target with the canonical name (no prefix, suffix or path). if(localName != t->second->GetName()) @@ -436,17 +436,17 @@ void cmLocalUnixMakefileGenerator3 depends.clear(); commands.clear(); commands.push_back(this->GetRecursiveMakeCall - (makefileName.c_str(), makeTargetName.c_str())); + (makefileName.c_str(), makeTargetName)); this->CreateCDCommand(commands, this->Makefile->GetHomeOutputDirectory(), cmLocalGenerator::START_OUTPUT); this->WriteMakeRule(ruleFileStream, "fast build rule for target.", - localName.c_str(), depends, commands, true); + localName, depends, commands, true); // Add a local name for the rule to relink the target before // installation. if(t->second->Target - ->NeedRelinkBeforeInstall(this->ConfigurationName.c_str())) + ->NeedRelinkBeforeInstall(this->ConfigurationName)) { makeTargetName = this->GetRelativeTargetDirectory(*t->second->Target); makeTargetName += "/preinstall"; @@ -455,13 +455,13 @@ void cmLocalUnixMakefileGenerator3 depends.clear(); commands.clear(); commands.push_back(this->GetRecursiveMakeCall - (makefile2.c_str(), makeTargetName.c_str())); + (makefile2.c_str(), makeTargetName)); this->CreateCDCommand(commands, this->Makefile->GetHomeOutputDirectory(), cmLocalGenerator::START_OUTPUT); this->WriteMakeRule(ruleFileStream, "Manual pre-install relink rule for target.", - localName.c_str(), depends, commands, true); + localName, depends, commands, true); } } } @@ -582,7 +582,7 @@ cmLocalUnixMakefileGenerator3 // Construct the left hand side of the rule. replace = target; - std::string tgt = this->Convert(replace.c_str(),HOME_OUTPUT,MAKEFILE); + std::string tgt = this->Convert(replace,HOME_OUTPUT,MAKEFILE); const char* space = ""; if(tgt.size() == 1) { @@ -615,7 +615,7 @@ cmLocalUnixMakefileGenerator3 dep != depends.end(); ++dep) { replace = *dep; - replace = this->Convert(replace.c_str(),HOME_OUTPUT,MAKEFILE); + replace = this->Convert(replace,HOME_OUTPUT,MAKEFILE); os << cmMakeSafe(tgt) << space << ": " << cmMakeSafe(replace) << "\n"; } } @@ -654,10 +654,10 @@ cmLocalUnixMakefileGenerator3 std::string scmd; if(cmSystemTools::GetShortPath(cmd.c_str(), scmd)) { - return this->Convert(scmd.c_str(), NONE, SHELL); + return this->Convert(scmd, NONE, SHELL); } } - return this->Convert(cmd.c_str(), root, SHELL); + return this->Convert(cmd, root, SHELL); } //---------------------------------------------------------------------------- @@ -829,7 +829,7 @@ void cmLocalUnixMakefileGenerator3 std::string runRule = "$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)"; runRule += " --check-build-system "; - runRule += this->Convert(cmakefileName.c_str(),NONE,SHELL); + runRule += this->Convert(cmakefileName,NONE,SHELL); runRule += " 0"; std::vector<std::string> no_depends; @@ -886,7 +886,7 @@ cmLocalUnixMakefileGenerator3 { std::string dir = this->HomeRelativeOutputPath; dir += this->GetTargetDirectory(target); - return this->Convert(dir.c_str(),NONE,UNCHANGED); + return this->Convert(dir,NONE,UNCHANGED); } @@ -962,7 +962,7 @@ cmLocalUnixMakefileGenerator3 { // Lookup the real name of the dependency in case it is a CMake target. std::string dep; - if(this->GetRealDependency(d->c_str(), this->ConfigurationName.c_str(), + if(this->GetRealDependency(*d, this->ConfigurationName, dep)) { depends.push_back(dep); @@ -1020,7 +1020,7 @@ cmLocalUnixMakefileGenerator3 { *content << dir; } - cmCustomCommandGenerator ccg(cc, this->ConfigurationName.c_str(), + cmCustomCommandGenerator ccg(cc, this->ConfigurationName, this->Makefile); // Add each command line to the set of commands. @@ -1055,7 +1055,7 @@ cmLocalUnixMakefileGenerator3 bool had_slash = cmd.find("/") != cmd.npos; if(!workingDir) { - cmd = this->Convert(cmd.c_str(),START_OUTPUT); + cmd = this->Convert(cmd,START_OUTPUT); } bool has_slash = cmd.find("/") != cmd.npos; if(had_slash && !has_slash) @@ -1141,7 +1141,7 @@ cmLocalUnixMakefileGenerator3::MakeLauncher(const cmCustomCommand& cc, const std::vector<std::string>& outputs = cc.GetOutputs(); if(!outputs.empty()) { - output = this->Convert(outputs[0].c_str(), relative, SHELL); + output = this->Convert(outputs[0], relative, SHELL); } vars.Output = output.c_str(); @@ -1171,7 +1171,7 @@ cmLocalUnixMakefileGenerator3 cleanfile += filename; } cleanfile += ".cmake"; - std::string cleanfilePath = this->Convert(cleanfile.c_str(), FULL); + std::string cleanfilePath = this->Convert(cleanfile, FULL); cmsys::ofstream fout(cleanfilePath.c_str()); if(!fout) { @@ -1183,13 +1183,13 @@ cmLocalUnixMakefileGenerator3 for(std::vector<std::string>::const_iterator f = files.begin(); f != files.end(); ++f) { - std::string fc = this->Convert(f->c_str(),START_OUTPUT,UNCHANGED); - fout << " " << this->EscapeForCMake(fc.c_str()) << "\n"; + std::string fc = this->Convert(*f,START_OUTPUT,UNCHANGED); + fout << " " << this->EscapeForCMake(fc) << "\n"; } fout << ")\n"; } std::string remove = "$(CMAKE_COMMAND) -P "; - remove += this->Convert(cleanfile.c_str(), START_OUTPUT, SHELL); + remove += this->Convert(cleanfile, START_OUTPUT, SHELL); commands.push_back(remove); // For the main clean rule add per-language cleaning. @@ -1267,14 +1267,14 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& commands, { // Use the native echo command. cmd = "@echo "; - cmd += this->EscapeForShell(line.c_str(), false, true); + cmd += this->EscapeForShell(line, false, true); } else { // Use cmake to echo the text in color. cmd = "@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) "; cmd += color_name; - cmd += this->EscapeForShell(line.c_str()); + cmd += this->EscapeForShell(line); } commands.push_back(cmd); } @@ -1588,14 +1588,14 @@ cmLocalUnixMakefileGenerator3 langs.begin(); li != langs.end(); ++li) { // construct the checker - std::string lang = li->c_str(); + std::string lang = *li; // Create the scanner for this language cmDepends *scanner = 0; if(lang == "C" || lang == "CXX" || lang == "RC" || lang == "ASM") { // TODO: Handle RC (resource files) dependencies correctly. - scanner = new cmDependsC(this, targetDir, lang.c_str(), &validDeps); + scanner = new cmDependsC(this, targetDir, lang, &validDeps); } #ifdef CMAKE_BUILD_WITH_CMAKE else if(lang == "Fortran") @@ -1613,7 +1613,7 @@ cmLocalUnixMakefileGenerator3 scanner->SetLocalGenerator(this); scanner->SetFileComparison (this->GlobalGenerator->GetCMakeInstance()->GetFileComparison()); - scanner->SetLanguage(lang.c_str()); + scanner->SetLanguage(lang); scanner->SetTargetDirectory(dir.c_str()); scanner->Write(ruleFileStream, internalRuleFileStream); @@ -1726,7 +1726,7 @@ void cmLocalUnixMakefileGenerator3 dit != glIt->second.GetUtilities().end(); ++ dit ) { - depends.push_back(dit->c_str()); + depends.push_back(*dit); } this->AppendEcho(commands, text, cmLocalUnixMakefileGenerator3::EchoGlobal); @@ -1746,7 +1746,7 @@ void cmLocalUnixMakefileGenerator3 cmLocalGenerator::START_OUTPUT); std::string targetName = glIt->second.GetName(); this->WriteMakeRule(ruleFileStream, targetString.c_str(), - targetName.c_str(), depends, commands, true); + targetName, depends, commands, true); // Provide a "/fast" version of the target. depends.clear(); @@ -1766,7 +1766,7 @@ void cmLocalUnixMakefileGenerator3 } targetName += "/fast"; this->WriteMakeRule(ruleFileStream, targetString.c_str(), - targetName.c_str(), depends, commands, true); + targetName, depends, commands, true); } } @@ -1786,15 +1786,15 @@ void cmLocalUnixMakefileGenerator3 cmOStringStream progCmd; progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; - progCmd << this->Convert(progressDir.c_str(), + progCmd << this->Convert(progressDir, cmLocalGenerator::FULL, cmLocalGenerator::SHELL); std::string progressFile = cmake::GetCMakeFilesDirectory(); progressFile += "/progress.marks"; std::string progressFileNameFull = - this->ConvertToFullPath(progressFile.c_str()); - progCmd << " " << this->Convert(progressFileNameFull.c_str(), + this->ConvertToFullPath(progressFile); + progCmd << " " << this->Convert(progressFileNameFull, cmLocalGenerator::FULL, cmLocalGenerator::SHELL); commands.push_back(progCmd.str()); @@ -1802,14 +1802,14 @@ void cmLocalUnixMakefileGenerator3 std::string mf2Dir = cmake::GetCMakeFilesDirectoryPostSlash(); mf2Dir += "Makefile2"; commands.push_back(this->GetRecursiveMakeCall(mf2Dir.c_str(), - recursiveTarget.c_str())); + recursiveTarget)); this->CreateCDCommand(commands, this->Makefile->GetHomeOutputDirectory(), cmLocalGenerator::START_OUTPUT); { cmOStringStream progCmd; progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0 - progCmd << this->Convert(progressDir.c_str(), + progCmd << this->Convert(progressDir, cmLocalGenerator::FULL, cmLocalGenerator::SHELL); progCmd << " 0"; @@ -1824,7 +1824,7 @@ void cmLocalUnixMakefileGenerator3 commands.clear(); depends.clear(); commands.push_back(this->GetRecursiveMakeCall(mf2Dir.c_str(), - recursiveTarget.c_str())); + recursiveTarget)); this->CreateCDCommand(commands, this->Makefile->GetHomeOutputDirectory(), cmLocalGenerator::START_OUTPUT); @@ -1854,7 +1854,7 @@ void cmLocalUnixMakefileGenerator3 depends.push_back("cmake_check_build_system"); } commands.push_back - (this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget.c_str())); + (this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget)); this->CreateCDCommand(commands, this->Makefile->GetHomeOutputDirectory(), cmLocalGenerator::START_OUTPUT); @@ -1872,7 +1872,7 @@ void cmLocalUnixMakefileGenerator3 std::string runRule = "$(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)"; runRule += " --check-build-system "; - runRule += this->Convert(cmakefileName.c_str(),cmLocalGenerator::NONE, + runRule += this->Convert(cmakefileName,cmLocalGenerator::NONE, cmLocalGenerator::SHELL); runRule += " 1"; commands.push_back(runRule); @@ -1905,7 +1905,7 @@ void cmLocalUnixMakefileGenerator3::ClearDependencies(cmMakefile* mf, for(std::vector<std::string>::iterator l = files.begin(); l != files.end(); ++l) { - std::string dir = cmSystemTools::GetFilenamePath(l->c_str()); + std::string dir = cmSystemTools::GetFilenamePath(*l); // Clear the implicit dependency makefile. std::string dependFile = dir + "/depend.make"; @@ -1964,7 +1964,7 @@ void cmLocalUnixMakefileGenerator3 std::string cidVar = "CMAKE_"; cidVar += l->first; cidVar += "_COMPILER_ID"; - const char* cid = this->Makefile->GetDefinition(cidVar.c_str()); + const char* cid = this->Makefile->GetDefinition(cidVar); if(cid && *cid) { cmakefileStream @@ -1976,7 +1976,7 @@ void cmLocalUnixMakefileGenerator3 // Build a list of preprocessor definitions for the target. std::set<std::string> defines; this->AddCompileDefinitions(defines, &target, - this->ConfigurationName.c_str()); + this->ConfigurationName); if(!defines.empty()) { cmakefileStream @@ -1987,7 +1987,7 @@ void cmLocalUnixMakefileGenerator3 di != defines.end(); ++di) { cmakefileStream - << " " << this->EscapeForCMake(di->c_str()) << "\n"; + << " " << this->EscapeForCMake(*di) << "\n"; } cmakefileStream << " )\n"; @@ -2013,7 +2013,7 @@ void cmLocalUnixMakefileGenerator3 for(std::vector<std::string>::const_iterator tri = transformRules.begin(); tri != transformRules.end(); ++tri) { - cmakefileStream << " " << this->EscapeForCMake(tri->c_str()) << "\n"; + cmakefileStream << " " << this->EscapeForCMake(*tri) << "\n"; } cmakefileStream << " )\n"; @@ -2070,12 +2070,12 @@ cmLocalUnixMakefileGenerator3 // Escape one extra time if the make tool requires it. if(this->MakeCommandEscapeTargetTwice) { - tgt2 = this->EscapeForShell(tgt2.c_str(), true, false); + tgt2 = this->EscapeForShell(tgt2, true, false); } // The target name is now a string that should be passed verbatim // on the command line. - cmd += this->EscapeForShell(tgt2.c_str(), true, false); + cmd += this->EscapeForShell(tgt2, true, false); } return cmd; } diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index 9d253b8..9f569e1 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.cxx @@ -95,7 +95,7 @@ bool cmMacroHelperCommand::InvokeInitialPass std::string errorMsg = "Macro invoked with incorrect arguments for macro named: "; errorMsg += this->Args[0]; - this->SetError(errorMsg.c_str()); + this->SetError(errorMsg); return false; } @@ -276,8 +276,8 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, f->Functions = this->Functions; mf.RecordPolicies(f->Policies); std::string newName = "_" + this->Args[0]; - mf.GetCMakeInstance()->RenameCommand(this->Args[0].c_str(), - newName.c_str()); + mf.GetCMakeInstance()->RenameCommand(this->Args[0], + newName); mf.AddCommand(f); // remove the function blocker now that the macro is defined diff --git a/Source/cmMakeDepend.cxx b/Source/cmMakeDepend.cxx index 03ad37c..52832db 100644 --- a/Source/cmMakeDepend.cxx +++ b/Source/cmMakeDepend.cxx @@ -74,7 +74,7 @@ void cmMakeDepend::SetMakefile(cmMakefile* makefile) cmGeneratorExpression::StripAllGeneratorExpressions); std::vector<std::string> includes; - cmSystemTools::ExpandListArgument(incDirs.c_str(), includes); + cmSystemTools::ExpandListArgument(incDirs, includes); for(std::vector<std::string>::const_iterator j = includes.begin(); j != includes.end(); ++j) @@ -93,7 +93,7 @@ void cmMakeDepend::SetMakefile(cmMakefile* makefile) it != orderedAndUniqueIncludes.end(); ++it) { - this->AddSearchPath(it->c_str()); + this->AddSearchPath(*it); } } @@ -165,7 +165,7 @@ void cmMakeDepend::GenerateDependInformation(cmDependInformation* info) { // Try to find the file amongst the sources cmSourceFile *srcFile = this->Makefile->GetSource - (cmSystemTools::GetFilenameWithoutExtension(path).c_str()); + (cmSystemTools::GetFilenameWithoutExtension(path)); if (srcFile) { if (srcFile->GetFullPath() == path) @@ -281,7 +281,7 @@ cmDependInformation* cmMakeDepend::GetDependInformation(const char* file, // Didn't find an instance. Create a new one and save it. cmDependInformation* info = new cmDependInformation; info->FullPath = fullPath; - info->PathOnly = cmSystemTools::GetFilenamePath(fullPath.c_str()); + info->PathOnly = cmSystemTools::GetFilenamePath(fullPath); info->IncludeName = file; this->DependInformationMap[fullPath] = info; return info; diff --git a/Source/cmMakeDirectoryCommand.cxx b/Source/cmMakeDirectoryCommand.cxx index 63be627..cc871c9 100644 --- a/Source/cmMakeDirectoryCommand.cxx +++ b/Source/cmMakeDirectoryCommand.cxx @@ -24,7 +24,7 @@ bool cmMakeDirectoryCommand { std::string e = "attempted to create a directory: " + args[0] + " into a source directory."; - this->SetError(e.c_str()); + this->SetError(e); cmSystemTools::SetFatalErrorOccured(); return false; } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 92177c8..6fef371 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -330,7 +330,7 @@ void cmMakefile::IssueMessage(cmake::MessageType t, lfc.Line = 0; if(!this->GetCMakeInstance()->GetIsInTryCompile()) { - lfc.FilePath = this->LocalGenerator->Convert(lfc.FilePath.c_str(), + lfc.FilePath = this->LocalGenerator->Convert(lfc.FilePath, cmLocalGenerator::HOME); } backtrace.push_back(lfc); @@ -351,7 +351,7 @@ bool cmMakefile::GetBacktrace(cmListFileBacktrace& backtrace) const i != this->CallStack.rend(); ++i) { cmListFileContext lfc = *(*i).Context; - lfc.FilePath = this->LocalGenerator->Convert(lfc.FilePath.c_str(), + lfc.FilePath = this->LocalGenerator->Convert(lfc.FilePath, cmLocalGenerator::HOME); backtrace.push_back(lfc); } @@ -394,7 +394,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, static_cast<void>(stack_manager); // Lookup the command prototype. - if(cmCommand* proto = this->GetCMakeInstance()->GetCommand(name.c_str())) + if(cmCommand* proto = this->GetCMakeInstance()->GetCommand(name)) { // Clone the prototype. cmsys::auto_ptr<cmCommand> pcmd(proto->Clone()); @@ -756,7 +756,7 @@ void cmMakefile::EnforceDirectoryLevelRules() const case cmPolicies::WARN: // Warn because the user did not provide a mimimum required // version. - this->IssueMessage(cmake::AUTHOR_WARNING, msg.str().c_str()); + this->IssueMessage(cmake::AUTHOR_WARNING, msg.str()); case cmPolicies::OLD: // OLD behavior is to use policy version 2.4 set in // cmListFileCache. @@ -765,7 +765,7 @@ void cmMakefile::EnforceDirectoryLevelRules() const case cmPolicies::REQUIRED_ALWAYS: case cmPolicies::NEW: // NEW behavior is to issue an error. - this->IssueMessage(cmake::FATAL_ERROR, msg.str().c_str()); + this->IssueMessage(cmake::FATAL_ERROR, msg.str()); cmSystemTools::SetFatalErrorOccured(); return; } @@ -912,7 +912,7 @@ cmMakefile::AddCustomCommandToTarget(const std::string& target, e << (this->GetPolicies() ->GetPolicyWarning(cmPolicies::CMP0040)) << "\n"; e << "The target name \"" << target << "\" is unknown in this context."; - IssueMessage(messageType, e.str().c_str()); + IssueMessage(messageType, e.str()); } return; @@ -1018,7 +1018,7 @@ cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs, std::string outName = gg->GenerateRuleFile(outputs[0]); // Check if the rule file already exists. - file = this->GetSource(outName.c_str()); + file = this->GetSource(outName); if(file && file->GetCustomCommand() && !replace) { // The rule file already exists. @@ -1032,7 +1032,7 @@ cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs, } // Create a cmSourceFile for the rule file. - file = this->GetOrCreateSource(outName.c_str(), true); + file = this->GetOrCreateSource(outName, true); file->SetProperty("__CMAKE_RULE", "1"); } @@ -1040,7 +1040,7 @@ cmMakefile::AddCustomCommandToOutput(const std::vector<std::string>& outputs, for(std::vector<std::string>::const_iterator o = outputs.begin(); o != outputs.end(); ++o) { - if(cmSourceFile* out = this->GetOrCreateSource(o->c_str(), true)) + if(cmSourceFile* out = this->GetOrCreateSource(*o, true)) { out->SetProperty("GENERATED", "1"); } @@ -1253,12 +1253,12 @@ cmMakefile::AddUtilityCommand(const std::string& utilityName, force += utilityName; std::string no_main_dependency = ""; bool no_replace = false; - this->AddCustomCommandToOutput(force.c_str(), depends, + this->AddCustomCommandToOutput(force, depends, no_main_dependency, commandLines, comment, workingDirectory, no_replace, escapeOldStyle); - cmSourceFile* sf = target->AddSource(force.c_str()); + cmSourceFile* sf = target->AddSource(force); // The output is not actually created so mark it symbolic. if(sf) @@ -1486,7 +1486,7 @@ void cmMakefile::AddLinkLibraryForTarget(const std::string& target, << " may not be linked into another target. " << "One may link only to STATIC or SHARED libraries, or " << "to executables with the ENABLE_EXPORTS property set."; - this->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + this->IssueMessage(cmake::FATAL_ERROR, e.str()); } } i->second.AddLinkLibrary( *this, target, lib, llt ); @@ -1497,7 +1497,7 @@ void cmMakefile::AddLinkLibraryForTarget(const std::string& target, e << "Attempt to add link library \"" << lib << "\" to target \"" << target << "\" which is not built in this directory."; - this->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + this->IssueMessage(cmake::FATAL_ERROR, e.str()); } } @@ -1512,7 +1512,7 @@ void cmMakefile::AddLinkDirectoryForTarget(const std::string& target, cmOStringStream e; e << "ALIAS target \"" << target << "\" " << "may not be linked into another target."; - this->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + this->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } i->second.AddLinkDirectory( d ); @@ -1605,8 +1605,8 @@ void cmMakefile::InitializeFromParent() { std::string defPropName = "COMPILE_DEFINITIONS_"; defPropName += cmSystemTools::UpperCase(*ci); - const char* prop = parent->GetProperty(defPropName.c_str()); - this->SetProperty(defPropName.c_str(), prop); + const char* prop = parent->GetProperty(defPropName); + this->SetProperty(defPropName, prop); } } @@ -1670,7 +1670,7 @@ void cmMakefile::AddSubDirectory(const std::string& sub, } - this->AddSubDirectory(srcPath.c_str(), binPath.c_str(), + this->AddSubDirectory(srcPath, binPath, excludeFromAll, preorder, false); } @@ -1873,7 +1873,7 @@ void cmMakefile::CheckForUnusedVariables() const std::set<std::string>::const_iterator it = locals.begin(); for (; it != locals.end(); ++it) { - this->CheckForUnused("out of scope", it->c_str()); + this->CheckForUnused("out of scope", *it); } } @@ -1935,7 +1935,7 @@ void cmMakefile::CheckForUnused(const char* reason, cmOStringStream msg; msg << "unused variable (" << reason << ") \'" << name << "\'"; this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, - msg.str().c_str(), + msg.str(), bt); } } @@ -1988,7 +1988,7 @@ void cmMakefile::AddGlobalLinkInformation(const std::string& name, for(j = this->LinkDirectories.begin(); j != this->LinkDirectories.end(); ++j) { - target.AddLinkDirectory(j->c_str()); + target.AddLinkDirectory(*j); } target.MergeLinkLibraries( *this, name, this->LinkLibraries ); } @@ -2101,7 +2101,7 @@ cmSourceFile *cmMakefile::GetSourceFileWithOutput( // linear-time search for an output with a matching suffix. if(!cmSystemTools::FileIsFullPath(name.c_str())) { - return LinearGetSourceFileWithOutput(name.c_str()); + return LinearGetSourceFileWithOutput(name); } // Otherwise we use an efficient lookup map. OutputToSourceMap::const_iterator o = this->OutputToSource.find(name); @@ -2199,7 +2199,7 @@ void cmMakefile::AddSourceGroup(const std::vector<std::string>& name, { std::string guidName = "SG_Filter_"; guidName += fullname; - gg->CreateGUID(guidName.c_str()); + gg->CreateGUID(guidName); } for(++i; i<=lastElement; ++i) { @@ -2210,7 +2210,7 @@ void cmMakefile::AddSourceGroup(const std::vector<std::string>& name, { std::string guidName = "SG_Filter_"; guidName += fullname; - gg->CreateGUID(guidName.c_str()); + gg->CreateGUID(guidName); } } @@ -2369,7 +2369,7 @@ const char* cmMakefile::GetSONameFlag(const std::string& language) const name += language; } name += "_FLAG"; - return GetDefinition(name.c_str()); + return GetDefinition(name); } bool cmMakefile::CanIWriteThisFile(const char* fileName) const @@ -2564,7 +2564,7 @@ const char *cmMakefile::ExpandVariablesInString(std::string& source, // Lookup the definition of VAR. std::string var(first+1, last-first-2); - if(const char* val = this->GetDefinition(var.c_str())) + if(const char* val = this->GetDefinition(var)) { // Store the value in the output escaping as requested. if(escapeQuotes) @@ -2999,7 +2999,7 @@ void cmMakefile::SetArgcArgv(const std::vector<std::string>& args) { cmOStringStream tmpStream; tmpStream << "CMAKE_ARGV" << t; - this->AddDefinition(tmpStream.str().c_str(), args[t].c_str()); + this->AddDefinition(tmpStream.str(), args[t].c_str()); //this->MarkVariableAsUsed(tmpStream.str().c_str()); } } @@ -3007,7 +3007,7 @@ void cmMakefile::SetArgcArgv(const std::vector<std::string>& args) //---------------------------------------------------------------------------- cmSourceFile* cmMakefile::GetSource(const std::string& sourceName) const { - cmSourceFileLocation sfl(this, sourceName.c_str()); + cmSourceFileLocation sfl(this, sourceName); for(std::vector<cmSourceFile*>::const_iterator sfi = this->SourceFiles.begin(); sfi != this->SourceFiles.end(); ++sfi) @@ -3031,7 +3031,7 @@ cmSourceFile* cmMakefile::GetOrCreateSource(const std::string& sourceName, } else { - cmSourceFile* sf = new cmSourceFile(this, sourceName.c_str()); + cmSourceFile* sf = new cmSourceFile(this, sourceName); if(generated) { sf->SetProperty("GENERATED", "1"); @@ -3396,7 +3396,7 @@ void cmMakefile::ConfigureString(const std::string& input, if(this->cmDefineRegex.find(line)) { const char* def = - this->GetDefinition(this->cmDefineRegex.match(1).c_str()); + this->GetDefinition(this->cmDefineRegex.match(1)); if(!cmSystemTools::IsOff(def)) { cmSystemTools::ReplaceString(line, "#cmakedefine", "#define"); @@ -3412,7 +3412,7 @@ void cmMakefile::ConfigureString(const std::string& input, else if(this->cmDefine01Regex.find(line)) { const char* def = - this->GetDefinition(this->cmDefine01Regex.match(1).c_str()); + this->GetDefinition(this->cmDefine01Regex.match(1)); cmSystemTools::ReplaceString(line, "#cmakedefine01", "#define"); output += line; if(!cmSystemTools::IsOff(def)) @@ -3650,7 +3650,7 @@ void cmMakefile::AppendProperty(const std::string& prop, for(std::vector<std::string>::const_iterator vi = varArgsExpanded.begin(); vi != varArgsExpanded.end(); ++vi) { - this->AddLinkDirectory(vi->c_str()); + this->AddLinkDirectory(*vi); } return; } @@ -3816,7 +3816,7 @@ const char* cmMakefile::GetFeature(const std::string& feature, std::string featureConfig = feature; featureConfig += "_"; featureConfig += cmSystemTools::UpperCase(config); - if(const char* value = this->GetProperty(featureConfig.c_str())) + if(const char* value = this->GetProperty(featureConfig)) { return value; } @@ -3862,7 +3862,7 @@ cmTest* cmMakefile::CreateTest(const std::string& testName) return test; } test = new cmTest(this); - test->SetName(testName.c_str()); + test->SetName(testName); this->Tests[testName] = test; return test; } @@ -3951,9 +3951,9 @@ void cmMakefile::PopScope() for (; it != locals.end(); ++it) { init.erase(*it); - if (!this->VariableUsed(it->c_str())) + if (!this->VariableUsed(*it)) { - this->CheckForUnused("out of scope", it->c_str()); + this->CheckForUnused("out of scope", *it); } else { @@ -3987,10 +3987,10 @@ void cmMakefile::RaiseScope(const std::string& var, const char *varDef) if(cmDefinitions* up = cur.GetParent()) { // First localize the definition in the current scope. - cur.Get(var.c_str()); + cur.Get(var); // Now update the definition in the parent scope. - up->Set(var.c_str(), varDef); + up->Set(var, varDef); } else if(cmLocalGenerator* plg = this->LocalGenerator->GetParent()) { @@ -4000,11 +4000,11 @@ void cmMakefile::RaiseScope(const std::string& var, const char *varDef) cmMakefile* parent = plg->GetMakefile(); if (varDef) { - parent->AddDefinition(var.c_str(), varDef); + parent->AddDefinition(var, varDef); } else { - parent->RemoveDefinition(var.c_str()); + parent->RemoveDefinition(var); } } else @@ -4074,7 +4074,7 @@ cmTarget* cmMakefile::FindTargetToUse(const std::string& name, } // Look for a target built in this project. - return this->LocalGenerator->GetGlobalGenerator()->FindTarget(name.c_str(), + return this->LocalGenerator->GetGlobalGenerator()->FindTarget(name, excludeAliases); } @@ -4084,7 +4084,7 @@ bool cmMakefile::IsAlias(const std::string& name) const if (this->AliasTargets.find(name) != this->AliasTargets.end()) return true; return this->GetLocalGenerator()->GetGlobalGenerator()->IsAlias( - name.c_str()); + name); } //---------------------------------------------------------------------------- @@ -4330,7 +4330,7 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id, { std::string msg = this->GetPolicies()->GetRequiredAlwaysPolicyError(id); - this->IssueMessage(cmake::FATAL_ERROR, msg.c_str()); + this->IssueMessage(cmake::FATAL_ERROR, msg); return false; } diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index ca8ff06..a61005b 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -142,20 +142,20 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) std::string targetFullPathPDB = pdbOutputPath + targetNamePDB; std::string targetFullPathImport = outpathImp + targetNameImport; std::string targetOutPathPDB = - this->Convert(targetFullPathPDB.c_str(), + this->Convert(targetFullPathPDB, cmLocalGenerator::NONE, cmLocalGenerator::SHELL); // Convert to the output path to use in constructing commands. std::string targetOutPath = - this->Convert(targetFullPath.c_str(), + this->Convert(targetFullPath, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); std::string targetOutPathReal = - this->Convert(targetFullPathReal.c_str(), + this->Convert(targetFullPathReal, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); std::string targetOutPathImport = - this->Convert(targetFullPathImport.c_str(), + this->Convert(targetFullPathImport, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); @@ -210,7 +210,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) export_flag_var += linkLanguage; export_flag_var += "_FLAG"; this->LocalGenerator->AppendFlags - (linkFlags, this->Makefile->GetDefinition(export_flag_var.c_str())); + (linkFlags, this->Makefile->GetDefinition(export_flag_var)); } // Add language feature flags. @@ -225,14 +225,14 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) std::string linkFlagsConfig = "LINK_FLAGS_"; linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName); this->LocalGenerator->AppendFlags - (linkFlags, this->Target->GetProperty(linkFlagsConfig.c_str())); + (linkFlags, this->Target->GetProperty(linkFlagsConfig)); this->AddModuleDefinitionFlag(linkFlags); // Construct a list of files associated with this executable that // may need to be cleaned. std::vector<std::string> exeCleanFiles; - exeCleanFiles.push_back(this->Convert(targetFullPath.c_str(), + exeCleanFiles.push_back(this->Convert(targetFullPath, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::UNCHANGED)); #ifdef _WIN32 @@ -244,19 +244,19 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) #endif if(targetNameReal != targetName) { - exeCleanFiles.push_back(this->Convert(targetFullPathReal.c_str(), + exeCleanFiles.push_back(this->Convert(targetFullPathReal, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::UNCHANGED)); } if(!targetNameImport.empty()) { - exeCleanFiles.push_back(this->Convert(targetFullPathImport.c_str(), + exeCleanFiles.push_back(this->Convert(targetFullPathImport, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::UNCHANGED)); std::string implib; if(this->Target->GetImplibGNUtoMS(targetFullPathImport, implib)) { - exeCleanFiles.push_back(this->Convert(implib.c_str(), + exeCleanFiles.push_back(this->Convert(implib, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::UNCHANGED)); } @@ -266,7 +266,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) // cleaned. We do not want to delete the .pdb file just before // linking the target. this->CleanFiles.push_back - (this->Convert(targetFullPathPDB.c_str(), + (this->Convert(targetFullPathPDB, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::UNCHANGED)); @@ -289,7 +289,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) std::string linkRuleVar = "CMAKE_"; linkRuleVar += linkLanguage; linkRuleVar += "_LINK_EXECUTABLE"; - std::string linkRule = this->GetLinkRule(linkRuleVar.c_str()); + std::string linkRule = this->GetLinkRule(linkRuleVar); std::vector<std::string> commands1; cmSystemTools::ExpandListArgument(linkRule, real_link_commands); if(this->Target->IsExecutableWithExports()) @@ -300,7 +300,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) implibRuleVar += linkLanguage; implibRuleVar += "_CREATE_IMPORT_LIBRARY"; if(const char* rule = - this->Makefile->GetDefinition(implibRuleVar.c_str())) + this->Makefile->GetDefinition(implibRuleVar)) { cmSystemTools::ExpandListArgument(rule, real_link_commands); } @@ -312,7 +312,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) std::string responseVar = "CMAKE_"; responseVar += linkLanguage; responseVar += "_USE_RESPONSE_FILE_FOR_OBJECTS"; - if(this->Makefile->IsOn(responseVar.c_str())) + if(this->Makefile->IsOn(responseVar)) { useResponseFileForObjects = true; } @@ -324,7 +324,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) std::string responseVar = "CMAKE_"; responseVar += linkLanguage; responseVar += "_USE_RESPONSE_FILE_FOR_LIBRARIES"; - if(this->Makefile->IsOn(responseVar.c_str())) + if(this->Makefile->IsOn(responseVar)) { useResponseFileForLibs = true; } @@ -351,7 +351,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) vars.Language = linkLanguage.c_str(); vars.Objects = buildObjs.c_str(); std::string objectDir = this->Target->GetSupportDirectory(); - objectDir = this->Convert(objectDir.c_str(), + objectDir = this->Convert(objectDir, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); vars.ObjectDir = objectDir.c_str(); @@ -437,7 +437,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) // Write the build rule. this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - targetFullPathReal.c_str(), + targetFullPathReal, depends, commands, false); // The symlink name for the target should depend on the real target @@ -447,14 +447,14 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) { depends.clear(); commands.clear(); - depends.push_back(targetFullPathReal.c_str()); + depends.push_back(targetFullPathReal); this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - targetFullPath.c_str(), + targetFullPath, depends, commands, false); } // Write the main driver rule to build everything in this target. - this->WriteTargetDriverRule(targetFullPath.c_str(), relink); + this->WriteTargetDriverRule(targetFullPath, relink); // Clean all the possible executable names and symlinks. this->CleanFiles.insert(this->CleanFiles.end(), diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index d9425e6..02469d1 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -125,7 +125,7 @@ void cmMakefileLibraryTargetGenerator::WriteObjectLibraryRules() depends, commands, true); // Write the main driver rule to build everything in this target. - this->WriteTargetDriverRule(this->Target->GetName().c_str(), false); + this->WriteTargetDriverRule(this->Target->GetName(), false); } //---------------------------------------------------------------------------- @@ -138,7 +138,7 @@ void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules() linkRuleVar += "_CREATE_STATIC_LIBRARY"; if(this->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION") && - this->Makefile->GetDefinition((linkRuleVar+"_IPO").c_str())) + this->Makefile->GetDefinition(linkRuleVar+"_IPO")) { linkRuleVar += "_IPO"; } @@ -146,7 +146,7 @@ void cmMakefileLibraryTargetGenerator::WriteStaticLibraryRules() std::string extraFlags; this->LocalGenerator->GetStaticLibraryFlags(extraFlags, cmSystemTools::UpperCase(this->ConfigName), this->Target); - this->WriteLibraryRules(linkRuleVar.c_str(), extraFlags.c_str(), false); + this->WriteLibraryRules(linkRuleVar, extraFlags, false); } //---------------------------------------------------------------------------- @@ -169,13 +169,13 @@ void cmMakefileLibraryTargetGenerator::WriteSharedLibraryRules(bool relink) std::string linkFlagsConfig = "LINK_FLAGS_"; linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName); this->LocalGenerator->AppendFlags - (extraFlags, this->Target->GetProperty(linkFlagsConfig.c_str())); + (extraFlags, this->Target->GetProperty(linkFlagsConfig)); this->LocalGenerator->AddConfigVariableFlags (extraFlags, "CMAKE_SHARED_LINKER_FLAGS", this->ConfigName); this->AddModuleDefinitionFlag(extraFlags); - this->WriteLibraryRules(linkRuleVar.c_str(), extraFlags.c_str(), relink); + this->WriteLibraryRules(linkRuleVar, extraFlags, relink); } //---------------------------------------------------------------------------- @@ -193,12 +193,12 @@ void cmMakefileLibraryTargetGenerator::WriteModuleLibraryRules(bool relink) std::string linkFlagsConfig = "LINK_FLAGS_"; linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName); this->LocalGenerator->AppendFlags - (extraFlags, this->Target->GetProperty(linkFlagsConfig.c_str())); + (extraFlags, this->Target->GetProperty(linkFlagsConfig)); this->LocalGenerator->AddConfigVariableFlags (extraFlags, "CMAKE_MODULE_LINKER_FLAGS", this->ConfigName); this->AddModuleDefinitionFlag(extraFlags); - this->WriteLibraryRules(linkRuleVar.c_str(), extraFlags.c_str(), relink); + this->WriteLibraryRules(linkRuleVar, extraFlags, relink); } //---------------------------------------------------------------------------- @@ -216,11 +216,11 @@ void cmMakefileLibraryTargetGenerator::WriteFrameworkRules(bool relink) std::string linkFlagsConfig = "LINK_FLAGS_"; linkFlagsConfig += cmSystemTools::UpperCase(this->ConfigName); this->LocalGenerator->AppendFlags - (extraFlags, this->Target->GetProperty(linkFlagsConfig.c_str())); + (extraFlags, this->Target->GetProperty(linkFlagsConfig)); this->LocalGenerator->AddConfigVariableFlags (extraFlags, "CMAKE_MACOSX_FRAMEWORK_LINKER_FLAGS", this->ConfigName); - this->WriteLibraryRules(linkRuleVar.c_str(), extraFlags.c_str(), relink); + this->WriteLibraryRules(linkRuleVar, extraFlags, relink); } //---------------------------------------------------------------------------- @@ -326,19 +326,19 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules // Construct the output path version of the names for use in command // arguments. std::string targetOutPathPDB = - this->Convert(targetFullPathPDB.c_str(),cmLocalGenerator::NONE, + this->Convert(targetFullPathPDB,cmLocalGenerator::NONE, cmLocalGenerator::SHELL); std::string targetOutPath = - this->Convert(targetFullPath.c_str(),cmLocalGenerator::START_OUTPUT, + this->Convert(targetFullPath,cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); std::string targetOutPathSO = - this->Convert(targetFullPathSO.c_str(),cmLocalGenerator::START_OUTPUT, + this->Convert(targetFullPathSO,cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); std::string targetOutPathReal = - this->Convert(targetFullPathReal.c_str(),cmLocalGenerator::START_OUTPUT, + this->Convert(targetFullPathReal,cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); std::string targetOutPathImport = - this->Convert(targetFullPathImport.c_str(),cmLocalGenerator::START_OUTPUT, + this->Convert(targetFullPathImport,cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); if(!this->NoRuleMessages) @@ -382,31 +382,31 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules // Clean files associated with this library. std::vector<std::string> libCleanFiles; - libCleanFiles.push_back(this->Convert(targetFullPath.c_str(), + libCleanFiles.push_back(this->Convert(targetFullPath, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::UNCHANGED)); if(targetNameReal != targetName) { - libCleanFiles.push_back(this->Convert(targetFullPathReal.c_str(), + libCleanFiles.push_back(this->Convert(targetFullPathReal, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::UNCHANGED)); } if(targetNameSO != targetName && targetNameSO != targetNameReal) { - libCleanFiles.push_back(this->Convert(targetFullPathSO.c_str(), + libCleanFiles.push_back(this->Convert(targetFullPathSO, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::UNCHANGED)); } if(!targetNameImport.empty()) { - libCleanFiles.push_back(this->Convert(targetFullPathImport.c_str(), + libCleanFiles.push_back(this->Convert(targetFullPathImport, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::UNCHANGED)); std::string implib; if(this->Target->GetImplibGNUtoMS(targetFullPathImport, implib)) { - libCleanFiles.push_back(this->Convert(implib.c_str(), + libCleanFiles.push_back(this->Convert(implib, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::UNCHANGED)); } @@ -416,7 +416,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules // cleaned. We do not want to delete the .pdb file just before // linking the target. this->CleanFiles.push_back - (this->Convert(targetFullPathPDB.c_str(), + (this->Convert(targetFullPathPDB, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::UNCHANGED)); @@ -467,7 +467,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules std::string responseVar = "CMAKE_"; responseVar += linkLanguage; responseVar += "_USE_RESPONSE_FILE_FOR_OBJECTS"; - if(this->Makefile->IsOn(responseVar.c_str())) + if(this->Makefile->IsOn(responseVar)) { useResponseFileForObjects = true; } @@ -479,7 +479,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules std::string responseVar = "CMAKE_"; responseVar += linkLanguage; responseVar += "_USE_RESPONSE_FILE_FOR_LIBRARIES"; - if(this->Makefile->IsOn(responseVar.c_str())) + if(this->Makefile->IsOn(responseVar)) { useResponseFileForLibs = true; } @@ -498,21 +498,21 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules std::string arCreateVar = "CMAKE_"; arCreateVar += linkLanguage; arCreateVar += "_ARCHIVE_CREATE"; - if(const char* rule = this->Makefile->GetDefinition(arCreateVar.c_str())) + if(const char* rule = this->Makefile->GetDefinition(arCreateVar)) { cmSystemTools::ExpandListArgument(rule, archiveCreateCommands); } std::string arAppendVar = "CMAKE_"; arAppendVar += linkLanguage; arAppendVar += "_ARCHIVE_APPEND"; - if(const char* rule = this->Makefile->GetDefinition(arAppendVar.c_str())) + if(const char* rule = this->Makefile->GetDefinition(arAppendVar)) { cmSystemTools::ExpandListArgument(rule, archiveAppendCommands); } std::string arFinishVar = "CMAKE_"; arFinishVar += linkLanguage; arFinishVar += "_ARCHIVE_FINISH"; - if(const char* rule = this->Makefile->GetDefinition(arFinishVar.c_str())) + if(const char* rule = this->Makefile->GetDefinition(arFinishVar)) { cmSystemTools::ExpandListArgument(rule, archiveFinishCommands); } @@ -580,7 +580,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules vars.Language = linkLanguage.c_str(); vars.Objects = buildObjs.c_str(); std::string objectDir = this->Target->GetSupportDirectory(); - objectDir = this->Convert(objectDir.c_str(), + objectDir = this->Convert(objectDir, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); vars.ObjectDir = objectDir.c_str(); @@ -611,7 +611,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules { // Convert to a path for the native build tool. install_name_dir = - this->LocalGenerator->Convert(install_name_dir.c_str(), + this->LocalGenerator->Convert(install_name_dir, cmLocalGenerator::NONE, cmLocalGenerator::SHELL, false); vars.TargetInstallNameDir = install_name_dir.c_str(); @@ -745,7 +745,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules // Write the build rule. this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - targetFullPathReal.c_str(), + targetFullPathReal, depends, commands, false); // Some targets have more than one output file. Create rules to @@ -764,7 +764,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules } // Write the main driver rule to build everything in this target. - this->WriteTargetDriverRule(targetFullPath.c_str(), relink); + this->WriteTargetDriverRule(targetFullPath, relink); // Clean all the possible library names and symlinks. this->CleanFiles.insert(this->CleanFiles.end(), @@ -783,7 +783,7 @@ cmMakefileLibraryTargetGenerator fvar += "_OSX_"; fvar += name; fvar += "_VERSION_FLAG"; - const char* flag = this->Makefile->GetDefinition(fvar.c_str()); + const char* flag = this->Makefile->GetDefinition(fvar); // Skip if no such flag. if(!flag) diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 28a8f04..0730bc3 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -167,7 +167,7 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules() o != outputs.end(); ++o) { this->CleanFiles.push_back - (this->Convert(o->c_str(), + (this->Convert(*o, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::UNCHANGED)); } @@ -216,7 +216,7 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules() *this->BuildFileStream << "# Include any dependencies generated for this target.\n" << this->LocalGenerator->IncludeDirective << " " << root - << this->Convert(dependFileNameFull.c_str(), + << this->Convert(dependFileNameFull, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE) << "\n\n"; @@ -227,7 +227,7 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules() *this->BuildFileStream << "# Include the progress variables for this target.\n" << this->LocalGenerator->IncludeDirective << " " << root - << this->Convert(this->ProgressFileNameFull.c_str(), + << this->Convert(this->ProgressFileNameFull, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE) << "\n\n"; @@ -260,7 +260,7 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules() *this->BuildFileStream << "# Include the compile flags for this target's objects.\n" << this->LocalGenerator->IncludeDirective << " " << root - << this->Convert(this->FlagFileNameFull.c_str(), + << this->Convert(this->FlagFileNameFull, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE) << "\n\n"; @@ -329,7 +329,7 @@ std::string cmMakefileTargetGenerator::GetDefines(const std::string &l) // Add preprocessor definitions for this target and configuration. this->LocalGenerator->AddCompileDefinitions(defines, this->Target, - this->LocalGenerator->ConfigurationName.c_str()); + this->LocalGenerator->ConfigurationName); std::string definesString; this->LocalGenerator->JoinDefines(defines, definesString, lang); @@ -354,7 +354,7 @@ void cmMakefileTargetGenerator::WriteTargetLanguageFlags() compiler += *l; compiler += "_COMPILER"; *this->FlagFileStream << "# compile " << l->c_str() << " with " << - this->Makefile->GetSafeDefinition(compiler.c_str()) << "\n"; + this->Makefile->GetSafeDefinition(compiler) << "\n"; } for(std::set<std::string>::const_iterator l = languages.begin(); @@ -389,9 +389,9 @@ cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator() output += "/"; output += cmSystemTools::GetFilenameName(input); this->Generator->CleanFiles.push_back( - this->Generator->Convert(output.c_str(), + this->Generator->Convert(output, cmLocalGenerator::START_OUTPUT)); - output = this->Generator->Convert(output.c_str(), + output = this->Generator->Convert(output, cmLocalGenerator::HOME_OUTPUT); // Create a rule to copy the content into the bundle. @@ -404,17 +404,17 @@ cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator() commands, copyEcho.c_str(), cmLocalUnixMakefileGenerator3::EchoBuild); std::string copyCommand = "$(CMAKE_COMMAND) -E copy "; - copyCommand += this->Generator->Convert(input.c_str(), + copyCommand += this->Generator->Convert(input, cmLocalGenerator::NONE, cmLocalGenerator::SHELL); copyCommand += " "; - copyCommand += this->Generator->Convert(output.c_str(), + copyCommand += this->Generator->Convert(output, cmLocalGenerator::NONE, cmLocalGenerator::SHELL); commands.push_back(copyCommand); this->Generator->LocalGenerator->WriteMakeRule( *this->Generator->BuildFileStream, 0, - output.c_str(), + output, depends, commands, false); this->Generator->ExtraFiles.insert(output); } @@ -457,7 +457,7 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source) // Create the directory containing the object file. This may be a // subdirectory under the target's directory. - std::string dir = cmSystemTools::GetFilenamePath(obj.c_str()); + std::string dir = cmSystemTools::GetFilenamePath(obj); cmSystemTools::MakeDirectory (this->LocalGenerator->ConvertToFullPath(dir).c_str()); @@ -483,9 +483,9 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(cmSourceFile& source) objFullPath += "/"; objFullPath += obj; objFullPath = - this->Convert(objFullPath.c_str(), cmLocalGenerator::FULL); + this->Convert(objFullPath, cmLocalGenerator::FULL); std::string srcFullPath = - this->Convert(source.GetFullPath().c_str(), cmLocalGenerator::FULL); + this->Convert(source.GetFullPath(), cmLocalGenerator::FULL); this->LocalGenerator-> AddImplicitDepends(*this->Target, lang, objFullPath.c_str(), @@ -586,7 +586,7 @@ cmMakefileTargetGenerator std::string defPropName = "COMPILE_DEFINITIONS_"; defPropName += configUpper; if(const char* config_compile_defs = - source.GetProperty(defPropName.c_str())) + source.GetProperty(defPropName)) { this->LocalGenerator->AppendDefines(defines, config_compile_defs); *this->FlagFileStream @@ -600,10 +600,10 @@ cmMakefileTargetGenerator std::string sourceFile = source.GetFullPath(); if(this->LocalGenerator->UseRelativePaths) { - sourceFile = this->Convert(sourceFile.c_str(), + sourceFile = this->Convert(sourceFile, cmLocalGenerator::START_OUTPUT); } - sourceFile = this->Convert(sourceFile.c_str(), + sourceFile = this->Convert(sourceFile, cmLocalGenerator::NONE, cmLocalGenerator::SHELL); @@ -652,14 +652,14 @@ cmMakefileTargetGenerator } } - targetOutPathReal = this->Convert(targetFullPathReal.c_str(), + targetOutPathReal = this->Convert(targetFullPathReal, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); targetOutPathPDB = - this->Convert(targetFullPathPDB.c_str(),cmLocalGenerator::NONE, + this->Convert(targetFullPathPDB,cmLocalGenerator::NONE, cmLocalGenerator::SHELL); targetOutPathCompilePDB = - this->Convert(targetFullPathCompilePDB.c_str(), + this->Convert(targetFullPathCompilePDB, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); } @@ -672,12 +672,12 @@ cmMakefileTargetGenerator vars.TargetCompilePDB = targetOutPathCompilePDB.c_str(); vars.Source = sourceFile.c_str(); std::string shellObj = - this->Convert(obj.c_str(), + this->Convert(obj, cmLocalGenerator::NONE, - cmLocalGenerator::SHELL).c_str(); + cmLocalGenerator::SHELL); vars.Object = shellObj.c_str(); std::string objectDir = this->Target->GetSupportDirectory(); - objectDir = this->Convert(objectDir.c_str(), + objectDir = this->Convert(objectDir, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); vars.ObjectDir = objectDir.c_str(); @@ -699,7 +699,7 @@ cmMakefileTargetGenerator compileRuleVar += lang; compileRuleVar += "_COMPILE_OBJECT"; std::string compileRule = - this->Makefile->GetRequiredDefinition(compileRuleVar.c_str()); + this->Makefile->GetRequiredDefinition(compileRuleVar); std::vector<std::string> compileCommands; cmSystemTools::ExpandListArgument(compileRule, compileCommands); @@ -738,7 +738,7 @@ cmMakefileTargetGenerator // Write the rule. this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - relativeObj.c_str(), + relativeObj, depends, commands, false); // Check for extra outputs created by the compilation. @@ -756,7 +756,7 @@ cmMakefileTargetGenerator this->GenerateExtraOutput(eoi->c_str(), relativeObj.c_str(), false); // Register this as an extra file to clean. - this->CleanFiles.push_back(eoi->c_str()); + this->CleanFiles.push_back(*eoi); } } @@ -792,15 +792,15 @@ cmMakefileTargetGenerator preprocessRuleVar += lang; preprocessRuleVar += "_CREATE_PREPROCESSED_SOURCE"; if(const char* preprocessRule = - this->Makefile->GetDefinition(preprocessRuleVar.c_str())) + this->Makefile->GetDefinition(preprocessRuleVar)) { std::vector<std::string> preprocessCommands; cmSystemTools::ExpandListArgument(preprocessRule, preprocessCommands); std::string shellObjI = - this->Convert(objI.c_str(), + this->Convert(objI, cmLocalGenerator::NONE, - cmLocalGenerator::SHELL).c_str(); + cmLocalGenerator::SHELL); vars.PreprocessedSource = shellObjI.c_str(); // Expand placeholders in the commands. @@ -826,7 +826,7 @@ cmMakefileTargetGenerator } this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - relativeObjI.c_str(), + relativeObjI, force_depends, commands, false); } @@ -849,15 +849,15 @@ cmMakefileTargetGenerator assemblyRuleVar += lang; assemblyRuleVar += "_CREATE_ASSEMBLY_SOURCE"; if(const char* assemblyRule = - this->Makefile->GetDefinition(assemblyRuleVar.c_str())) + this->Makefile->GetDefinition(assemblyRuleVar)) { std::vector<std::string> assemblyCommands; cmSystemTools::ExpandListArgument(assemblyRule, assemblyCommands); std::string shellObjS = - this->Convert(objS.c_str(), + this->Convert(objS, cmLocalGenerator::NONE, - cmLocalGenerator::SHELL).c_str(); + cmLocalGenerator::SHELL); vars.AssemblySource = shellObjS.c_str(); // Expand placeholders in the commands. @@ -883,7 +883,7 @@ cmMakefileTargetGenerator } this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - relativeObjS.c_str(), + relativeObjS, force_depends, commands, false); } } @@ -895,7 +895,7 @@ cmMakefileTargetGenerator std::vector<std::string> p_depends; // always provide an empty requires target this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - objectRequires.c_str(), p_depends, + objectRequires, p_depends, no_commands, true); // write a build rule to recursively build what this obj provides @@ -909,19 +909,19 @@ cmMakefileTargetGenerator tgtMakefileName += "/build.make"; r_commands.push_back (this->LocalGenerator->GetRecursiveMakeCall(tgtMakefileName.c_str(), - temp.c_str())); + temp)); p_depends.clear(); p_depends.push_back(objectRequires); this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - objectProvides.c_str(), p_depends, + objectProvides, p_depends, r_commands, true); // write the provides.build rule dependency on the obj file p_depends.clear(); p_depends.push_back(relativeObj); this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - temp.c_str(), p_depends, no_commands, + temp, p_depends, no_commands, false); } @@ -950,7 +950,7 @@ void cmMakefileTargetGenerator::WriteTargetRequiresRules() // Write the rule. this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - depTarget.c_str(), + depTarget, depends, no_commands, true); } @@ -975,7 +975,7 @@ void cmMakefileTargetGenerator::WriteTargetCleanRules() // Write the rule. this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - cleanTarget.c_str(), + cleanTarget, depends, commands, true); } @@ -1011,8 +1011,8 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() pi != this->MultipleOutputPairs.end(); ++pi) { *this->InfoFileStream - << " " << this->LocalGenerator->EscapeForCMake(pi->first.c_str()) - << " " << this->LocalGenerator->EscapeForCMake(pi->second.c_str()) + << " " << this->LocalGenerator->EscapeForCMake(pi->first) + << " " << this->LocalGenerator->EscapeForCMake(pi->second) << "\n"; } *this->InfoFileStream << " )\n\n"; @@ -1081,7 +1081,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() { *this->InfoFileStream << " \"" - << this->LocalGenerator->Convert(i->c_str(), + << this->LocalGenerator->Convert(*i, cmLocalGenerator::HOME_OUTPUT) << "\"\n"; } @@ -1145,7 +1145,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() << this->Convert(this->Makefile->GetStartOutputDirectory(), cmLocalGenerator::FULL, cmLocalGenerator::SHELL) << " " - << this->Convert(this->InfoFileNameFull.c_str(), + << this->Convert(this->InfoFileNameFull, cmLocalGenerator::FULL, cmLocalGenerator::SHELL); if(this->LocalGenerator->GetColorMakefile()) { @@ -1161,7 +1161,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() // Write the rule. this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - depTarget.c_str(), + depTarget, depends, commands, true); } @@ -1203,7 +1203,7 @@ void cmMakefileTargetGenerator for(std::vector<std::string>::iterator i = deps.begin(); i != deps.end(); ++i) { - depends.push_back(i->c_str()); + depends.push_back(*i); } } } @@ -1247,13 +1247,13 @@ void cmMakefileTargetGenerator bool symbolic = false; if(need_symbolic) { - if(cmSourceFile* sf = this->Makefile->GetSource(o->c_str())) + if(cmSourceFile* sf = this->Makefile->GetSource(*o)) { symbolic = sf->GetPropertyAsBool("SYMBOLIC"); } } this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0, - o->c_str(), depends, commands, + *o, depends, commands, symbolic); // If the rule has changed make sure the output is rebuilt. @@ -1270,7 +1270,7 @@ void cmMakefileTargetGenerator bool symbolic = false; if(need_symbolic) { - if(cmSourceFile* sf = this->Makefile->GetSource(o->c_str())) + if(cmSourceFile* sf = this->Makefile->GetSource(*o)) { symbolic = sf->GetPropertyAsBool("SYMBOLIC"); } @@ -1284,11 +1284,11 @@ void cmMakefileTargetGenerator idi != cc.GetImplicitDepends().end(); ++idi) { std::string objFullPath = - this->Convert(outputs[0].c_str(), cmLocalGenerator::FULL); + this->Convert(outputs[0], cmLocalGenerator::FULL); std::string srcFullPath = - this->Convert(idi->second.c_str(), cmLocalGenerator::FULL); + this->Convert(idi->second, cmLocalGenerator::FULL); this->LocalGenerator-> - AddImplicitDepends(*this->Target, idi->first.c_str(), + AddImplicitDepends(*this->Target, idi->first, objFullPath.c_str(), srcFullPath.c_str()); } @@ -1333,7 +1333,7 @@ cmMakefileTargetGenerator::AppendProgress(std::vector<std::string>& commands) progressDir += cmake::GetCMakeFilesDirectory(); cmOStringStream progCmd; progCmd << "$(CMAKE_COMMAND) -E cmake_progress_report "; - progCmd << this->LocalGenerator->Convert(progressDir.c_str(), + progCmd << this->LocalGenerator->Convert(progressDir, cmLocalGenerator::FULL, cmLocalGenerator::SHELL); progCmd << " $(CMAKE_PROGRESS_" << this->NumberOfProgressActions << ")"; @@ -1349,7 +1349,7 @@ cmMakefileTargetGenerator // Write a make variable assignment that lists all objects for the // target. variableName = - this->LocalGenerator->CreateMakeVariable(this->Target->GetName().c_str(), + this->LocalGenerator->CreateMakeVariable(this->Target->GetName(), "_OBJECTS"); *this->BuildFileStream << "# Object files for target " << this->Target->GetName() << "\n" @@ -1370,7 +1370,7 @@ cmMakefileTargetGenerator if(objName) { *this->BuildFileStream << - this->Convert(i->c_str(), cmLocalGenerator::START_OUTPUT, + this->Convert(*i, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::MAKEFILE); } else @@ -1384,7 +1384,7 @@ cmMakefileTargetGenerator // Write a make variable assignment that lists all external objects // for the target. variableNameExternal = - this->LocalGenerator->CreateMakeVariable(this->Target->GetName().c_str(), + this->LocalGenerator->CreateMakeVariable(this->Target->GetName(), "_EXTERNAL_OBJECTS"); *this->BuildFileStream << "\n" @@ -1395,14 +1395,14 @@ cmMakefileTargetGenerator this->ExternalObjects.begin(); i != this->ExternalObjects.end(); ++i) { - object = this->Convert(i->c_str(),cmLocalGenerator::START_OUTPUT); + object = this->Convert(*i,cmLocalGenerator::START_OUTPUT); *this->BuildFileStream << " " << lineContinue << "\n" << this->Makefile->GetSafeDefinition("CMAKE_OBJECT_NAME"); if(objName) { *this->BuildFileStream << - this->Convert(i->c_str(), cmLocalGenerator::START_OUTPUT, + this->Convert(*i, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::MAKEFILE); } else @@ -1439,7 +1439,7 @@ public: { // Construct the name of the next object. this->NextObject = - this->LocalGenerator->Convert(obj.c_str(), + this->LocalGenerator->Convert(obj, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::RESPONSE); @@ -1505,7 +1505,7 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule( this->LocalGenerator->GetRelativeTargetDirectory(*this->Target); std::string buildTargetRuleName = dir; buildTargetRuleName += relink?"/preinstall":"/build"; - buildTargetRuleName = this->Convert(buildTargetRuleName.c_str(), + buildTargetRuleName = this->Convert(buildTargetRuleName, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::UNCHANGED); @@ -1541,7 +1541,7 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule( // Write the driver rule. std::vector<std::string> no_commands; this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, comment, - buildTargetRuleName.c_str(), + buildTargetRuleName, depends, no_commands, true); } @@ -1555,7 +1555,7 @@ std::string cmMakefileTargetGenerator::GetFrameworkFlags(std::string const& l) std::string fwSearchFlagVar = "CMAKE_" + l + "_FRAMEWORK_SEARCH_FLAG"; const char* fwSearchFlag = - this->Makefile->GetDefinition(fwSearchFlagVar.c_str()); + this->Makefile->GetDefinition(fwSearchFlagVar); if(!(fwSearchFlag && *fwSearchFlag)) { return std::string(); @@ -1577,7 +1577,7 @@ std::string cmMakefileTargetGenerator::GetFrameworkFlags(std::string const& l) for(std::vector<std::string>::iterator i = includes.begin(); i != includes.end(); ++i) { - if(this->Target->NameResolvesToFramework(i->c_str())) + if(this->Target->NameResolvesToFramework(*i)) { std::string frameworkDir = *i; frameworkDir += "/../"; @@ -1597,7 +1597,7 @@ std::string cmMakefileTargetGenerator::GetFrameworkFlags(std::string const& l) if(emitted.insert(*i).second) { flags += fwSearchFlag; - flags += this->Convert(i->c_str(), + flags += this->Convert(*i, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL, true); flags += " "; @@ -1692,7 +1692,7 @@ std::string cmMakefileTargetGenerator::GetLinkRule( std::string ruleVar = "CMAKE_"; ruleVar += this->Target->GetLinkerLanguage(this->ConfigName); ruleVar += "_GNUtoMS_RULE"; - if(const char* rule = this->Makefile->GetDefinition(ruleVar.c_str())) + if(const char* rule = this->Makefile->GetDefinition(ruleVar)) { linkRule += rule; } @@ -1721,7 +1721,7 @@ void cmMakefileTargetGenerator::RemoveForbiddenFlags(const char* flagVar, removeFlags += linkLang; removeFlags += flagVar; std::string removeflags = - this->Makefile->GetSafeDefinition(removeFlags.c_str()); + this->Makefile->GetSafeDefinition(removeFlags); std::vector<std::string> removeList; cmSystemTools::ExpandListArgument(removeflags, removeList); @@ -1799,7 +1799,7 @@ cmMakefileTargetGenerator // Create the makefile command to invoke the link script. std::string link_command = "$(CMAKE_COMMAND) -E cmake_link_script "; - link_command += this->Convert(linkScriptName.c_str(), + link_command += this->Convert(linkScriptName, cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); link_command += " --verbose=$(VERBOSE)"; @@ -1854,7 +1854,7 @@ cmMakefileTargetGenerator responseFlagVar += this->Target->GetLinkerLanguage(this->ConfigName); responseFlagVar += "_RESPONSE_FILE_LINK_FLAG"; const char* responseFlag = - this->Makefile->GetDefinition(responseFlagVar.c_str()); + this->Makefile->GetDefinition(responseFlagVar); if(!responseFlag) { responseFlag = "@"; @@ -1866,7 +1866,7 @@ cmMakefileTargetGenerator // Reference the response file. linkLibs = responseFlag; - linkLibs += this->Convert(link_rsp.c_str(), + linkLibs += this->Convert(link_rsp, cmLocalGenerator::NONE, cmLocalGenerator::SHELL); } @@ -1896,7 +1896,7 @@ cmMakefileTargetGenerator responseFlagVar += this->Target->GetLinkerLanguage(this->ConfigName); responseFlagVar += "_RESPONSE_FILE_LINK_FLAG"; const char* responseFlag = - this->Makefile->GetDefinition(responseFlagVar.c_str()); + this->Makefile->GetDefinition(responseFlagVar); if(!responseFlag) { responseFlag = "@"; @@ -1920,7 +1920,7 @@ cmMakefileTargetGenerator // Reference the response file. buildObjs += responseFlag; - buildObjs += this->Convert(objects_rsp.c_str(), + buildObjs += this->Convert(objects_rsp, cmLocalGenerator::NONE, cmLocalGenerator::SHELL); } @@ -1949,7 +1949,7 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags, std::string responseVar = "CMAKE_"; responseVar += lang; responseVar += "_USE_RESPONSE_FILE_FOR_INCLUDES"; - bool useResponseFile = this->Makefile->IsOn(responseVar.c_str()); + bool useResponseFile = this->Makefile->IsOn(responseVar); std::vector<std::string> includes; @@ -2070,7 +2070,7 @@ void cmMakefileTargetGenerator::AddFortranFlags(std::string& flags) idi != includes.end(); ++idi) { std::string flg = modpath_flag; - flg += this->Convert(idi->c_str(), + flg += this->Convert(*idi, cmLocalGenerator::NONE, cmLocalGenerator::SHELL); this->LocalGenerator->AppendFlags(flags, flg.c_str()); @@ -2098,7 +2098,7 @@ void cmMakefileTargetGenerator::AddModuleDefinitionFlag(std::string& flags) // Append the flag and value. Use ConvertToLinkReference to help // vs6's "cl -link" pass it to the linker. std::string flag = defFileFlag; - flag += (this->LocalGenerator->ConvertToLinkReference(def.c_str())); + flag += (this->LocalGenerator->ConvertToLinkReference(def)); this->LocalGenerator->AppendFlags(flags, flag.c_str()); } diff --git a/Source/cmMakefileUtilityTargetGenerator.cxx b/Source/cmMakefileUtilityTargetGenerator.cxx index 2066fc2..6b039bb 100644 --- a/Source/cmMakefileUtilityTargetGenerator.cxx +++ b/Source/cmMakefileUtilityTargetGenerator.cxx @@ -52,7 +52,7 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles() *this->BuildFileStream << "# Include the progress variables for this target.\n" << this->LocalGenerator->IncludeDirective << " " << root - << this->Convert(this->ProgressFileNameFull.c_str(), + << this->Convert(this->ProgressFileNameFull, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::MAKEFILE) << "\n\n"; @@ -105,7 +105,7 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles() depends, commands, true); // Write the main driver rule to build everything in this target. - this->WriteTargetDriverRule(this->Target->GetName().c_str(), false); + this->WriteTargetDriverRule(this->Target->GetName(), false); // Write clean target this->WriteTargetCleanRules(); diff --git a/Source/cmMarkAsAdvancedCommand.cxx b/Source/cmMarkAsAdvancedCommand.cxx index 4236d10..f6a2c26 100644 --- a/Source/cmMarkAsAdvancedCommand.cxx +++ b/Source/cmMarkAsAdvancedCommand.cxx @@ -42,11 +42,11 @@ bool cmMarkAsAdvancedCommand if ( it.IsAtEnd() ) { this->Makefile->GetCacheManager() - ->AddCacheEntry(variable.c_str(), 0, 0, + ->AddCacheEntry(variable, 0, 0, cmCacheManager::UNINITIALIZED); overwrite = true; } - it.Find(variable.c_str()); + it.Find(variable); if ( it.IsAtEnd() ) { cmSystemTools::Error("This should never happen..."); diff --git a/Source/cmMathCommand.cxx b/Source/cmMathCommand.cxx index 9fc4265..f1942c5 100644 --- a/Source/cmMathCommand.cxx +++ b/Source/cmMathCommand.cxx @@ -28,7 +28,7 @@ bool cmMathCommand return this->HandleExprCommand(args); } std::string e = "does not recognize sub-command "+subCommand; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -49,13 +49,13 @@ bool cmMathCommand::HandleExprCommand(std::vector<std::string> const& args) { std::string e = "cannot parse the expression: \""+expression+"\": "; e += helper.GetError(); - this->SetError(e.c_str()); + this->SetError(e); return false; } char buffer[1024]; sprintf(buffer, "%d", helper.GetResult()); - this->Makefile->AddDefinition(outputVariable.c_str(), buffer); + this->Makefile->AddDefinition(outputVariable, buffer); return true; } diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx index d85e720..88d6a77 100644 --- a/Source/cmMessageCommand.cxx +++ b/Source/cmMessageCommand.cxx @@ -77,7 +77,7 @@ bool cmMessageCommand if (type != cmake::MESSAGE) { - this->Makefile->IssueMessage(type, message.c_str()); + this->Makefile->IssueMessage(type, message); } else { diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index a49fc2d..686ec81 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -175,7 +175,7 @@ cmNinjaNormalTargetGenerator // build response file name std::string cmakeLinkVar = cmakeVarLang + "_RESPONSE_FILE_LINK_FLAG"; - const char * flag = GetMakefile()->GetDefinition(cmakeLinkVar.c_str()); + const char * flag = GetMakefile()->GetDefinition(cmakeLinkVar); if(flag) { responseFlag = flag; } else { @@ -189,7 +189,7 @@ cmNinjaNormalTargetGenerator linkOptionVar += "_COMPILER_LINKER_OPTION_FLAG_"; linkOptionVar += cmTarget::GetTargetTypeName(targetType); const std::string linkOption = - GetMakefile()->GetSafeDefinition(linkOptionVar.c_str()); + GetMakefile()->GetSafeDefinition(linkOptionVar); rspcontent = "$in_newline "+linkOption+" $LINK_PATH $LINK_LIBRARIES"; vars.Objects = responseFlag.c_str(); vars.LinkLibraries = ""; @@ -321,7 +321,7 @@ cmNinjaNormalTargetGenerator linkCmdVar += this->TargetLinkLanguage; linkCmdVar += "_CREATE_STATIC_LIBRARY"; if (const char *linkCmd = - this->GetMakefile()->GetDefinition(linkCmdVar.c_str())) + this->GetMakefile()->GetDefinition(linkCmdVar)) { cmSystemTools::ExpandListArgument(linkCmd, linkCmds); return linkCmds; @@ -341,7 +341,7 @@ cmNinjaNormalTargetGenerator linkCmdVar += this->TargetLinkLanguage; linkCmdVar += "_ARCHIVE_CREATE"; const char *linkCmd = - this->GetMakefile()->GetRequiredDefinition(linkCmdVar.c_str()); + this->GetMakefile()->GetRequiredDefinition(linkCmdVar); cmSystemTools::ExpandListArgument(linkCmd, linkCmds); } { @@ -349,7 +349,7 @@ cmNinjaNormalTargetGenerator linkCmdVar += this->TargetLinkLanguage; linkCmdVar += "_ARCHIVE_FINISH"; const char *linkCmd = - this->GetMakefile()->GetRequiredDefinition(linkCmdVar.c_str()); + this->GetMakefile()->GetRequiredDefinition(linkCmdVar); cmSystemTools::ExpandListArgument(linkCmd, linkCmds); } return linkCmds; @@ -374,7 +374,7 @@ cmNinjaNormalTargetGenerator } const char *linkCmd = - this->GetMakefile()->GetRequiredDefinition(linkCmdVar.c_str()); + this->GetMakefile()->GetRequiredDefinition(linkCmdVar); cmSystemTools::ExpandListArgument(linkCmd, linkCmds); return linkCmds; } @@ -497,7 +497,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() if (!install_name_dir.empty()) { vars["INSTALLNAME_DIR"] = - this->GetLocalGenerator()->Convert(install_name_dir.c_str(), + this->GetLocalGenerator()->Convert(install_name_dir, cmLocalGenerator::NONE, cmLocalGenerator::SHELL, false); } @@ -506,7 +506,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() if (!this->TargetNameImport.empty()) { const std::string impLibPath = this->GetLocalGenerator() - ->ConvertToOutputFormat(targetOutputImplib.c_str(), + ->ConvertToOutputFormat(targetOutputImplib, cmLocalGenerator::SHELL); vars["TARGET_IMPLIB"] = impLibPath; EnsureParentDirectoryExists(impLibPath); diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 3ef236a..d652018 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -140,11 +140,11 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile *source, std::string& languageFlags = this->LanguageFlags[language]; if(!hasLangCached) { - this->AddFeatureFlags(languageFlags, language.c_str()); + this->AddFeatureFlags(languageFlags, language); this->GetLocalGenerator()->AddArchitectureFlags(languageFlags, this->GeneratorTarget, - language.c_str(), + language, this->GetConfigName()); // Add shared-library flags if needed. @@ -153,17 +153,17 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile *source, this->GetConfigName()); this->LocalGenerator->AddVisibilityPresetFlags(languageFlags, this->Target, - language.c_str()); + language); std::vector<std::string> includes; this->LocalGenerator->GetIncludeDirectories(includes, this->GeneratorTarget, - language.c_str(), + language, this->GetConfigName()); // Add include directory flags. std::string includeFlags = this->LocalGenerator->GetIncludeFlags(includes, this->GeneratorTarget, - language.c_str(), + language, language == "RC" ? true : false); // full include paths for RC // needed by cmcldeps if(cmGlobalNinjaGenerator::IsMinGW()) @@ -177,7 +177,7 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile *source, // Add target-specific flags. this->LocalGenerator->AddCompileOptions(languageFlags, this->Target, - language.c_str(), + language, this->GetConfigName()); } @@ -232,12 +232,12 @@ ComputeDefines(cmSourceFile *source, const std::string& language) defPropName += cmSystemTools::UpperCase(this->GetConfigName()); this->LocalGenerator->AppendDefines (defines, - source->GetProperty(defPropName.c_str())); + source->GetProperty(defPropName)); } std::string definesString; this->LocalGenerator->JoinDefines(defines, definesString, - language.c_str()); + language); return definesString; } @@ -340,11 +340,11 @@ bool cmNinjaTargetGenerator::SetMsvcTargetPdbVariable(cmNinjaVars& vars) const } vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat( - ConvertToNinjaPath(pdbPath.c_str()).c_str(), + ConvertToNinjaPath(pdbPath.c_str()), cmLocalGenerator::SHELL); vars["TARGET_COMPILE_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat( - ConvertToNinjaPath(compilePdbPath.c_str()).c_str(), + ConvertToNinjaPath(compilePdbPath.c_str()), cmLocalGenerator::SHELL); EnsureParentDirectoryExists(pdbPath); @@ -420,7 +420,7 @@ cmNinjaTargetGenerator deptype = "gcc"; depfile = "$DEP_FILE"; const std::string flagsName = "CMAKE_DEPFILE_FLAGS_" + lang; - std::string depfileFlags = mf->GetSafeDefinition(flagsName.c_str()); + std::string depfileFlags = mf->GetSafeDefinition(flagsName); if (!depfileFlags.empty()) { cmSystemTools::ReplaceString(depfileFlags, "<DEPFILE>", "$DEP_FILE"); @@ -436,7 +436,7 @@ cmNinjaTargetGenerator // Rule for compiling object file. const std::string cmdVar = std::string("CMAKE_") + lang + "_COMPILE_OBJECT"; - std::string compileCmd = mf->GetRequiredDefinition(cmdVar.c_str()); + std::string compileCmd = mf->GetRequiredDefinition(cmdVar); std::vector<std::string> compileCmds; cmSystemTools::ExpandListArgument(compileCmd, compileCmds); @@ -603,7 +603,7 @@ cmNinjaTargetGenerator std::string objectDir = this->Target->GetSupportDirectory(); vars["OBJECT_DIR"] = this->GetLocalGenerator()->ConvertToOutputFormat( - ConvertToNinjaPath(objectDir.c_str()).c_str(), + ConvertToNinjaPath(objectDir.c_str()), cmLocalGenerator::SHELL); this->addPoolNinjaVariable("JOB_POOL_COMPILE", this->GetTarget(), vars); @@ -628,7 +628,7 @@ cmNinjaTargetGenerator escapedSourceFileName = this->LocalGenerator->ConvertToOutputFormat( - escapedSourceFileName.c_str(), cmLocalGenerator::SHELL); + escapedSourceFileName, cmLocalGenerator::SHELL); compileObjectVars.Source = escapedSourceFileName.c_str(); compileObjectVars.Object = objectFileName.c_str(); @@ -641,7 +641,7 @@ cmNinjaTargetGenerator compileCmdVar += language; compileCmdVar += "_COMPILE_OBJECT"; std::string compileCmd = - this->GetMakefile()->GetRequiredDefinition(compileCmdVar.c_str()); + this->GetMakefile()->GetRequiredDefinition(compileCmdVar); std::vector<std::string> compileCmds; cmSystemTools::ExpandListArgument(compileCmd, compileCmds); @@ -699,7 +699,7 @@ cmNinjaTargetGenerator // vs6's "cl -link" pass it to the linker. std::string flag = defFileFlag; flag += (this->LocalGenerator->ConvertToLinkReference( - this->ModuleDefinitionFile.c_str())); + this->ModuleDefinitionFile)); this->LocalGenerator->AppendFlags(flags, flag.c_str()); } diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx index 449f923..835f892 100644 --- a/Source/cmOSXBundleGenerator.cxx +++ b/Source/cmOSXBundleGenerator.cxx @@ -60,7 +60,7 @@ void cmOSXBundleGenerator::CreateAppBundle(const std::string& targetName, plist += this->GT->Target->GetAppBundleDirectory(this->ConfigName, true); plist += "/Info.plist"; this->LocalGenerator->GenerateAppleInfoPList(this->GT->Target, - targetName.c_str(), + targetName, plist.c_str()); this->Makefile->AddCMakeOutputFile(plist); outpath = newoutpath; @@ -91,7 +91,7 @@ void cmOSXBundleGenerator::CreateFramework( plist += "/Resources/Info.plist"; std::string name = cmSystemTools::GetFilenameName(targetName); this->LocalGenerator->GenerateFrameworkInfoPList(this->GT->Target, - name.c_str(), + name, plist.c_str()); // TODO: Use the cmMakefileTargetGenerator::ExtraFiles vector to @@ -182,7 +182,7 @@ void cmOSXBundleGenerator::CreateCFBundle(const std::string& targetName, this->GT->Target->GetCFBundleDirectory(this->ConfigName, true); plist += "/Info.plist"; this->LocalGenerator->GenerateAppleInfoPList(this->GT->Target, - targetName.c_str(), + targetName, plist.c_str()); this->Makefile->AddCMakeOutputFile(plist); } diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx index dbe2478..e505440 100644 --- a/Source/cmOptionCommand.cxx +++ b/Source/cmOptionCommand.cxx @@ -39,7 +39,7 @@ bool cmOptionCommand m += args[i]; m += " "; } - this->SetError(m.c_str()); + this->SetError(m); return false; } @@ -62,7 +62,7 @@ bool cmOptionCommand initialValue = args[2]; } bool init = cmSystemTools::IsOn(initialValue.c_str()); - this->Makefile->AddCacheDefinition(args[0].c_str(), init? "ON":"OFF", + this->Makefile->AddCacheDefinition(args[0], init? "ON":"OFF", args[1].c_str(), cmCacheManager::BOOL); return true; } diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx index 79677e3..ec671fc 100644 --- a/Source/cmOrderDirectories.cxx +++ b/Source/cmOrderDirectories.cxx @@ -261,7 +261,7 @@ bool cmOrderDirectoriesConstraintLibrary::FindConflict(std::string const& dir) { std::string fname = lib; fname += *i; - if(this->FileMayConflict(dir, fname.c_str())) + if(this->FileMayConflict(dir, fname)) { return true; } diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx index c0d9e99..5016493 100644 --- a/Source/cmOutputRequiredFilesCommand.cxx +++ b/Source/cmOutputRequiredFilesCommand.cxx @@ -202,7 +202,7 @@ bool cmOutputRequiredFilesCommand { std::string err = "Can not open output file: "; err += this->OutputFile; - this->SetError(err.c_str()); + this->SetError(err); return false; } std::set<cmDependInformation const*> visited; diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 93072f5..2bd553f 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -488,7 +488,7 @@ bool cmPolicies::GetPolicyDefault(cmMakefile* mf, std::string const& policy, cmPolicies::PolicyStatus* defaultSetting) { std::string defaultVar = "CMAKE_POLICY_DEFAULT_" + policy; - std::string defaultValue = mf->GetSafeDefinition(defaultVar.c_str()); + std::string defaultValue = mf->GetSafeDefinition(defaultVar); if(defaultValue == "NEW") { *defaultSetting = cmPolicies::NEW; @@ -506,7 +506,7 @@ bool cmPolicies::GetPolicyDefault(cmMakefile* mf, std::string const& policy, cmOStringStream e; e << defaultVar << " has value \"" << defaultValue << "\" but must be \"OLD\", \"NEW\", or \"\" (empty)."; - mf->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); return false; } @@ -651,5 +651,5 @@ cmPolicies::DiagnoseAncientPolicies(std::vector<PolicyID> const& ancient, << "Please either update your CMakeLists.txt files to conform to " << "the new behavior or use an older version of CMake that still " << "supports the old behavior."; - mf->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + mf->IssueMessage(cmake::FATAL_ERROR, e.str()); } diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index a9ce0cc..12318c8 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -28,20 +28,20 @@ bool cmProjectCommand srcdir += "_SOURCE_DIR"; this->Makefile->AddCacheDefinition - (bindir.c_str(), + (bindir, this->Makefile->GetCurrentOutputDirectory(), "Value Computed by CMake", cmCacheManager::STATIC); this->Makefile->AddCacheDefinition - (srcdir.c_str(), + (srcdir, this->Makefile->GetCurrentDirectory(), "Value Computed by CMake", cmCacheManager::STATIC); bindir = "PROJECT_BINARY_DIR"; srcdir = "PROJECT_SOURCE_DIR"; - this->Makefile->AddDefinition(bindir.c_str(), + this->Makefile->AddDefinition(bindir, this->Makefile->GetCurrentOutputDirectory()); - this->Makefile->AddDefinition(srcdir.c_str(), + this->Makefile->AddDefinition(srcdir, this->Makefile->GetCurrentDirectory()); this->Makefile->AddDefinition("PROJECT_NAME", args[0].c_str()); @@ -167,19 +167,19 @@ bool cmProjectCommand std::string vv; vv = args[0] + "_VERSION"; this->Makefile->AddDefinition("PROJECT_VERSION", vs.c_str()); - this->Makefile->AddDefinition(vv.c_str(), vs.c_str()); + this->Makefile->AddDefinition(vv, vs.c_str()); vv = args[0] + "_VERSION_MAJOR"; this->Makefile->AddDefinition("PROJECT_VERSION_MAJOR", vb[0]); - this->Makefile->AddDefinition(vv.c_str(), vb[0]); + this->Makefile->AddDefinition(vv, vb[0]); vv = args[0] + "_VERSION_MINOR"; this->Makefile->AddDefinition("PROJECT_VERSION_MINOR", vb[1]); - this->Makefile->AddDefinition(vv.c_str(), vb[1]); + this->Makefile->AddDefinition(vv, vb[1]); vv = args[0] + "_VERSION_PATCH"; this->Makefile->AddDefinition("PROJECT_VERSION_PATCH", vb[2]); - this->Makefile->AddDefinition(vv.c_str(), vb[2]); + this->Makefile->AddDefinition(vv, vb[2]); vv = args[0] + "_VERSION_TWEAK"; this->Makefile->AddDefinition("PROJECT_VERSION_TWEAK", vb[3]); - this->Makefile->AddDefinition(vv.c_str(), vb[3]); + this->Makefile->AddDefinition(vv, vb[3]); } else if(cmp0048 != cmPolicies::OLD) { @@ -199,7 +199,7 @@ bool cmProjectCommand for(std::vector<std::string>::iterator i = vv.begin(); i != vv.end(); ++i) { - const char* v = this->Makefile->GetDefinition(i->c_str()); + const char* v = this->Makefile->GetDefinition(*i); if(v && *v) { if(cmp0048 == cmPolicies::WARN) @@ -209,7 +209,7 @@ bool cmProjectCommand } else { - this->Makefile->AddDefinition(i->c_str(), ""); + this->Makefile->AddDefinition(*i, ""); } } } @@ -231,7 +231,7 @@ bool cmProjectCommand } this->Makefile->EnableLanguage(languages, false); std::string extraInclude = "CMAKE_PROJECT_" + args[0] + "_INCLUDE"; - const char* include = this->Makefile->GetDefinition(extraInclude.c_str()); + const char* include = this->Makefile->GetDefinition(extraInclude); if(include) { std::string fullFilePath; @@ -244,7 +244,7 @@ bool cmProjectCommand "could not find file:\n" " "; m += include; - this->SetError(m.c_str()); + this->SetError(m); return false; } } diff --git a/Source/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx index ca007cb..a984260 100644 --- a/Source/cmQTWrapCPPCommand.cxx +++ b/Source/cmQTWrapCPPCommand.cxx @@ -32,13 +32,13 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> const& argsIn, // Get the variable holding the list of sources. std::string const& sourceList = args[1]; std::string sourceListValue = - this->Makefile->GetSafeDefinition(sourceList.c_str()); + this->Makefile->GetSafeDefinition(sourceList); // Create a rule for all sources listed. for(std::vector<std::string>::iterator j = (args.begin() + 2); j != args.end(); ++j) { - cmSourceFile *curr = this->Makefile->GetSource(j->c_str()); + cmSourceFile *curr = this->Makefile->GetSource(*j); // if we should wrap the class if(!(curr && curr->GetPropertyAsBool("WRAP_EXCLUDE"))) { @@ -50,7 +50,7 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> const& argsIn, newName += srcName; newName += ".cxx"; cmSourceFile* sf = - this->Makefile->GetOrCreateSource(newName.c_str(), true); + this->Makefile->GetOrCreateSource(newName, true); if (curr) { sf->SetProperty("ABSTRACT", curr->GetProperty("ABSTRACT")); @@ -99,7 +99,7 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> const& argsIn, std::string no_main_dependency = ""; const char* no_working_dir = 0; - this->Makefile->AddCustomCommandToOutput(newName.c_str(), + this->Makefile->AddCustomCommandToOutput(newName, depends, no_main_dependency, commandLines, @@ -109,7 +109,7 @@ bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> const& argsIn, } // Store the final list of source files. - this->Makefile->AddDefinition(sourceList.c_str(), + this->Makefile->AddDefinition(sourceList, sourceListValue.c_str()); return true; } diff --git a/Source/cmQTWrapUICommand.cxx b/Source/cmQTWrapUICommand.cxx index 2a1129d..dce59ef 100644 --- a/Source/cmQTWrapUICommand.cxx +++ b/Source/cmQTWrapUICommand.cxx @@ -35,15 +35,15 @@ bool cmQTWrapUICommand::InitialPass(std::vector<std::string> const& argsIn, std::string const& headerList = args[1]; std::string const& sourceList = args[2]; std::string headerListValue = - this->Makefile->GetSafeDefinition(headerList.c_str()); + this->Makefile->GetSafeDefinition(headerList); std::string sourceListValue = - this->Makefile->GetSafeDefinition(sourceList.c_str()); + this->Makefile->GetSafeDefinition(sourceList); // Create rules for all sources listed. for(std::vector<std::string>::iterator j = (args.begin() + 3); j != args.end(); ++j) { - cmSourceFile *curr = this->Makefile->GetSource(j->c_str()); + cmSourceFile *curr = this->Makefile->GetSource(*j); // if we should wrap the class if(!(curr && curr->GetPropertyAsBool("WRAP_EXCLUDE"))) { @@ -131,7 +131,7 @@ bool cmQTWrapUICommand::InitialPass(std::vector<std::string> const& argsIn, std::string no_main_dependency = ""; const char* no_comment = 0; const char* no_working_dir = 0; - this->Makefile->AddCustomCommandToOutput(hName.c_str(), + this->Makefile->AddCustomCommandToOutput(hName, depends, no_main_dependency, hCommandLines, @@ -139,7 +139,7 @@ bool cmQTWrapUICommand::InitialPass(std::vector<std::string> const& argsIn, no_working_dir); depends.push_back(hName); - this->Makefile->AddCustomCommandToOutput(cxxName.c_str(), + this->Makefile->AddCustomCommandToOutput(cxxName, depends, no_main_dependency, cxxCommandLines, @@ -148,7 +148,7 @@ bool cmQTWrapUICommand::InitialPass(std::vector<std::string> const& argsIn, depends.clear(); depends.push_back(hName); - this->Makefile->AddCustomCommandToOutput(mocName.c_str(), + this->Makefile->AddCustomCommandToOutput(mocName, depends, no_main_dependency, mocCommandLines, @@ -158,9 +158,9 @@ bool cmQTWrapUICommand::InitialPass(std::vector<std::string> const& argsIn, } // Store the final list of source files and headers. - this->Makefile->AddDefinition(sourceList.c_str(), + this->Makefile->AddDefinition(sourceList, sourceListValue.c_str()); - this->Makefile->AddDefinition(headerList.c_str(), + this->Makefile->AddDefinition(headerList, headerListValue.c_str()); return true; } diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index c32f624..aa106c7 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -188,7 +188,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) mocCppFile += automocTargetName; mocCppFile += ".cpp"; cmSourceFile* mocCppSource = makefile->GetOrCreateSource( - mocCppFile.c_str(), + mocCppFile, true); makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES", mocCppFile.c_str(), false); @@ -278,7 +278,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) #endif { cmTarget* autogenTarget = makefile->AddUtilityCommand( - autogenTargetName.c_str(), true, + autogenTargetName, true, workingDirectory.c_str(), depends, commandLines, false, autogenComment.c_str()); // Set target folder @@ -299,7 +299,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target) copyTargetProperty(autogenTarget, target, "FOLDER"); } - target->AddUtility(autogenTargetName.c_str()); + target->AddUtility(autogenTargetName); } return true; @@ -356,7 +356,7 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target) std::string autogenTargetName = getAutogenTargetName(target); makefile->AddDefinition("_moc_target_name", - cmLocalGenerator::EscapeForCMake(autogenTargetName.c_str()).c_str()); + cmLocalGenerator::EscapeForCMake(autogenTargetName).c_str()); std::string targetDir = getAutogenTargetDir(target); @@ -385,7 +385,7 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target) this->SetupSourceFiles(target); } makefile->AddDefinition("_cpp_files", - cmLocalGenerator::EscapeForCMake(this->Sources.c_str()).c_str()); + cmLocalGenerator::EscapeForCMake(this->Sources).c_str()); if (target->GetPropertyAsBool("AUTOMOC")) { this->SetupAutoMocTarget(target, autogenTargetName, @@ -501,7 +501,7 @@ void cmQtAutoGenerators::SetupSourceFiles(cmTarget const* target) makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES", rcc_output_file.c_str(), false); cmSourceFile* rccCppSource - = makefile->GetOrCreateSource(rcc_output_file.c_str(), true); + = makefile->GetOrCreateSource(rcc_output_file, true); newRccFiles.push_back(rccCppSource); } } @@ -552,11 +552,11 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target, const char* tmp = target->GetProperty("AUTOMOC_MOC_OPTIONS"); std::string _moc_options = (tmp!=0 ? tmp : ""); makefile->AddDefinition("_moc_options", - cmLocalGenerator::EscapeForCMake(_moc_options.c_str()).c_str()); + cmLocalGenerator::EscapeForCMake(_moc_options).c_str()); makefile->AddDefinition("_skip_moc", - cmLocalGenerator::EscapeForCMake(this->SkipMoc.c_str()).c_str()); + cmLocalGenerator::EscapeForCMake(this->SkipMoc).c_str()); makefile->AddDefinition("_moc_headers", - cmLocalGenerator::EscapeForCMake(this->Headers.c_str()).c_str()); + cmLocalGenerator::EscapeForCMake(this->Headers).c_str()); bool relaxedMode = makefile->IsOn("CMAKE_AUTOMOC_RELAXED_MODE"); makefile->AddDefinition("_moc_relaxed_mode", relaxedMode ? "TRUE" : "FALSE"); @@ -568,22 +568,22 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target, _moc_incs, _moc_compile_defs); makefile->AddDefinition("_moc_incs", - cmLocalGenerator::EscapeForCMake(_moc_incs.c_str()).c_str()); + cmLocalGenerator::EscapeForCMake(_moc_incs).c_str()); makefile->AddDefinition("_moc_compile_defs", - cmLocalGenerator::EscapeForCMake(_moc_compile_defs.c_str()).c_str()); + cmLocalGenerator::EscapeForCMake(_moc_compile_defs).c_str()); for (std::vector<std::string>::const_iterator li = configs.begin(); li != configs.end(); ++li) { std::string config_moc_incs; std::string config_moc_compile_defs; - GetCompileDefinitionsAndDirectories(target, li->c_str(), + GetCompileDefinitionsAndDirectories(target, *li, config_moc_incs, config_moc_compile_defs); if (config_moc_incs != _moc_incs) { configIncludes[*li] = - cmLocalGenerator::EscapeForCMake(config_moc_incs.c_str()); + cmLocalGenerator::EscapeForCMake(config_moc_incs); if(_moc_incs.empty()) { _moc_incs = config_moc_incs; @@ -592,7 +592,7 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target, if (config_moc_compile_defs != _moc_compile_defs) { configDefines[*li] = - cmLocalGenerator::EscapeForCMake(config_moc_compile_defs.c_str()); + cmLocalGenerator::EscapeForCMake(config_moc_compile_defs); if(_moc_compile_defs.empty()) { _moc_compile_defs = config_moc_compile_defs; @@ -699,7 +699,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, std::set<std::string> skipped; std::vector<std::string> skipVec; - cmSystemTools::ExpandListArgument(this->SkipUic.c_str(), skipVec); + cmSystemTools::ExpandListArgument(this->SkipUic, skipVec); for (std::vector<std::string>::const_iterator li = skipVec.begin(); li != skipVec.end(); ++li) @@ -708,7 +708,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, } makefile->AddDefinition("_skip_uic", - cmLocalGenerator::EscapeForCMake(this->SkipUic.c_str()).c_str()); + cmLocalGenerator::EscapeForCMake(this->SkipUic).c_str()); std::vector<cmSourceFile*> uiFilesWithOptions = makefile->GetQtUiFilesWithOptions(); @@ -722,18 +722,18 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, if (!_uic_opts.empty()) { - _uic_opts = cmLocalGenerator::EscapeForCMake(_uic_opts.c_str()); + _uic_opts = cmLocalGenerator::EscapeForCMake(_uic_opts); makefile->AddDefinition("_uic_target_options", _uic_opts.c_str()); } for (std::vector<std::string>::const_iterator li = configs.begin(); li != configs.end(); ++li) { std::string config_uic_opts; - GetUicOpts(target, li->c_str(), config_uic_opts); + GetUicOpts(target, *li, config_uic_opts); if (config_uic_opts != _uic_opts) { configUicOptions[*li] = - cmLocalGenerator::EscapeForCMake(config_uic_opts.c_str()); + cmLocalGenerator::EscapeForCMake(config_uic_opts); if(_uic_opts.empty()) { _uic_opts = config_uic_opts; @@ -768,9 +768,9 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target, } makefile->AddDefinition("_qt_uic_options_files", - cmLocalGenerator::EscapeForCMake(uiFileFiles.c_str()).c_str()); + cmLocalGenerator::EscapeForCMake(uiFileFiles).c_str()); makefile->AddDefinition("_qt_uic_options_options", - cmLocalGenerator::EscapeForCMake(uiFileOptions.c_str()).c_str()); + cmLocalGenerator::EscapeForCMake(uiFileOptions).c_str()); std::string targetName = target->GetName(); if (strcmp(qtVersion, "5") == 0) @@ -914,12 +914,12 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target) } makefile->AddDefinition("_rcc_files", - cmLocalGenerator::EscapeForCMake(_rcc_files.c_str()).c_str()); + cmLocalGenerator::EscapeForCMake(_rcc_files).c_str()); makefile->AddDefinition("_qt_rcc_options_files", - cmLocalGenerator::EscapeForCMake(rccFileFiles.c_str()).c_str()); + cmLocalGenerator::EscapeForCMake(rccFileFiles).c_str()); makefile->AddDefinition("_qt_rcc_options_options", - cmLocalGenerator::EscapeForCMake(rccFileOptions.c_str()).c_str()); + cmLocalGenerator::EscapeForCMake(rccFileOptions).c_str()); std::string targetName = target->GetName(); if (strcmp(qtVersion, "5") == 0) @@ -1034,9 +1034,9 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile, compileDefsProp += "_"; compileDefsProp += config; } - const char *compileDefs = makefile->GetDefinition(compileDefsProp.c_str()); + const char *compileDefs = makefile->GetDefinition(compileDefsProp); this->MocCompileDefinitionsStr = compileDefs ? compileDefs - : makefile->GetSafeDefinition(compileDefsPropOrig.c_str()); + : makefile->GetSafeDefinition(compileDefsPropOrig); } { std::string includesPropOrig = "AM_MOC_INCLUDES"; @@ -1046,9 +1046,9 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile, includesProp += "_"; includesProp += config; } - const char *includes = makefile->GetDefinition(includesProp.c_str()); + const char *includes = makefile->GetDefinition(includesProp); this->MocIncludesStr = includes ? includes - : makefile->GetSafeDefinition(includesPropOrig.c_str()); + : makefile->GetSafeDefinition(includesPropOrig); } this->MocOptionsStr = makefile->GetSafeDefinition("AM_MOC_OPTIONS"); this->ProjectBinaryDir = makefile->GetSafeDefinition("AM_CMAKE_BINARY_DIR"); @@ -1066,10 +1066,10 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile, uicOptionsProp += config; } const char *uicTargetOptions - = makefile->GetSafeDefinition(uicOptionsProp.c_str()); + = makefile->GetSafeDefinition(uicOptionsProp); cmSystemTools::ExpandListArgument( uicTargetOptions ? uicTargetOptions - : makefile->GetSafeDefinition(uicOptionsPropOrig.c_str()), + : makefile->GetSafeDefinition(uicOptionsPropOrig), this->UicTargetOptions); const char *uicOptionsOptions = makefile->GetSafeDefinition("AM_UIC_OPTIONS_OPTIONS"); @@ -1168,7 +1168,7 @@ cmQtAutoGenerators::WriteOldMocDefinitionsFile( std::ios::out | std::ios::trunc); outfile << "set(AM_OLD_COMPILE_SETTINGS " << cmLocalGenerator::EscapeForCMake( - this->CurrentCompileSettingsStr.c_str()) << ")\n"; + this->CurrentCompileSettingsStr) << ")\n"; outfile.close(); } diff --git a/Source/cmScriptGenerator.cxx b/Source/cmScriptGenerator.cxx index 7685d40..e44b236 100644 --- a/Source/cmScriptGenerator.cxx +++ b/Source/cmScriptGenerator.cxx @@ -99,7 +99,7 @@ cmScriptGenerator::CreateConfigTest(std::vector<std::string> const& configs) { result += sep; sep = "|"; - cmScriptGeneratorEncodeConfig(ci->c_str(), result); + cmScriptGeneratorEncodeConfig(*ci, result); } result += ")$\""; return result; diff --git a/Source/cmSeparateArgumentsCommand.cxx b/Source/cmSeparateArgumentsCommand.cxx index 6f62091..1ee3f29 100644 --- a/Source/cmSeparateArgumentsCommand.cxx +++ b/Source/cmSeparateArgumentsCommand.cxx @@ -53,7 +53,7 @@ bool cmSeparateArgumentsCommand { cmOStringStream e; e << "given unknown argument " << args[i]; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -61,11 +61,11 @@ bool cmSeparateArgumentsCommand if(mode == ModeOld) { // Original space-replacement version of command. - if(const char* def = this->Makefile->GetDefinition(var.c_str())) + if(const char* def = this->Makefile->GetDefinition(var)) { std::string value = def; cmSystemTools::ReplaceString(value, " ", ";"); - this->Makefile->AddDefinition(var.c_str(), value.c_str()); + this->Makefile->AddDefinition(var, value.c_str()); } } else @@ -102,7 +102,7 @@ bool cmSeparateArgumentsCommand value += *si; } } - this->Makefile->AddDefinition(var.c_str(), value.c_str()); + this->Makefile->AddDefinition(var, value.c_str()); } return true; diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx index 36363a1..0ca36eb 100644 --- a/Source/cmSetCommand.cxx +++ b/Source/cmSetCommand.cxx @@ -59,7 +59,7 @@ bool cmSetCommand // SET (VAR) // Removes the definition of VAR. if (args.size() == 1) { - this->Makefile->RemoveDefinition(args[0].c_str()); + this->Makefile->RemoveDefinition(args[0]); return true; } // SET (VAR PARENT_SCOPE) // Removes the definition of VAR diff --git a/Source/cmSetDirectoryPropertiesCommand.cxx b/Source/cmSetDirectoryPropertiesCommand.cxx index 62c9b87..3d4b7a9 100644 --- a/Source/cmSetDirectoryPropertiesCommand.cxx +++ b/Source/cmSetDirectoryPropertiesCommand.cxx @@ -30,7 +30,7 @@ bool cmSetDirectoryPropertiesCommand args.end(), errors); if (!ret) { - this->SetError(errors.c_str()); + this->SetError(errors); } return ret; } @@ -62,7 +62,7 @@ bool cmSetDirectoryPropertiesCommand "Commands and macros cannot be set using SET_CMAKE_PROPERTIES"; return false; } - mf->SetProperty(prop.c_str(), value.c_str()); + mf->SetProperty(prop, value.c_str()); } return true; diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx index 84c7610..5f970f8 100644 --- a/Source/cmSetPropertyCommand.cxx +++ b/Source/cmSetPropertyCommand.cxx @@ -66,7 +66,7 @@ bool cmSetPropertyCommand cmOStringStream e; e << "given invalid scope " << *arg << ". " << "Valid scopes are GLOBAL, DIRECTORY, TARGET, SOURCE, TEST, CACHE."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -114,7 +114,7 @@ bool cmSetPropertyCommand { cmOStringStream e; e << "given invalid argument \"" << *arg << "\"."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -262,7 +262,7 @@ bool cmSetPropertyCommand::HandleTargetMode() cmOStringStream e; e << "could not find TARGET " << *ni << ". Perhaps it has not yet been created."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -301,7 +301,7 @@ bool cmSetPropertyCommand::HandleSourceMode() ni != this->Names.end(); ++ni) { // Get the source file. - if(cmSourceFile* sf = this->Makefile->GetOrCreateSource(ni->c_str())) + if(cmSourceFile* sf = this->Makefile->GetOrCreateSource(*ni)) { if(!this->HandleSource(sf)) { @@ -312,7 +312,7 @@ bool cmSetPropertyCommand::HandleSourceMode() { cmOStringStream e; e << "given SOURCE name that could not be found or created: " << *ni; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -351,7 +351,7 @@ bool cmSetPropertyCommand::HandleTestMode() { next = ni; ++next; - if(cmTest* test = this->Makefile->GetTest(ni->c_str())) + if(cmTest* test = this->Makefile->GetTest(*ni)) { if(this->HandleTest(test)) { @@ -374,7 +374,7 @@ bool cmSetPropertyCommand::HandleTestMode() { e << " " << *ni << "\n"; } - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } return true; @@ -414,7 +414,7 @@ bool cmSetPropertyCommand::HandleCacheMode() cmOStringStream e; e << "given non-boolean value \"" << this->PropertyValue << "\" for CACHE property \"ADVANCED\". "; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -424,7 +424,7 @@ bool cmSetPropertyCommand::HandleCacheMode() { cmOStringStream e; e << "given invalid CACHE entry TYPE \"" << this->PropertyValue << "\""; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } @@ -436,7 +436,7 @@ bool cmSetPropertyCommand::HandleCacheMode() e << "given invalid CACHE property " << this->PropertyName << ". " << "Settable CACHE properties are: " << "ADVANCED, HELPSTRING, STRINGS, TYPE, and VALUE."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } @@ -460,7 +460,7 @@ bool cmSetPropertyCommand::HandleCacheMode() cmOStringStream e; e << "could not find CACHE variable " << *ni << ". Perhaps it has not yet been created."; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } } diff --git a/Source/cmSetSourceFilesPropertiesCommand.cxx b/Source/cmSetSourceFilesPropertiesCommand.cxx index 619dfc5..19c6819 100644 --- a/Source/cmSetSourceFilesPropertiesCommand.cxx +++ b/Source/cmSetSourceFilesPropertiesCommand.cxx @@ -51,7 +51,7 @@ bool cmSetSourceFilesPropertiesCommand args.end(), errors); if (!ret) { - this->SetError(errors.c_str()); + this->SetError(errors); } return ret; } @@ -154,14 +154,14 @@ bool cmSetSourceFilesPropertiesCommand { // get the source file cmSourceFile* sf = - mf->GetOrCreateSource(j->c_str(), generated); + mf->GetOrCreateSource(*j, generated); if(sf) { // now loop through all the props and set them unsigned int k; for (k = 0; k < propertyPairs.size(); k = k + 2) { - sf->SetProperty(propertyPairs[k].c_str(),propertyPairs[k+1].c_str()); + sf->SetProperty(propertyPairs[k],propertyPairs[k+1].c_str()); } } } diff --git a/Source/cmSetTargetPropertiesCommand.cxx b/Source/cmSetTargetPropertiesCommand.cxx index fa5aafe..bf3519c 100644 --- a/Source/cmSetTargetPropertiesCommand.cxx +++ b/Source/cmSetTargetPropertiesCommand.cxx @@ -78,12 +78,12 @@ bool cmSetTargetPropertiesCommand return false; } bool ret = cmSetTargetPropertiesCommand::SetOneTarget - (args[i].c_str(),propertyPairs,this->Makefile); + (args[i],propertyPairs,this->Makefile); if (!ret) { std::string message = "Can not find target to add properties to: "; message += args[i]; - this->SetError(message.c_str()); + this->SetError(message); return false; } } @@ -101,9 +101,9 @@ bool cmSetTargetPropertiesCommand unsigned int k; for (k = 0; k < propertyPairs.size(); k = k + 2) { - target->SetProperty(propertyPairs[k].c_str(), + target->SetProperty(propertyPairs[k], propertyPairs[k+1].c_str()); - target->CheckProperty(propertyPairs[k].c_str(), mf); + target->CheckProperty(propertyPairs[k], mf); } } // if file is not already in the makefile, then add it diff --git a/Source/cmSetTestsPropertiesCommand.cxx b/Source/cmSetTestsPropertiesCommand.cxx index c725d35..b026ff3 100644 --- a/Source/cmSetTestsPropertiesCommand.cxx +++ b/Source/cmSetTestsPropertiesCommand.cxx @@ -76,12 +76,12 @@ bool cmSetTestsPropertiesCommand { std::string errors; bool ret = - cmSetTestsPropertiesCommand::SetOneTest(args[i].c_str(), + cmSetTestsPropertiesCommand::SetOneTest(args[i], propertyPairs, this->Makefile, errors); if (!ret) { - this->SetError(errors.c_str()); + this->SetError(errors); return ret; } } @@ -101,7 +101,7 @@ bool cmSetTestsPropertiesCommand unsigned int k; for (k = 0; k < propertyPairs.size(); k = k + 2) { - test->SetProperty(propertyPairs[k].c_str(), + test->SetProperty(propertyPairs[k], propertyPairs[k+1].c_str()); } } diff --git a/Source/cmSiteNameCommand.cxx b/Source/cmSiteNameCommand.cxx index 2bdd1ad..e61caab 100644 --- a/Source/cmSiteNameCommand.cxx +++ b/Source/cmSiteNameCommand.cxx @@ -31,7 +31,7 @@ bool cmSiteNameCommand paths.push_back("/usr/local/bin"); const char* cacheValue - = this->Makefile->GetDefinition(args[0].c_str()); + = this->Makefile->GetDefinition(args[0]); if(cacheValue) { return true; @@ -85,7 +85,7 @@ bool cmSiteNameCommand } #endif this->Makefile-> - AddCacheDefinition(args[0].c_str(), + AddCacheDefinition(args[0], siteName.c_str(), "Name of the computer/site where compile is being run", cmCacheManager::STRING); diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 0d37205..b9b6251 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -164,14 +164,14 @@ bool cmSourceFile::FindFullPath(std::string* error) } tryPath += this->Location.GetName(); tryPath = cmSystemTools::CollapseFullPath(tryPath.c_str(), *di); - if(this->TryFullPath(tryPath.c_str(), "")) + if(this->TryFullPath(tryPath, "")) { return true; } for(std::vector<std::string>::const_iterator ei = srcExts.begin(); ei != srcExts.end(); ++ei) { - if(this->TryFullPath(tryPath.c_str(), ei->c_str())) + if(this->TryFullPath(tryPath, *ei)) { return true; } @@ -179,7 +179,7 @@ bool cmSourceFile::FindFullPath(std::string* error) for(std::vector<std::string>::const_iterator ei = hdrExts.begin(); ei != hdrExts.end(); ++ei) { - if(this->TryFullPath(tryPath.c_str(), ei->c_str())) + if(this->TryFullPath(tryPath, *ei)) { return true; } diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx index 9cb80f6..365665d 100644 --- a/Source/cmSourceGroupCommand.cxx +++ b/Source/cmSourceGroupCommand.cxx @@ -78,7 +78,7 @@ bool cmSourceGroupCommand else if(doingFiles) { // Convert name to full path and add to the group's list. - std::string src = args[i].c_str(); + std::string src = args[i]; if(!cmSystemTools::FileIsFullPath(src.c_str())) { src = this->Makefile->GetCurrentDirectory(); @@ -86,14 +86,14 @@ bool cmSourceGroupCommand src += args[i]; } src = cmSystemTools::CollapseFullPath(src.c_str()); - sg->AddGroupFile(src.c_str()); + sg->AddGroupFile(src); } else { cmOStringStream err; err << "Unknown argument \"" << args[i].c_str() << "\". " << "Perhaps the FILES keyword is missing.\n"; - this->SetError(err.str().c_str()); + this->SetError(err.str()); return false; } } diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index f9b69e3..7bc7b05 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -103,7 +103,7 @@ bool cmStringCommand } std::string e = "does not recognize sub-command "+subCommand; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -115,15 +115,15 @@ bool cmStringCommand::HandleHashCommand(std::vector<std::string> const& args) { cmOStringStream e; e << args[0] << " requires an output variable and an input string"; - this->SetError(e.str().c_str()); + this->SetError(e.str()); return false; } cmsys::auto_ptr<cmCryptoHash> hash(cmCryptoHash::New(args[0].c_str())); if(hash.get()) { - std::string out = hash->HashString(args[2].c_str()); - this->Makefile->AddDefinition(args[1].c_str(), out.c_str()); + std::string out = hash->HashString(args[2]); + this->Makefile->AddDefinition(args[1], out.c_str()); return true; } return false; @@ -158,7 +158,7 @@ bool cmStringCommand::HandleToUpperLowerCommand( } // Store the output in the provided variable. - this->Makefile->AddDefinition(outvar.c_str(), output.c_str()); + this->Makefile->AddDefinition(outvar, output.c_str()); return true; } @@ -185,12 +185,12 @@ bool cmStringCommand::HandleAsciiCommand(std::vector<std::string> const& args) std::string error = "Character with code "; error += args[cc]; error += " does not exist."; - this->SetError(error.c_str()); + this->SetError(error); return false; } } // Store the output in the provided variable. - this->Makefile->AddDefinition(outvar.c_str(), output.c_str()); + this->Makefile->AddDefinition(outvar, output.c_str()); return true; } @@ -226,7 +226,7 @@ bool cmStringCommand::HandleConfigureCommand( { cmOStringStream err; err << "Unrecognized argument \"" << args[i] << "\""; - this->SetError(err.str().c_str()); + this->SetError(err.str()); return false; } } @@ -236,7 +236,7 @@ bool cmStringCommand::HandleConfigureCommand( this->Makefile->ConfigureString(args[1], output, atOnly, escapeQuotes); // Store the output in the provided variable. - this->Makefile->AddDefinition(args[2].c_str(), output.c_str()); + this->Makefile->AddDefinition(args[2], output.c_str()); return true; } @@ -282,7 +282,7 @@ bool cmStringCommand::HandleRegexCommand(std::vector<std::string> const& args) } std::string e = "sub-command REGEX does not recognize mode "+mode; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -308,7 +308,7 @@ bool cmStringCommand::RegexMatch(std::vector<std::string> const& args) { std::string e = "sub-command REGEX, mode MATCH failed to compile regex \""+regex+"\"."; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -324,14 +324,14 @@ bool cmStringCommand::RegexMatch(std::vector<std::string> const& args) std::string e = "sub-command REGEX, mode MATCH regex \""+regex+ "\" matched an empty string."; - this->SetError(e.c_str()); + this->SetError(e); return false; } output = input.substr(l, r-l); } // Store the output in the provided variable. - this->Makefile->AddDefinition(outvar.c_str(), output.c_str()); + this->Makefile->AddDefinition(outvar, output.c_str()); return true; } @@ -358,7 +358,7 @@ bool cmStringCommand::RegexMatchAll(std::vector<std::string> const& args) std::string e = "sub-command REGEX, mode MATCHALL failed to compile regex \""+ regex+"\"."; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -374,7 +374,7 @@ bool cmStringCommand::RegexMatchAll(std::vector<std::string> const& args) { std::string e = "sub-command REGEX, mode MATCHALL regex \""+ regex+"\" matched an empty string."; - this->SetError(e.c_str()); + this->SetError(e); return false; } if(output.length() > 0) @@ -386,7 +386,7 @@ bool cmStringCommand::RegexMatchAll(std::vector<std::string> const& args) } // Store the output in the provided variable. - this->Makefile->AddDefinition(outvar.c_str(), output.c_str()); + this->Makefile->AddDefinition(outvar, output.c_str()); return true; } @@ -439,7 +439,7 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args) std::string e = "sub-command REGEX, mode REPLACE: Unknown escape \""; e += replace.substr(r, 2); e += "\" in replace-expression."; - this->SetError(e.c_str()); + this->SetError(e); return false; } r += 2; @@ -462,7 +462,7 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args) std::string e = "sub-command REGEX, mode REPLACE failed to compile regex \""+ regex+"\"."; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -483,7 +483,7 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args) { std::string e = "sub-command REGEX, mode REPLACE regex \""+ regex+"\" matched an empty string."; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -513,7 +513,7 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args) "sub-command REGEX, mode REPLACE: replace expression \""+ replace+"\" contains an out-of-range escape for regex \""+ regex+"\"."; - this->SetError(e.c_str()); + this->SetError(e); return false; } } @@ -527,7 +527,7 @@ bool cmStringCommand::RegexReplace(std::vector<std::string> const& args) output += input.substr(base, input.length()-base); // Store the output in the provided variable. - this->Makefile->AddDefinition(outvar.c_str(), output.c_str()); + this->Makefile->AddDefinition(outvar, output.c_str()); return true; } @@ -616,12 +616,12 @@ bool cmStringCommand::HandleFindCommand(std::vector<std::string> const& { cmOStringStream s; s << pos; - this->Makefile->AddDefinition(outvar.c_str(), s.str().c_str()); + this->Makefile->AddDefinition(outvar, s.str().c_str()); return true; } // the character was not found, but this is not really an error - this->Makefile->AddDefinition(outvar.c_str(), "-1"); + this->Makefile->AddDefinition(outvar, "-1"); return true; } @@ -643,7 +643,7 @@ bool cmStringCommand::HandleCompareCommand(std::vector<std::string> const& std::string e = "sub-command COMPARE, mode "; e += mode; e += " needs at least 5 arguments total to command."; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -669,16 +669,16 @@ bool cmStringCommand::HandleCompareCommand(std::vector<std::string> const& } if(result) { - this->Makefile->AddDefinition(outvar.c_str(), "1"); + this->Makefile->AddDefinition(outvar, "1"); } else { - this->Makefile->AddDefinition(outvar.c_str(), "0"); + this->Makefile->AddDefinition(outvar, "0"); } return true; } std::string e = "sub-command COMPARE does not recognize mode "+mode; - this->SetError(e.c_str()); + this->SetError(e); return false; } @@ -705,7 +705,7 @@ bool cmStringCommand::HandleReplaceCommand(std::vector<std::string> const& cmsys::SystemTools::ReplaceString(input, matchExpression.c_str(), replaceExpression.c_str()); - this->Makefile->AddDefinition(variableName.c_str(), input.c_str()); + this->Makefile->AddDefinition(variableName, input.c_str()); return true; } @@ -731,7 +731,7 @@ bool cmStringCommand::HandleSubstringCommand(std::vector<std::string> const& cmOStringStream ostr; ostr << "begin index: " << begin << " is out of range 0 - " << stringLength; - this->SetError(ostr.str().c_str()); + this->SetError(ostr.str()); return false; } int leftOverLength = intStringLength - begin; @@ -740,11 +740,11 @@ bool cmStringCommand::HandleSubstringCommand(std::vector<std::string> const& cmOStringStream ostr; ostr << "end index: " << end << " is out of range -1 - " << leftOverLength; - this->SetError(ostr.str().c_str()); + this->SetError(ostr.str()); return false; } - this->Makefile->AddDefinition(variableName.c_str(), + this->Makefile->AddDefinition(variableName, stringValue.substr(begin, end).c_str()); return true; } @@ -766,7 +766,7 @@ bool cmStringCommand char buffer[1024]; sprintf(buffer, "%d", static_cast<int>(length)); - this->Makefile->AddDefinition(variableName.c_str(), buffer); + this->Makefile->AddDefinition(variableName, buffer); return true; } @@ -787,7 +787,7 @@ bool cmStringCommand value += args[i]; } - this->Makefile->AddDefinition(variableName.c_str(), value.c_str()); + this->Makefile->AddDefinition(variableName, value.c_str()); return true; } @@ -804,7 +804,7 @@ bool cmStringCommand const std::string& input = args[1]; const std::string& variableName = args[2]; - this->Makefile->AddDefinition(variableName.c_str(), + this->Makefile->AddDefinition(variableName, cmSystemTools::MakeCidentifier(input.c_str()).c_str()); return true; } @@ -853,7 +853,7 @@ bool cmStringCommand::HandleStripCommand( outLength=endPos - startPos + 1; } - this->Makefile->AddDefinition(variableName.c_str(), + this->Makefile->AddDefinition(variableName, stringValue.substr(startPos, outLength).c_str()); return true; } @@ -937,7 +937,7 @@ bool cmStringCommand } result.push_back(0); - this->Makefile->AddDefinition(variableName.c_str(), &*result.begin()); + this->Makefile->AddDefinition(variableName, &*result.begin()); return true; } @@ -977,14 +977,14 @@ bool cmStringCommand { std::string e = " TIMESTAMP sub-command does not recognize option " + args[argsIndex] + "."; - this->SetError(e.c_str()); + this->SetError(e); return false; } } cmTimestamp timestamp; std::string result = timestamp.CurrentTime(formatString, utcFlag); - this->Makefile->AddDefinition(outputVariable.c_str(), result.c_str()); + this->Makefile->AddDefinition(outputVariable, result.c_str()); return true; } diff --git a/Source/cmSubdirCommand.cxx b/Source/cmSubdirCommand.cxx index e497b46..cdde916 100644 --- a/Source/cmSubdirCommand.cxx +++ b/Source/cmSubdirCommand.cxx @@ -47,7 +47,7 @@ bool cmSubdirCommand std::string binPath = std::string(this->Makefile->GetCurrentOutputDirectory()) + "/" + i->c_str(); - this->Makefile->AddSubDirectory(srcPath.c_str(), binPath.c_str(), + this->Makefile->AddSubDirectory(srcPath, binPath, excludeFromAll, preorder, false); } // otherwise it is a full path @@ -57,15 +57,15 @@ bool cmSubdirCommand // element from the source path and use that std::string binPath = std::string(this->Makefile->GetCurrentOutputDirectory()) + - "/" + cmSystemTools::GetFilenameName(i->c_str()); - this->Makefile->AddSubDirectory(i->c_str(), binPath.c_str(), + "/" + cmSystemTools::GetFilenameName(*i); + this->Makefile->AddSubDirectory(*i, binPath, excludeFromAll, preorder, false); } else { std::string error = "Incorrect SUBDIRS command. Directory: "; error += *i + " does not exist."; - this->SetError(error.c_str()); + this->SetError(error); res = false; } } diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 39b53bf..ef1e37b 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -990,7 +990,7 @@ void cmSystemTools::GlobDirs(const std::string& path, if(cmSystemTools::FileIsDirectory(fname.c_str())) { fname += finishPath; - cmSystemTools::GlobDirs(fname.c_str(), files); + cmSystemTools::GlobDirs(fname, files); } } } @@ -2105,7 +2105,7 @@ void cmSystemTools::FindCMakeResources(const char* argv0) // remove symlinks exe = cmSystemTools::GetRealPath(exe.c_str()); exe_dir = - cmSystemTools::GetFilenamePath(exe.c_str()); + cmSystemTools::GetFilenamePath(exe); } else { @@ -2288,7 +2288,7 @@ bool cmSystemTools::GuessLibraryInstallName(std::string const& fullPath, std::vector<std::string> cmds; cmds.push_back("otool"); cmds.push_back("-D"); - cmds.push_back(fullPath.c_str()); + cmds.push_back(fullPath); std::string output; if(!RunSingleCommand(cmds, &output, 0, 0, OUTPUT_NONE)) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 4432244..c785192 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -325,7 +325,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) } std::string property = *p; property += configUpper; - this->SetPropertyDefault(property.c_str(), 0); + this->SetPropertyDefault(property, 0); } // Initialize per-configuration name postfix property from the @@ -338,7 +338,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) { std::string property = cmSystemTools::UpperCase(*ci); property += "_POSTFIX"; - this->SetPropertyDefault(property.c_str(), 0); + this->SetPropertyDefault(property, 0); } } @@ -626,7 +626,7 @@ cmSourceFile* cmTarget::AddSource(const std::string& s) << s << "\" expanded to \"" << src << "\" in target \"" << this->GetName() << "\". This behavior will be removed in a " "future version of CMake."; - this->Makefile->IssueMessage(messageType, e.str().c_str()); + this->Makefile->IssueMessage(messageType, e.str()); if (messageType == cmake::FATAL_ERROR) { return 0; @@ -634,7 +634,7 @@ cmSourceFile* cmTarget::AddSource(const std::string& s) } } - cmSourceFile* sf = this->Makefile->GetOrCreateSource(src.c_str()); + cmSourceFile* sf = this->Makefile->GetOrCreateSource(src); this->AddSourceFile(sf); return sf; } @@ -669,9 +669,9 @@ void cmTarget::MergeLinkLibraries( cmMakefile& mf, for( ; i != libs.end(); ++i ) { // This is equivalent to the target_link_libraries plain signature. - this->AddLinkLibrary( mf, selfname, i->first.c_str(), i->second ); + this->AddLinkLibrary( mf, selfname, i->first, i->second ); this->AppendProperty("INTERFACE_LINK_LIBRARIES", - this->GetDebugGeneratorExpressions(i->first.c_str(), i->second).c_str()); + this->GetDebugGeneratorExpressions(i->first, i->second).c_str()); } this->PrevLinkedLibraries = libs; } @@ -731,12 +731,12 @@ void cmTarget::ClearDependencyInformation( cmMakefile& mf, depname += "_LIB_DEPENDS"; if (this->RecordDependencies) { - mf.AddCacheDefinition(depname.c_str(), "", + mf.AddCacheDefinition(depname, "", "Dependencies for target", cmCacheManager::STATIC); } else { - if (mf.GetDefinition( depname.c_str() )) + if (mf.GetDefinition( depname )) { std::string message = "Target "; message += target; @@ -782,7 +782,7 @@ void cmTarget::GetDirectLinkLibraries(const std::string& config, for (std::set<std::string>::const_iterator it = seenProps.begin(); it != seenProps.end(); ++it) { - if (!this->GetProperty(it->c_str())) + if (!this->GetProperty(*it)) { this->LinkImplicitNullProperties.insert(*it); } @@ -954,7 +954,7 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, std::string targetEntry = target; targetEntry += "_LIB_DEPENDS"; std::string dependencies; - const char* old_val = mf.GetDefinition( targetEntry.c_str() ); + const char* old_val = mf.GetDefinition( targetEntry ); if( old_val ) { dependencies += old_val; @@ -974,7 +974,7 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, dependencies += ";"; dependencies += lib; dependencies += ";"; - mf.AddCacheDefinition( targetEntry.c_str(), dependencies.c_str(), + mf.AddCacheDefinition( targetEntry, dependencies.c_str(), "Dependencies for the target", cmCacheManager::STATIC ); } @@ -1248,7 +1248,7 @@ void cmTarget::GatherDependencies( const cmMakefile& mf, return; } - const char* deps = mf.GetDefinition( (lib.first+"_LIB_DEPENDS").c_str() ); + const char* deps = mf.GetDefinition( lib.first+"_LIB_DEPENDS" ); if( deps && strcmp(deps,"") != 0 ) { // Make sure this library is in the map, even if it has an empty @@ -1340,7 +1340,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) cmOStringStream e; e << "INTERFACE_LIBRARY targets may only have whitelisted properties. " "The property \"" << prop << "\" is not allowed."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } @@ -1348,7 +1348,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) { cmOStringStream e; e << "NAME property is read-only\n"; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } if(prop == "INCLUDE_DIRECTORIES") @@ -1389,7 +1389,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) cmOStringStream e; e << "EXPORT_NAME property can't be set on imported targets (\"" << this->Name << "\")\n"; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } if (prop == "LINK_LIBRARIES") @@ -1415,14 +1415,14 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, cmOStringStream e; e << "INTERFACE_LIBRARY targets may only have whitelisted properties. " "The property \"" << prop << "\" is not allowed."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } if (prop == "NAME") { cmOStringStream e; e << "NAME property is read-only\n"; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } if(prop == "INCLUDE_DIRECTORIES") @@ -1457,7 +1457,7 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, cmOStringStream e; e << "EXPORT_NAME property can't be set on imported targets (\"" << this->Name << "\")\n"; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return; } if (prop == "LINK_LIBRARIES") @@ -1654,7 +1654,7 @@ static void processIncludeDirectories(cmTarget const* tgt, "successfully.\n" "* The installation package was faulty and references files it " "does not provide.\n"; - tgt->GetMakefile()->IssueMessage(messageType, e.str().c_str()); + tgt->GetMakefile()->IssueMessage(messageType, e.str()); return; } @@ -1693,7 +1693,7 @@ static void processIncludeDirectories(cmTarget const* tgt, } if (!noMessage) { - tgt->GetMakefile()->IssueMessage(messageType, e.str().c_str()); + tgt->GetMakefile()->IssueMessage(messageType, e.str()); if (messageType == cmake::FATAL_ERROR) { return; @@ -2154,7 +2154,7 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list, { std::string configPropName = "COMPILE_DEFINITIONS_" + cmSystemTools::UpperCase(config); - const char *configProp = this->GetProperty(configPropName.c_str()); + const char *configProp = this->GetProperty(configPropName); if (configProp) { switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0043)) @@ -2165,7 +2165,7 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list, e << this->Makefile->GetCMakeInstance()->GetPolicies() ->GetPolicyWarning(cmPolicies::CMP0043); this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, - e.str().c_str()); + e.str()); } case cmPolicies::OLD: { @@ -2557,7 +2557,7 @@ const char* cmTarget::GetFeature(const std::string& feature, std::string featureConfig = feature; featureConfig += "_"; featureConfig += cmSystemTools::UpperCase(config); - if(const char* value = this->GetProperty(featureConfig.c_str())) + if(const char* value = this->GetProperty(featureConfig)) { return value; } @@ -2606,7 +2606,7 @@ bool cmTarget::HandleLocationPropertyPolicy() const << this->GetName() << "\". Use the target name directly with " "add_custom_command, or use the generator expression $<TARGET_FILE>, " "as appropriate.\n"; - this->Makefile->IssueMessage(messageType, e.str().c_str()); + this->Makefile->IssueMessage(messageType, e.str()); } return messageType != cmake::FATAL_ERROR; @@ -2622,7 +2622,7 @@ const char *cmTarget::GetProperty(const std::string& prop, cmOStringStream e; e << "INTERFACE_LIBRARY targets may only have whitelisted properties. " "The property \"" << prop << "\" is not allowed."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); return 0; } @@ -3007,7 +3007,7 @@ void cmTarget::ComputeLinkClosure(const std::string& config, LinkClosure& lc, for(std::vector<std::string>::const_iterator li = impl->Languages.begin(); li != impl->Languages.end(); ++li) { - tsl.Consider(li->c_str()); + tsl.Consider(*li); } // Now consider languages that propagate from linked targets. @@ -3015,9 +3015,9 @@ void cmTarget::ComputeLinkClosure(const std::string& config, LinkClosure& lc, sit != languages.end(); ++sit) { std::string propagates = "CMAKE_"+*sit+"_LINKER_PREFERENCE_PROPAGATES"; - if(this->Makefile->IsOn(propagates.c_str())) + if(this->Makefile->IsOn(propagates)) { - tsl.Consider(sit->c_str()); + tsl.Consider(*sit); } } @@ -3096,7 +3096,7 @@ std::string cmTarget::GetPDBName(const std::string& config) const for(std::vector<std::string>::const_iterator i = props.begin(); i != props.end(); ++i) { - if(const char* outName = this->GetProperty(i->c_str())) + if(const char* outName = this->GetProperty(*i)) { base = outName; break; @@ -3117,7 +3117,7 @@ std::string cmTarget::GetCompilePDBName(const std::string& config) const std::string configUpper = cmSystemTools::UpperCase(config); std::string configProp = "COMPILE_PDB_NAME_"; configProp += configUpper; - const char* config_name = this->GetProperty(configProp.c_str()); + const char* config_name = this->GetProperty(configProp); if(config_name && *config_name) { return prefix + config_name + ".pdb"; @@ -3340,7 +3340,7 @@ std::string cmTarget::NormalGetRealName(const std::string& config) const msg += this->GetName(); this->GetMakefile()-> IssueMessage(cmake::INTERNAL_ERROR, - msg.c_str()); + msg); } if(this->GetType() == cmTarget::EXECUTABLE) @@ -3518,7 +3518,7 @@ void cmTarget::GetFullNameInternal(const std::string& config, { std::string configProp = cmSystemTools::UpperCase(config); configProp += "_POSTFIX"; - configPostfix = this->GetProperty(configProp.c_str()); + configPostfix = this->GetProperty(configProp); // Mac application bundles and frameworks have no postfix. if(configPostfix && (this->IsAppBundleOnApple() || this->IsFrameworkOnApple())) @@ -3536,12 +3536,12 @@ void cmTarget::GetFullNameInternal(const std::string& config, if(!targetSuffix && suffixVar && *suffixVar) { std::string langSuff = suffixVar + std::string("_") + ll; - targetSuffix = this->Makefile->GetDefinition(langSuff.c_str()); + targetSuffix = this->Makefile->GetDefinition(langSuff); } if(!targetPrefix && prefixVar && *prefixVar) { std::string langPrefix = prefixVar + std::string("_") + ll; - targetPrefix = this->Makefile->GetDefinition(langPrefix.c_str()); + targetPrefix = this->Makefile->GetDefinition(langPrefix); } } @@ -3621,7 +3621,7 @@ void cmTarget::GetLibraryNames(std::string& name, std::string msg = "GetLibraryNames called on imported target: "; msg += this->GetName(); this->Makefile->IssueMessage(cmake::INTERNAL_ERROR, - msg.c_str()); + msg); return; } @@ -3725,7 +3725,7 @@ void cmTarget::GetExecutableNames(std::string& name, std::string msg = "GetExecutableNames called on imported target: "; msg += this->GetName(); - this->GetMakefile()->IssueMessage(cmake::INTERNAL_ERROR, msg.c_str()); + this->GetMakefile()->IssueMessage(cmake::INTERNAL_ERROR, msg); } // This versioning is supported only for executables and then only @@ -3800,7 +3800,7 @@ void cmTarget::SetPropertyDefault(const std::string& property, std::string var = "CMAKE_"; var += property; - if(const char* value = this->Makefile->GetDefinition(var.c_str())) + if(const char* value = this->Makefile->GetDefinition(var)) { this->SetProperty(property, value); } @@ -3874,7 +3874,7 @@ bool cmTarget::NeedRelinkBeforeInstall(const std::string& config) const std::string flagVar = "CMAKE_SHARED_LIBRARY_RUNTIME_"; flagVar += ll; flagVar += "_FLAG"; - if(!this->Makefile->IsSet(flagVar.c_str())) + if(!this->Makefile->IsSet(flagVar)) { // There is no rpath support on this platform so nothing needs // relinking. @@ -4093,7 +4093,7 @@ bool cmTarget::ComputeOutputDir(const std::string& config, std::string suffix = usesDefaultOutputDir && platforms ? "$(EFFECTIVE_PLATFORM_NAME)" : ""; this->Makefile->GetLocalGenerator()->GetGlobalGenerator()-> - AppendDirectoryForConfig("/", conf, suffix.c_str(), out); + AppendDirectoryForConfig("/", conf, suffix, out); } return usesDefaultOutputDir; @@ -4198,7 +4198,7 @@ std::string cmTarget::GetOutputName(const std::string& config, for(std::vector<std::string>::const_iterator i = props.begin(); i != props.end(); ++i) { - if(const char* outName = this->GetProperty(i->c_str())) + if(const char* outName = this->GetProperty(*i)) { return outName; } @@ -4516,7 +4516,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, PropertyType propContent = getTypedProperty<PropertyType>(tgt, p.c_str(), 0); const bool explicitlySet = tgt->GetProperties() - .find(p.c_str()) + .find(p) != tgt->GetProperties().end(); const bool impliedByUse = tgt->IsNullImpliedByLinkLibraries(p); @@ -4891,7 +4891,7 @@ bool cmTarget::IsChrpathUsed(const std::string& config) const std::string sepVar = "CMAKE_SHARED_LIBRARY_RUNTIME_"; sepVar += ll; sepVar += "_FLAG_SEP"; - const char* sep = this->Makefile->GetDefinition(sepVar.c_str()); + const char* sep = this->Makefile->GetDefinition(sepVar); if(sep && *sep) { // TODO: Add ELF check to ABI detection and get rid of @@ -4980,7 +4980,7 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config, { std::string mapProp = "MAP_IMPORTED_CONFIG_"; mapProp += desired_config; - if(const char* mapValue = this->GetProperty(mapProp.c_str())) + if(const char* mapValue = this->GetProperty(mapProp)) { cmSystemTools::ExpandListArgument(mapValue, mappedConfigs); } @@ -4996,15 +4996,15 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config, !*loc && !*imp && mci != mappedConfigs.end(); ++mci) { // Look for this configuration. - std::string mcUpper = cmSystemTools::UpperCase(mci->c_str()); + std::string mcUpper = cmSystemTools::UpperCase(*mci); std::string locProp = "IMPORTED_LOCATION_"; locProp += mcUpper; - *loc = this->GetProperty(locProp.c_str()); + *loc = this->GetProperty(locProp); if(allowImp) { std::string impProp = "IMPORTED_IMPLIB_"; impProp += mcUpper; - *imp = this->GetProperty(impProp.c_str()); + *imp = this->GetProperty(impProp); } // If it was found, use it for all properties below. @@ -5029,12 +5029,12 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config, { std::string locProp = "IMPORTED_LOCATION"; locProp += suffix; - *loc = this->GetProperty(locProp.c_str()); + *loc = this->GetProperty(locProp); if(allowImp) { std::string impProp = "IMPORTED_IMPLIB"; impProp += suffix; - *imp = this->GetProperty(impProp.c_str()); + *imp = this->GetProperty(impProp); } } @@ -5071,12 +5071,12 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config, suffix += cmSystemTools::UpperCase(*aci); std::string locProp = "IMPORTED_LOCATION"; locProp += suffix; - *loc = this->GetProperty(locProp.c_str()); + *loc = this->GetProperty(locProp); if(allowImp) { std::string impProp = "IMPORTED_IMPLIB"; impProp += suffix; - *imp = this->GetProperty(impProp.c_str()); + *imp = this->GetProperty(impProp); } } } @@ -5112,7 +5112,7 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, // Get the link interface. { std::string linkProp = "INTERFACE_LINK_LIBRARIES"; - const char *propertyLibs = this->GetProperty(linkProp.c_str()); + const char *propertyLibs = this->GetProperty(linkProp); if (this->GetType() != INTERFACE_LIBRARY) { @@ -5120,13 +5120,13 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, { linkProp = "IMPORTED_LINK_INTERFACE_LIBRARIES"; linkProp += suffix; - propertyLibs = this->GetProperty(linkProp.c_str()); + propertyLibs = this->GetProperty(linkProp); } if(!propertyLibs) { linkProp = "IMPORTED_LINK_INTERFACE_LIBRARIES"; - propertyLibs = this->GetProperty(linkProp.c_str()); + propertyLibs = this->GetProperty(linkProp); } } if(propertyLibs) @@ -5139,7 +5139,7 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, linkProp, 0, 0); cmSystemTools::ExpandListArgument(ge.Parse(propertyLibs) ->Evaluate(this->Makefile, - desired_config.c_str(), + desired_config, false, headTarget, this, @@ -5164,7 +5164,7 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, { std::string impProp = "IMPORTED_LOCATION"; impProp += suffix; - if(const char* config_location = this->GetProperty(impProp.c_str())) + if(const char* config_location = this->GetProperty(impProp)) { info.Location = config_location; } @@ -5179,7 +5179,7 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, { std::string soProp = "IMPORTED_SONAME"; soProp += suffix; - if(const char* config_soname = this->GetProperty(soProp.c_str())) + if(const char* config_soname = this->GetProperty(soProp)) { info.SOName = config_soname; } @@ -5194,7 +5194,7 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, { std::string soProp = "IMPORTED_NO_SONAME"; soProp += suffix; - if(const char* config_no_soname = this->GetProperty(soProp.c_str())) + if(const char* config_no_soname = this->GetProperty(soProp)) { info.NoSOName = cmSystemTools::IsOn(config_no_soname); } @@ -5214,7 +5214,7 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, { std::string impProp = "IMPORTED_IMPLIB"; impProp += suffix; - if(const char* config_implib = this->GetProperty(impProp.c_str())) + if(const char* config_implib = this->GetProperty(impProp)) { info.ImportLibrary = config_implib; } @@ -5228,7 +5228,7 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, { std::string linkProp = "IMPORTED_LINK_DEPENDENT_LIBRARIES"; linkProp += suffix; - if(const char* config_libs = this->GetProperty(linkProp.c_str())) + if(const char* config_libs = this->GetProperty(linkProp)) { cmSystemTools::ExpandListArgument(config_libs, info.LinkInterface.SharedDeps); @@ -5245,7 +5245,7 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, { std::string linkProp = "IMPORTED_LINK_INTERFACE_LANGUAGES"; linkProp += suffix; - if(const char* config_libs = this->GetProperty(linkProp.c_str())) + if(const char* config_libs = this->GetProperty(linkProp)) { cmSystemTools::ExpandListArgument(config_libs, info.LinkInterface.Languages); @@ -5263,7 +5263,7 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, { std::string linkProp = "IMPORTED_LINK_INTERFACE_MULTIPLICITY"; linkProp += suffix; - if(const char* config_reps = this->GetProperty(linkProp.c_str())) + if(const char* config_reps = this->GetProperty(linkProp)) { sscanf(config_reps, "%u", &info.LinkInterface.Multiplicity); } @@ -5380,7 +5380,7 @@ void processILibs(const std::string& config, std::vector<cmTarget*>& tgts, std::set<cmTarget*>& emitted) { if (cmTarget* tgt = headTarget->GetMakefile() - ->FindTargetToUse(name.c_str())) + ->FindTargetToUse(name)) { if (emitted.insert(tgt).second) { @@ -5437,7 +5437,7 @@ void cmTarget::GetTransitivePropertyTargets(const std::string& config, it != iface->Libraries.end(); ++it) { if (cmTarget* tgt = headTarget->GetMakefile() - ->FindTargetToUse(it->c_str())) + ->FindTargetToUse(*it)) { tgts.push_back(tgt); } @@ -5471,7 +5471,7 @@ void cmTarget::GetTransitivePropertyTargets(const std::string& config, it != libs.end(); ++it) { if (cmTarget* tgt = headTarget->GetMakefile() - ->FindTargetToUse(it->c_str())) + ->FindTargetToUse(*it)) { tgts.push_back(tgt); } @@ -5504,7 +5504,7 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config, { // CMP0022 NEW behavior is to use INTERFACE_LINK_LIBRARIES. linkIfaceProp = "INTERFACE_LINK_LIBRARIES"; - explicitLibraries = this->GetProperty(linkIfaceProp.c_str()); + explicitLibraries = this->GetProperty(linkIfaceProp); } else if(this->GetType() == cmTarget::SHARED_LIBRARY || this->IsExecutableWithExports()) @@ -5515,13 +5515,13 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config, // Lookup the per-configuration property. linkIfaceProp = "LINK_INTERFACE_LIBRARIES"; linkIfaceProp += suffix; - explicitLibraries = this->GetProperty(linkIfaceProp.c_str()); + explicitLibraries = this->GetProperty(linkIfaceProp); // If not set, try the generic property. if(!explicitLibraries) { linkIfaceProp = "LINK_INTERFACE_LIBRARIES"; - explicitLibraries = this->GetProperty(linkIfaceProp.c_str()); + explicitLibraries = this->GetProperty(linkIfaceProp); } } @@ -5742,7 +5742,7 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget, // dependencies? std::string propName = "LINK_INTERFACE_MULTIPLICITY"; propName += suffix; - if(const char* config_reps = thisTarget->GetProperty(propName.c_str())) + if(const char* config_reps = thisTarget->GetProperty(propName)) { sscanf(config_reps, "%u", &iface.Multiplicity); } diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index 8dc407b..115a988 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -39,7 +39,7 @@ bool cmTargetLinkLibrariesCommand // Lookup the target for which libraries are specified. this->Target = this->Makefile->GetCMakeInstance() - ->GetGlobalGenerator()->FindTarget(args[0].c_str()); + ->GetGlobalGenerator()->FindTarget(args[0]); if(!this->Target) { cmake::MessageType t = cmake::FATAL_ERROR; // fail by default @@ -124,7 +124,7 @@ bool cmTargetLinkLibrariesCommand ->GetPolicyWarning(cmPolicies::CMP0039) << "\n" "Utility target \"" << this->Target->GetName() << "\" " << modal << " not be used as the target of a target_link_libraries call."; - this->Makefile->IssueMessage(messageType, e.str().c_str()); + this->Makefile->IssueMessage(messageType, e.str()); if(messageType == cmake::FATAL_ERROR) { return false; @@ -289,7 +289,7 @@ bool cmTargetLinkLibrariesCommand std::string linkType = args[0]; linkType += "_LINK_TYPE"; const char* linkTypeString = - this->Makefile->GetDefinition( linkType.c_str() ); + this->Makefile->GetDefinition( linkType ); if(linkTypeString) { if(strcmp(linkTypeString, "debug") == 0) @@ -407,7 +407,7 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, sig == cmTarget::KeywordTLLSignature ? cmTarget::PlainTLLSignature : cmTarget::KeywordTLLSignature); - this->Makefile->IssueMessage(messageType, e.str().c_str()); + this->Makefile->IssueMessage(messageType, e.str()); if(messageType == cmake::FATAL_ERROR) { return false; @@ -479,7 +479,7 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, { prop = "LINK_INTERFACE_LIBRARIES_"; prop += *i; - this->Target->AppendProperty(prop.c_str(), lib.c_str()); + this->Target->AppendProperty(prop, lib.c_str()); } } if(llt == cmTarget::OPTIMIZED || llt == cmTarget::GENERAL) @@ -494,9 +494,9 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const std::string& lib, { prop = "LINK_INTERFACE_LIBRARIES_"; prop += *i; - if(!this->Target->GetProperty(prop.c_str())) + if(!this->Target->GetProperty(prop)) { - this->Target->SetProperty(prop.c_str(), ""); + this->Target->SetProperty(prop, ""); } } } diff --git a/Source/cmTargetPropCommandBase.cxx b/Source/cmTargetPropCommandBase.cxx index 1a1cfa0..d356611 100644 --- a/Source/cmTargetPropCommandBase.cxx +++ b/Source/cmTargetPropCommandBase.cxx @@ -34,7 +34,7 @@ bool cmTargetPropCommandBase } this->Target = this->Makefile->GetCMakeInstance() - ->GetGlobalGenerator()->FindTarget(args[0].c_str()); + ->GetGlobalGenerator()->FindTarget(args[0]); if(!this->Target) { this->Target = this->Makefile->FindTargetToUse(args[0]); @@ -165,15 +165,15 @@ void cmTargetPropCommandBase::HandleInterfaceContent(cmTarget *tgt, if (prepend) { const std::string propName = std::string("INTERFACE_") + this->Property; - const char *propValue = tgt->GetProperty(propName.c_str()); + const char *propValue = tgt->GetProperty(propName); const std::string totalContent = this->Join(content) + (propValue ? std::string(";") + propValue : std::string()); - tgt->SetProperty(propName.c_str(), totalContent.c_str()); + tgt->SetProperty(propName, totalContent.c_str()); } else { - tgt->AppendProperty(("INTERFACE_" + this->Property).c_str(), + tgt->AppendProperty("INTERFACE_" + this->Property, this->Join(content).c_str()); } } diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index a21e1aa..c1b1f8b 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -97,7 +97,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, // Generate the command line with full escapes. cmLocalGenerator* lg = mf->GetLocalGenerator(); - os << lg->EscapeForCMake(exe.c_str()); + os << lg->EscapeForCMake(exe); for(std::vector<std::string>::const_iterator ci = command.begin()+1; ci != command.end(); ++ci) { diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index cfedaa5..cc6e139 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -162,7 +162,7 @@ bool cmTryRunCommand // now put the output into the variables if(this->RunOutputVariable.size()) { - this->Makefile->AddDefinition(this->RunOutputVariable.c_str(), + this->Makefile->AddDefinition(this->RunOutputVariable, runOutputContents.c_str()); } @@ -171,12 +171,12 @@ bool cmTryRunCommand // if the TryCompileCore saved output in this outputVariable then // prepend that output to this output const char* compileOutput - = this->Makefile->GetDefinition(this->OutputVariable.c_str()); + = this->Makefile->GetDefinition(this->OutputVariable); if (compileOutput) { runOutputContents = std::string(compileOutput) + runOutputContents; } - this->Makefile->AddDefinition(this->OutputVariable.c_str(), + this->Makefile->AddDefinition(this->OutputVariable, runOutputContents.c_str()); } } @@ -214,7 +214,7 @@ void cmTryRunCommand::RunExecutable(const std::string& runArgs, { strcpy(retChar, "FAILED_TO_RUN"); } - this->Makefile->AddCacheDefinition(this->RunResultVariable.c_str(), retChar, + this->Makefile->AddCacheDefinition(this->RunResultVariable, retChar, "Result of TRY_RUN", cmCacheManager::INTERNAL); } @@ -235,10 +235,10 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, copyDest += cmake::GetCMakeFilesDirectory(); copyDest += "/"; copyDest += cmSystemTools::GetFilenameWithoutExtension( - this->OutputFile.c_str()); + this->OutputFile); copyDest += "-"; copyDest += this->RunResultVariable; - copyDest += cmSystemTools::GetFilenameExtension(this->OutputFile.c_str()); + copyDest += cmSystemTools::GetFilenameExtension(this->OutputFile); cmSystemTools::CopyFileAlways(this->OutputFile.c_str(), copyDest.c_str()); std::string resultFileName = this->Makefile->GetHomeOutputDirectory(); @@ -250,7 +250,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, std::string internalRunOutputName=this->RunResultVariable+"__TRYRUN_OUTPUT"; bool error = false; - if (this->Makefile->GetDefinition(this->RunResultVariable.c_str()) == 0) + if (this->Makefile->GetDefinition(this->RunResultVariable) == 0) { // if the variables doesn't exist, create it with a helpful error text // and mark it as advanced @@ -258,7 +258,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, comment += "Run result of TRY_RUN(), indicates whether the executable " "would have been able to run on its target platform.\n"; comment += detailsString; - this->Makefile->AddCacheDefinition(this->RunResultVariable.c_str(), + this->Makefile->AddCacheDefinition(this->RunResultVariable, "PLEASE_FILL_OUT-FAILED_TO_RUN", comment.c_str(), cmCacheManager::STRING); @@ -276,7 +276,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, // is the output from the executable used ? if (out!=0) { - if (this->Makefile->GetDefinition(internalRunOutputName.c_str()) == 0) + if (this->Makefile->GetDefinition(internalRunOutputName) == 0) { // if the variables doesn't exist, create it with a helpful error text // and mark it as advanced @@ -285,7 +285,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, "would have printed on stdout and stderr on its target platform.\n"; comment += detailsString; - this->Makefile->AddCacheDefinition(internalRunOutputName.c_str(), + this->Makefile->AddCacheDefinition(internalRunOutputName, "PLEASE_FILL_OUT-NOTFOUND", comment.c_str(), cmCacheManager::STRING); @@ -355,13 +355,13 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, file << comment << "\n\n"; file << "set( " << this->RunResultVariable << " \n \"" - << this->Makefile->GetDefinition(this->RunResultVariable.c_str()) + << this->Makefile->GetDefinition(this->RunResultVariable) << "\"\n CACHE STRING \"Result from TRY_RUN\" FORCE)\n\n"; if (out!=0) { file << "set( " << internalRunOutputName << " \n \"" - << this->Makefile->GetDefinition(internalRunOutputName.c_str()) + << this->Makefile->GetDefinition(internalRunOutputName) << "\"\n CACHE STRING \"Output from TRY_RUN\" FORCE)\n\n"; } file.close(); @@ -383,6 +383,6 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, if (out!=0) { - (*out) = this->Makefile->GetDefinition(internalRunOutputName.c_str()); + (*out) = this->Makefile->GetDefinition(internalRunOutputName); } } diff --git a/Source/cmUseMangledMesaCommand.cxx b/Source/cmUseMangledMesaCommand.cxx index d4ec20f..60796ec 100644 --- a/Source/cmUseMangledMesaCommand.cxx +++ b/Source/cmUseMangledMesaCommand.cxx @@ -38,7 +38,7 @@ bool cmUseMangledMesaCommand std::string e = "Bad path to Mesa, could not find: "; e += glh; e += " "; - this->SetError(e.c_str()); + this->SetError(e); return false; } const char* destDir = args[1].c_str(); diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx index 11e5108..ba6b4ac 100644 --- a/Source/cmUtilitySourceCommand.cxx +++ b/Source/cmUtilitySourceCommand.cxx @@ -29,7 +29,7 @@ bool cmUtilitySourceCommand // The first argument is the cache entry name. std::string cacheEntry = *arg++; const char* cacheValue = - this->Makefile->GetDefinition(cacheEntry.c_str()); + this->Makefile->GetDefinition(cacheEntry); // If it exists already and appears up to date then we are done. If // the string contains "(IntDir)" but that is not the // CMAKE_CFG_INTDIR setting then the value is out of date. @@ -113,14 +113,14 @@ bool cmUtilitySourceCommand cmSystemTools::ReplaceString(utilityExecutable, "/./", "/"); // Enter the value into the cache. - this->Makefile->AddCacheDefinition(cacheEntry.c_str(), + this->Makefile->AddCacheDefinition(cacheEntry, utilityExecutable.c_str(), "Path to an internal program.", cmCacheManager::FILEPATH); // add a value into the cache that maps from the // full path to the name of the project cmSystemTools::ConvertToUnixSlashes(utilityExecutable); - this->Makefile->AddCacheDefinition(utilityExecutable.c_str(), + this->Makefile->AddCacheDefinition(utilityExecutable, utilityName.c_str(), "Executable to project name.", cmCacheManager::INTERNAL); diff --git a/Source/cmVariableRequiresCommand.cxx b/Source/cmVariableRequiresCommand.cxx index ddb4003..80c1286 100644 --- a/Source/cmVariableRequiresCommand.cxx +++ b/Source/cmVariableRequiresCommand.cxx @@ -26,7 +26,7 @@ bool cmVariableRequiresCommand } std::string testVariable = args[0]; - if(!this->Makefile->IsOn(testVariable.c_str())) + if(!this->Makefile->IsOn(testVariable)) { return true; } @@ -36,7 +36,7 @@ bool cmVariableRequiresCommand bool hasAdvanced = false; for(unsigned int i = 2; i < args.size(); ++i) { - if(!this->Makefile->IsOn(args[i].c_str())) + if(!this->Makefile->IsOn(args[i])) { requirementsMet = false; notSet += args[i]; @@ -49,13 +49,13 @@ bool cmVariableRequiresCommand } } } - const char* reqVar = this->Makefile->GetDefinition(resultVariable.c_str()); + const char* reqVar = this->Makefile->GetDefinition(resultVariable); // if reqVar is unset, then set it to requirementsMet // if reqVar is set to true, but requirementsMet is false , then // set reqVar to false. if(!reqVar || (!requirementsMet && this->Makefile->IsOn(reqVar))) { - this->Makefile->AddDefinition(resultVariable.c_str(), requirementsMet); + this->Makefile->AddDefinition(resultVariable, requirementsMet); } if(!requirementsMet) diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx index 33e159b..3c1fe46 100644 --- a/Source/cmVariableWatchCommand.cxx +++ b/Source/cmVariableWatchCommand.cxx @@ -137,7 +137,7 @@ bool cmVariableWatchCommand { cmOStringStream ostr; ostr << "cannot be set on the variable: " << variable.c_str(); - this->SetError(ostr.str().c_str()); + this->SetError(ostr.str()); return false; } diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx index aa6b9f8..af955ec 100644 --- a/Source/cmWriteFileCommand.cxx +++ b/Source/cmWriteFileCommand.cxx @@ -47,7 +47,7 @@ bool cmWriteFileCommand { std::string e = "attempted to write a file: " + fileName + " into a source directory."; - this->SetError(e.c_str()); + this->SetError(e); cmSystemTools::SetFatalErrorOccured(); return false; } @@ -79,7 +79,7 @@ bool cmWriteFileCommand std::string error = "Internal CMake error when trying to open file: "; error += fileName.c_str(); error += " for writing."; - this->SetError(error.c_str()); + this->SetError(error); return false; } file << message << std::endl; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index d37bd94..ad8e5e6 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -306,7 +306,7 @@ void cmake::RemoveUnscriptableCommands() it != unscriptableCommands.end(); ++it) { - this->RemoveCommand(it->c_str()); + this->RemoveCommand(*it); } } @@ -335,23 +335,23 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args) } std::string var, value; cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED; - if(cmCacheManager::ParseEntry(entry.c_str(), var, value, type)) + if(cmCacheManager::ParseEntry(entry, var, value, type)) { // The value is transformed if it is a filepath for example, so // we can't compare whether the value is already in the cache until // after we call AddCacheEntry. const char *cachedValue = - this->CacheManager->GetCacheValue(var.c_str()); + this->CacheManager->GetCacheValue(var); - this->CacheManager->AddCacheEntry(var.c_str(), value.c_str(), + this->CacheManager->AddCacheEntry(var, value.c_str(), "No help, variable specified on the command line.", type); if(this->WarnUnusedCli) { if (!cachedValue - || strcmp(this->CacheManager->GetCacheValue(var.c_str()), + || strcmp(this->CacheManager->GetCacheValue(var), cachedValue) != 0) { - this->WatchUnusedCli(var.c_str()); + this->WatchUnusedCli(var); } } } @@ -390,7 +390,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args) } } cmsys::RegularExpression regex( - cmsys::Glob::PatternToRegex(entryPattern.c_str(), true, true).c_str()); + cmsys::Glob::PatternToRegex(entryPattern, true, true).c_str()); //go through all cache entries and collect the vars which will be removed std::vector<std::string> entriesToDelete; cmCacheManager::CacheIterator it = @@ -414,7 +414,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args) currentEntry != entriesToDelete.end(); ++currentEntry) { - this->CacheManager->RemoveCacheEntry(currentEntry->c_str()); + this->CacheManager->RemoveCacheEntry(*currentEntry); } } else if(arg.find("-C",0) == 0) @@ -486,13 +486,13 @@ void cmake::ReadListFile(const std::vector<std::string>& args, { cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator()); lg->GetMakefile()->SetHomeOutputDirectory - (cmSystemTools::GetCurrentWorkingDirectory().c_str()); + (cmSystemTools::GetCurrentWorkingDirectory()); lg->GetMakefile()->SetStartOutputDirectory - (cmSystemTools::GetCurrentWorkingDirectory().c_str()); + (cmSystemTools::GetCurrentWorkingDirectory()); lg->GetMakefile()->SetHomeDirectory - (cmSystemTools::GetCurrentWorkingDirectory().c_str()); + (cmSystemTools::GetCurrentWorkingDirectory()); lg->GetMakefile()->SetStartDirectory - (cmSystemTools::GetCurrentWorkingDirectory().c_str()); + (cmSystemTools::GetCurrentWorkingDirectory()); if (this->GetWorkingMode() != NORMAL_MODE) { std::string file(cmSystemTools::CollapseFullPath(path)); @@ -526,13 +526,13 @@ bool cmake::FindPackage(const std::vector<std::string>& args) cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator()); cmMakefile* mf = lg->GetMakefile(); mf->SetHomeOutputDirectory - (cmSystemTools::GetCurrentWorkingDirectory().c_str()); + (cmSystemTools::GetCurrentWorkingDirectory()); mf->SetStartOutputDirectory - (cmSystemTools::GetCurrentWorkingDirectory().c_str()); + (cmSystemTools::GetCurrentWorkingDirectory()); mf->SetHomeDirectory - (cmSystemTools::GetCurrentWorkingDirectory().c_str()); + (cmSystemTools::GetCurrentWorkingDirectory()); mf->SetStartDirectory - (cmSystemTools::GetCurrentWorkingDirectory().c_str()); + (cmSystemTools::GetCurrentWorkingDirectory()); mf->SetArgcArgv(args); @@ -566,7 +566,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args) cmSystemTools::ExpandListArgument(includes, includeDirs); std::string includeFlags = lg->GetIncludeFlags(includeDirs, 0, - language.c_str(), false); + language, false); std::string definitions = mf->GetSafeDefinition("PACKAGE_DEFINITIONS"); printf("%s %s\n", includeFlags.c_str(), definitions.c_str()); @@ -585,7 +585,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args) libIt != libList.end(); ++libIt) { - mf->AddLinkLibraryForTarget(targetName, libIt->c_str(), + mf->AddLinkLibraryForTarget(targetName, *libIt, cmTarget::GENERAL); } @@ -636,7 +636,7 @@ void cmake::SetArgs(const std::vector<std::string>& args, std::string path = arg.substr(2); path = cmSystemTools::CollapseFullPath(path.c_str()); cmSystemTools::ConvertToUnixSlashes(path); - this->SetHomeDirectory(path.c_str()); + this->SetHomeDirectory(path); } else if(arg.find("-S",0) == 0) { @@ -652,7 +652,7 @@ void cmake::SetArgs(const std::vector<std::string>& args, std::string path = arg.substr(2); path = cmSystemTools::CollapseFullPath(path.c_str()); cmSystemTools::ConvertToUnixSlashes(path); - this->SetHomeOutputDirectory(path.c_str()); + this->SetHomeOutputDirectory(path); } else if((i < args.size()-2) && (arg.find("--check-build-system",0) == 0)) { @@ -790,7 +790,7 @@ void cmake::SetArgs(const std::vector<std::string>& args, value = args[i]; } cmGlobalGenerator* gen = - this->CreateGlobalGenerator(value.c_str()); + this->CreateGlobalGenerator(value); if(!gen) { cmSystemTools::Error("Could not create named generator ", @@ -811,13 +811,13 @@ void cmake::SetArgs(const std::vector<std::string>& args, if(!directoriesSet) { this->SetHomeOutputDirectory - (cmSystemTools::GetCurrentWorkingDirectory().c_str()); + (cmSystemTools::GetCurrentWorkingDirectory()); this->SetStartOutputDirectory - (cmSystemTools::GetCurrentWorkingDirectory().c_str()); + (cmSystemTools::GetCurrentWorkingDirectory()); this->SetHomeDirectory - (cmSystemTools::GetCurrentWorkingDirectory().c_str()); + (cmSystemTools::GetCurrentWorkingDirectory()); this->SetStartDirectory - (cmSystemTools::GetCurrentWorkingDirectory().c_str()); + (cmSystemTools::GetCurrentWorkingDirectory()); } this->SetStartDirectory(this->GetHomeDirectory()); @@ -853,15 +853,15 @@ void cmake::SetDirectoriesFromFile(const char* arg) { argIsFile = true; std::string fullPath = cmSystemTools::CollapseFullPath(arg); - std::string name = cmSystemTools::GetFilenameName(fullPath.c_str()); + std::string name = cmSystemTools::GetFilenameName(fullPath); name = cmSystemTools::LowerCase(name); if(name == "cmakecache.txt") { - cachePath = cmSystemTools::GetFilenamePath(fullPath.c_str()); + cachePath = cmSystemTools::GetFilenamePath(fullPath); } else if(name == "cmakelists.txt") { - listPath = cmSystemTools::GetFilenamePath(fullPath.c_str()); + listPath = cmSystemTools::GetFilenamePath(fullPath); } } else @@ -869,12 +869,12 @@ void cmake::SetDirectoriesFromFile(const char* arg) // Specified file or directory does not exist. Try to set things // up to produce a meaningful error message. std::string fullPath = cmSystemTools::CollapseFullPath(arg); - std::string name = cmSystemTools::GetFilenameName(fullPath.c_str()); + std::string name = cmSystemTools::GetFilenameName(fullPath); name = cmSystemTools::LowerCase(name); if(name == "cmakecache.txt" || name == "cmakelists.txt") { argIsFile = true; - listPath = cmSystemTools::GetFilenamePath(fullPath.c_str()); + listPath = cmSystemTools::GetFilenamePath(fullPath); } else { @@ -887,11 +887,11 @@ void cmake::SetDirectoriesFromFile(const char* arg) { cmCacheManager* cachem = this->GetCacheManager(); cmCacheManager::CacheIterator it = cachem->NewIterator(); - if(cachem->LoadCache(cachePath.c_str()) && + if(cachem->LoadCache(cachePath) && it.Find("CMAKE_HOME_DIRECTORY")) { - this->SetHomeOutputDirectory(cachePath.c_str()); - this->SetStartOutputDirectory(cachePath.c_str()); + this->SetHomeOutputDirectory(cachePath); + this->SetStartOutputDirectory(cachePath); this->SetHomeDirectory(it.GetValue()); this->SetStartDirectory(it.GetValue()); return; @@ -901,23 +901,23 @@ void cmake::SetDirectoriesFromFile(const char* arg) // If there is a CMakeLists.txt file, use it as the source tree. if(listPath.length() > 0) { - this->SetHomeDirectory(listPath.c_str()); - this->SetStartDirectory(listPath.c_str()); + this->SetHomeDirectory(listPath); + this->SetStartDirectory(listPath); if(argIsFile) { // Source CMakeLists.txt file given. It was probably dropped // onto the executable in a GUI. Default to an in-source build. - this->SetHomeOutputDirectory(listPath.c_str()); - this->SetStartOutputDirectory(listPath.c_str()); + this->SetHomeOutputDirectory(listPath); + this->SetStartOutputDirectory(listPath); } else { // Source directory given on command line. Use current working // directory as build tree. std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); - this->SetHomeOutputDirectory(cwd.c_str()); - this->SetStartOutputDirectory(cwd.c_str()); + this->SetHomeOutputDirectory(cwd); + this->SetStartOutputDirectory(cwd); } return; } @@ -927,10 +927,10 @@ void cmake::SetDirectoriesFromFile(const char* arg) // current working directory as the build tree. std::string full = cmSystemTools::CollapseFullPath(arg); std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); - this->SetHomeDirectory(full.c_str()); - this->SetStartDirectory(full.c_str()); - this->SetHomeOutputDirectory(cwd.c_str()); - this->SetStartOutputDirectory(cwd.c_str()); + this->SetHomeDirectory(full); + this->SetStartDirectory(full); + this->SetHomeOutputDirectory(cwd); + this->SetStartOutputDirectory(cwd); } // at the end of this CMAKE_ROOT and CMAKE_COMMAND should be added to the @@ -979,8 +979,8 @@ void cmake::AddExtraGenerator(const std::string& name, ++it ) { std::string fullName = cmExternalMakefileProjectGenerator:: - CreateFullGeneratorName(it->c_str(), name); - this->ExtraGenerators[fullName.c_str()] = newFunction; + CreateFullGeneratorName(*it, name); + this->ExtraGenerators[fullName] = newFunction; } delete extraGenerator; } @@ -1230,7 +1230,7 @@ int cmake::HandleDeleteCacheVariables(const std::string& var) i++; save.value = *i; warning << *i << "\n"; - if(ci.Find(save.key.c_str())) + if(ci.Find(save.key)) { save.type = ci.GetType(); save.help = ci.GetProperty("HELPSTRING"); @@ -1246,7 +1246,7 @@ int cmake::HandleDeleteCacheVariables(const std::string& var) for(std::vector<SaveCacheEntry>::iterator i = saved.begin(); i != saved.end(); ++i) { - this->AddCacheEntry(i->key.c_str(), i->value.c_str(), + this->AddCacheEntry(i->key, i->value.c_str(), i->help.c_str(), i->type); } cmSystemTools::Message(warning.str().c_str()); @@ -1328,7 +1328,7 @@ int cmake::ActualConfigure() std::string fullName = cmExternalMakefileProjectGenerator:: CreateFullGeneratorName(genName, extraGenName ? extraGenName : ""); - this->GlobalGenerator = this->CreateGlobalGenerator(fullName.c_str()); + this->GlobalGenerator = this->CreateGlobalGenerator(fullName); } if(this->GlobalGenerator) { @@ -1692,8 +1692,8 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure) { return ret; } - this->SetStartDirectory(oldstartdir.c_str()); - this->SetStartOutputDirectory(oldstartoutputdir.c_str()); + this->SetStartDirectory(oldstartdir); + this->SetStartOutputDirectory(oldstartoutputdir); return ret; } @@ -1854,7 +1854,7 @@ void cmake::GetGeneratorDocumentation(std::vector<cmDocumentationEntry>& v) { cmDocumentationEntry e; cmExternalMakefileProjectGenerator* generator = (i->second)(); - generator->GetDocumentation(e, i->first.c_str()); + generator->GetDocumentation(e, i->first); e.Name = i->first; delete generator; v.push_back(e); @@ -2313,7 +2313,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args) value = args[i]; } cmGlobalGenerator* gen = - this->CreateGlobalGenerator(value.c_str()); + this->CreateGlobalGenerator(value); if(!gen) { cmSystemTools::Error("Could not create named generator ", @@ -2650,7 +2650,7 @@ int cmake::Build(const std::string& dir, cmSystemTools::ConvertToUnixSlashes(cachePath); cmCacheManager* cachem = this->GetCacheManager(); cmCacheManager::CacheIterator it = cachem->NewIterator(); - if(!cachem->LoadCache(cachePath.c_str())) + if(!cachem->LoadCache(cachePath)) { std::cerr << "Error: could not load cache\n"; return 1; @@ -2670,11 +2670,11 @@ int cmake::Build(const std::string& dir, return 1; } projName = it.GetValue(); - return gen->Build("", dir.c_str(), - projName.c_str(), target.c_str(), + return gen->Build("", dir, + projName, target, &output, "", - config.c_str(), clean, false, 0, + config, clean, false, 0, cmSystemTools::OUTPUT_PASSTHROUGH, nativeOptions); } diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 047f09d..ad1f2a5 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -613,16 +613,16 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) startDir = cmSystemTools::CollapseFullPath(startDir.c_str()); homeOutDir = cmSystemTools::CollapseFullPath(homeOutDir.c_str()); startOutDir = cmSystemTools::CollapseFullPath(startOutDir.c_str()); - cm.SetHomeDirectory(homeDir.c_str()); - cm.SetStartDirectory(startDir.c_str()); - cm.SetHomeOutputDirectory(homeOutDir.c_str()); - cm.SetStartOutputDirectory(startOutDir.c_str()); - if(cmGlobalGenerator* ggd = cm.CreateGlobalGenerator(gen.c_str())) + cm.SetHomeDirectory(homeDir); + cm.SetStartDirectory(startDir); + cm.SetHomeOutputDirectory(homeOutDir); + cm.SetStartOutputDirectory(startOutDir); + if(cmGlobalGenerator* ggd = cm.CreateGlobalGenerator(gen)) { cm.SetGlobalGenerator(ggd); cmsys::auto_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator()); - lgd->GetMakefile()->SetStartDirectory(startDir.c_str()); - lgd->GetMakefile()->SetStartOutputDirectory(startOutDir.c_str()); + lgd->GetMakefile()->SetStartDirectory(startDir); + lgd->GetMakefile()->SetStartOutputDirectory(startOutDir); lgd->GetMakefile()->MakeStartDirectoriesCurrent(); // Actually scan dependencies. @@ -667,7 +667,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) { cmQtAutoGenerators autogen; std::string const& config = args[3]; - bool autogenSuccess = autogen.Run(args[2].c_str(), config); + bool autogenSuccess = autogen.Run(args[2], config); return autogenSuccess ? 0 : 1; } #endif diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index b6a2437..32e79e6 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -4918,8 +4918,8 @@ void SystemTools::ClassInitialize() // Strip off one directory level and see if the logical // mapping still works. - pwd_str = SystemTools::GetFilenamePath(pwd_str.c_str()); - cwd_str = SystemTools::GetFilenamePath(cwd_str.c_str()); + pwd_str = SystemTools::GetFilenamePath(pwd_str); + cwd_str = SystemTools::GetFilenamePath(cwd_str); Realpath(pwd_str.c_str(), pwd_path); } |