Merge topic 'tidy-readability-redundant-string-cstr'

60dcaaea tidy: Fix readability-redundant-string-cstr issues
This commit is contained in:
Brad King 2016-09-05 09:29:30 -04:00 committed by CMake Topic Stage
commit 750789af42
9 changed files with 60 additions and 67 deletions

View File

@ -330,8 +330,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
if (!cpack_dmg_disable_applications_symlink) { if (!cpack_dmg_disable_applications_symlink) {
std::ostringstream application_link; std::ostringstream application_link;
application_link << staging.str() << "/Applications"; application_link << staging.str() << "/Applications";
cmSystemTools::CreateSymlink("/Applications", cmSystemTools::CreateSymlink("/Applications", application_link.str());
application_link.str().c_str());
} }
// Optionally add a custom volume icon ... // Optionally add a custom volume icon ...
@ -755,7 +754,7 @@ std::string cmCPackDragNDropGenerator::GetComponentInstallDirNameSuffix(
// the current COMPONENT belongs to. // the current COMPONENT belongs to.
std::string groupVar = std::string groupVar =
"CPACK_COMPONENT_" + cmSystemTools::UpperCase(componentName) + "_GROUP"; "CPACK_COMPONENT_" + cmSystemTools::UpperCase(componentName) + "_GROUP";
const char* _groupName = GetOption(groupVar.c_str()); const char* _groupName = GetOption(groupVar);
if (_groupName) { if (_groupName) {
std::string groupName = _groupName; std::string groupName = _groupName;

View File

@ -102,15 +102,14 @@ int cmCPackOSXX11Generator::PackageFiles()
} }
std::string applicationsLinkName = diskImageDirectory + "/Applications"; std::string applicationsLinkName = diskImageDirectory + "/Applications";
cmSystemTools::CreateSymlink("/Applications", applicationsLinkName.c_str()); cmSystemTools::CreateSymlink("/Applications", applicationsLinkName);
if (!this->CopyResourcePlistFile("VolumeIcon.icns", if (!this->CopyResourcePlistFile("VolumeIcon.icns", diskImageDirectory,
diskImageDirectory.c_str(),
".VolumeIcon.icns", true) || ".VolumeIcon.icns", true) ||
!this->CopyResourcePlistFile("DS_Store", diskImageDirectory.c_str(), !this->CopyResourcePlistFile("DS_Store", diskImageDirectory, ".DS_Store",
".DS_Store", true) || true) ||
!this->CopyResourcePlistFile("background.png", !this->CopyResourcePlistFile("background.png",
diskImageBackgroundImageDir.c_str(), diskImageBackgroundImageDir,
"background.png", true) || "background.png", true) ||
!this->CopyResourcePlistFile("RuntimeScript", dir) || !this->CopyResourcePlistFile("RuntimeScript", dir) ||
!this->CopyResourcePlistFile("OSXX11.Info.plist", contDir, !this->CopyResourcePlistFile("OSXX11.Info.plist", contDir,

View File

@ -225,8 +225,7 @@ void cmCPackPKGGenerator::CreateChoice(const cmCPackComponent& component,
dirName += '/'; dirName += '/';
dirName += component.Name; dirName += component.Name;
dirName += this->GetOption("CPACK_PACKAGING_INSTALL_PREFIX"); dirName += this->GetOption("CPACK_PACKAGING_INSTALL_PREFIX");
unsigned long installedSize = unsigned long installedSize = component.GetInstalledSizeInKbytes(dirName);
component.GetInstalledSizeInKbytes(dirName.c_str());
xout.StartElement("pkg-ref"); xout.StartElement("pkg-ref");
xout.Attribute("id", packageId); xout.Attribute("id", packageId);
@ -283,7 +282,7 @@ bool cmCPackPKGGenerator::CopyCreateResourceFile(const std::string& name,
{ {
std::string uname = cmSystemTools::UpperCase(name); std::string uname = cmSystemTools::UpperCase(name);
std::string cpackVar = "CPACK_RESOURCE_FILE_" + uname; std::string cpackVar = "CPACK_RESOURCE_FILE_" + uname;
const char* inFileName = this->GetOption(cpackVar.c_str()); const char* inFileName = this->GetOption(cpackVar);
if (!inFileName) { if (!inFileName) {
cmCPackLogger(cmCPackLog::LOG_ERROR, "CPack option: " cmCPackLogger(cmCPackLog::LOG_ERROR, "CPack option: "
<< cpackVar.c_str() << cpackVar.c_str()
@ -314,7 +313,7 @@ bool cmCPackPKGGenerator::CopyCreateResourceFile(const std::string& name,
// Set this so that distribution.dist gets the right name (without // Set this so that distribution.dist gets the right name (without
// the path). // the path).
this->SetOption(("CPACK_RESOURCE_FILE_" + uname + "_NOPATH").c_str(), this->SetOption("CPACK_RESOURCE_FILE_" + uname + "_NOPATH",
(name + ext).c_str()); (name + ext).c_str());
cmCPackLogger(cmCPackLog::LOG_VERBOSE, cmCPackLogger(cmCPackLog::LOG_VERBOSE,
@ -358,7 +357,7 @@ int cmCPackPKGGenerator::CopyInstallScript(const std::string& resdir,
std::string dst = resdir; std::string dst = resdir;
dst += "/"; dst += "/";
dst += name; dst += name;
cmSystemTools::CopyFileAlways(script.c_str(), dst.c_str()); cmSystemTools::CopyFileAlways(script, dst);
cmSystemTools::SetPermissions(dst.c_str(), 0777); cmSystemTools::SetPermissions(dst.c_str(), 0777);
cmCPackLogger(cmCPackLog::LOG_VERBOSE, cmCPackLogger(cmCPackLog::LOG_VERBOSE,
"copy script : " << script << "\ninto " << dst << std::endl); "copy script : " << script << "\ninto " << dst << std::endl);

View File

@ -118,13 +118,13 @@ int cmCPackPackageMakerGenerator::PackageFiles()
// then copy them into the resource directory and make // then copy them into the resource directory and make
// them executable // them executable
if (preflight) { if (preflight) {
this->CopyInstallScript(resDir.c_str(), preflight, "preflight"); this->CopyInstallScript(resDir, preflight, "preflight");
} }
if (postflight) { if (postflight) {
this->CopyInstallScript(resDir.c_str(), postflight, "postflight"); this->CopyInstallScript(resDir, postflight, "postflight");
} }
if (postupgrade) { if (postupgrade) {
this->CopyInstallScript(resDir.c_str(), postupgrade, "postupgrade"); this->CopyInstallScript(resDir, postupgrade, "postupgrade");
} }
} else if (postflight) { } else if (postflight) {
// create a postflight component to house the script // create a postflight component to house the script
@ -160,7 +160,7 @@ int cmCPackPackageMakerGenerator::PackageFiles()
// copy postflight script into resource directory of .pkg // copy postflight script into resource directory of .pkg
std::string resourceDir = packageFile + "/Contents/Resources"; std::string resourceDir = packageFile + "/Contents/Resources";
this->CopyInstallScript(resourceDir.c_str(), postflight, "postflight"); this->CopyInstallScript(resourceDir, postflight, "postflight");
} }
if (!this->Components.empty()) { if (!this->Components.empty()) {
@ -254,9 +254,9 @@ int cmCPackPackageMakerGenerator::PackageFiles()
this->SetOption("CPACK_MODULE_VERSION_SUFFIX", ""); this->SetOption("CPACK_MODULE_VERSION_SUFFIX", "");
// Copy or create all of the resource files we need. // Copy or create all of the resource files we need.
if (!this->CopyCreateResourceFile("License", resDir.c_str()) || if (!this->CopyCreateResourceFile("License", resDir) ||
!this->CopyCreateResourceFile("ReadMe", resDir.c_str()) || !this->CopyCreateResourceFile("ReadMe", resDir) ||
!this->CopyCreateResourceFile("Welcome", resDir.c_str()) || !this->CopyCreateResourceFile("Welcome", resDir) ||
!this->CopyResourcePlistFile("Info.plist") || !this->CopyResourcePlistFile("Info.plist") ||
!this->CopyResourcePlistFile("Description.plist")) { !this->CopyResourcePlistFile("Description.plist")) {
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem copying the resource files" cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem copying the resource files"
@ -372,7 +372,7 @@ int cmCPackPackageMakerGenerator::InitializeInternal()
} }
// Get path to the real PackageMaker, not a symlink: // Get path to the real PackageMaker, not a symlink:
pkgPath = cmSystemTools::GetRealPath(pkgPath.c_str()); pkgPath = cmSystemTools::GetRealPath(pkgPath);
// Up from there to find the version.plist file in the "Contents" dir: // Up from there to find the version.plist file in the "Contents" dir:
std::string contents_dir; std::string contents_dir;
contents_dir = cmSystemTools::GetFilenamePath(pkgPath); contents_dir = cmSystemTools::GetFilenamePath(pkgPath);

View File

@ -73,9 +73,9 @@ int cmCPackProductBuildGenerator::PackageFiles()
// Copy or create all of the resource files we need. // Copy or create all of the resource files we need.
std::string resDir = packageDirFileName + "/Contents"; std::string resDir = packageDirFileName + "/Contents";
if (!this->CopyCreateResourceFile("License", resDir.c_str()) || if (!this->CopyCreateResourceFile("License", resDir) ||
!this->CopyCreateResourceFile("ReadMe", resDir.c_str()) || !this->CopyCreateResourceFile("ReadMe", resDir) ||
!this->CopyCreateResourceFile("Welcome", resDir.c_str())) { !this->CopyCreateResourceFile("Welcome", resDir)) {
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem copying the resource files" cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem copying the resource files"
<< std::endl); << std::endl);
return 0; return 0;
@ -185,10 +185,10 @@ bool cmCPackProductBuildGenerator::GenerateComponentPackage(
// then copy them into the script directory and make // then copy them into the script directory and make
// them executable // them executable
if (preflight) { if (preflight) {
this->CopyInstallScript(scriptDir.c_str(), preflight, "preinstall"); this->CopyInstallScript(scriptDir, preflight, "preinstall");
} }
if (postflight) { if (postflight) {
this->CopyInstallScript(scriptDir.c_str(), postflight, "postinstall"); this->CopyInstallScript(scriptDir, postflight, "postinstall");
} }
// The command that will be used to run ProductBuild // The command that will be used to run ProductBuild

View File

@ -80,7 +80,7 @@ char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key,
std::string str; std::string str;
if (cmSystemTools::GetEnv(var, str)) { if (cmSystemTools::GetEnv(var, str)) {
if (this->EscapeQuotes) { if (this->EscapeQuotes) {
return this->AddString(cmSystemTools::EscapeQuotes(str.c_str())); return this->AddString(cmSystemTools::EscapeQuotes(str));
} }
return this->AddString(str); return this->AddString(str);
} }

View File

@ -118,7 +118,7 @@ std::string cmFilePathUuid::GetChecksumString(
// Calculate the file ( seed + relative path + name ) checksum // Calculate the file ( seed + relative path + name ) checksum
std::vector<unsigned char> hashBytes = std::vector<unsigned char> hashBytes =
cmCryptoHash::New("SHA256")->ByteHashString( cmCryptoHash::New("SHA256")->ByteHashString(
(sourceRelSeed + sourceRelPath + sourceFilename).c_str()); sourceRelSeed + sourceRelPath + sourceFilename);
checksumBase32 = checksumBase32 =
cmBase32Encoder().encodeString(&hashBytes[0], hashBytes.size(), false); cmBase32Encoder().encodeString(&hashBytes[0], hashBytes.size(), false);

View File

@ -397,7 +397,7 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
std::string listfile = root->GetCurrentSourceDirectory(); std::string listfile = root->GetCurrentSourceDirectory();
listfile += "/"; listfile += "/";
listfile += "CMakeLists.txt"; listfile += "CMakeLists.txt";
allBuildGt->AddSource(listfile.c_str()); allBuildGt->AddSource(listfile);
// Add XCODE depend helper // Add XCODE depend helper
std::string dir = root->GetCurrentBinaryDirectory(); std::string dir = root->GetCurrentBinaryDirectory();
@ -405,9 +405,9 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
if (this->XcodeVersion < 50) { if (this->XcodeVersion < 50) {
makeHelper.push_back("make"); makeHelper.push_back("make");
makeHelper.push_back("-C"); makeHelper.push_back("-C");
makeHelper.push_back(dir.c_str()); makeHelper.push_back(dir);
makeHelper.push_back("-f"); makeHelper.push_back("-f");
makeHelper.push_back(this->CurrentXCodeHackMakefile.c_str()); makeHelper.push_back(this->CurrentXCodeHackMakefile);
makeHelper.push_back(""); // placeholder, see below makeHelper.push_back(""); // placeholder, see below
} }
@ -480,7 +480,7 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
listfile = lg->GetCurrentSourceDirectory(); listfile = lg->GetCurrentSourceDirectory();
listfile += "/"; listfile += "/";
listfile += "CMakeLists.txt"; listfile += "CMakeLists.txt";
target->AddSource(listfile.c_str()); target->AddSource(listfile);
} }
} }
} }
@ -841,7 +841,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeFileReferenceFromPath(
// lastKnownFileType as folder in order for Xcode to be able to // lastKnownFileType as folder in order for Xcode to be able to
// open the contents of the folder. // open the contents of the folder.
// (Xcode 4.6 does not like explicitFileType=folder). // (Xcode 4.6 does not like explicitFileType=folder).
if (cmSystemTools::FileIsDirectory(fullpath.c_str())) { if (cmSystemTools::FileIsDirectory(fullpath)) {
fileType = (ext == "xcassets" ? "folder.assetcatalog" : "folder"); fileType = (ext == "xcassets" ? "folder.assetcatalog" : "folder");
useLastKnownFileType = true; useLastKnownFileType = true;
} else { } else {
@ -856,7 +856,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeFileReferenceFromPath(
// Store the file path relative to the top of the source tree. // Store the file path relative to the top of the source tree.
std::string path = this->RelativeToSource(fullpath.c_str()); std::string path = this->RelativeToSource(fullpath.c_str());
std::string name = cmSystemTools::GetFilenameName(path.c_str()); std::string name = cmSystemTools::GetFilenameName(path);
const char* sourceTree = const char* sourceTree =
(cmSystemTools::FileIsFullPath(path.c_str()) ? "<absolute>" (cmSystemTools::FileIsFullPath(path.c_str()) ? "<absolute>"
: "SOURCE_ROOT"); : "SOURCE_ROOT");
@ -898,8 +898,7 @@ void cmGlobalXCodeGenerator::SetCurrentLocalGenerator(cmLocalGenerator* gen)
this->CurrentMakefile = gen->GetMakefile(); this->CurrentMakefile = gen->GetMakefile();
std::string outdir = cmSystemTools::CollapseFullPath( std::string outdir = cmSystemTools::CollapseFullPath(
this->CurrentLocalGenerator->GetCurrentBinaryDirectory()); this->CurrentLocalGenerator->GetCurrentBinaryDirectory());
cmSystemTools::SplitPath(outdir.c_str(), cmSystemTools::SplitPath(outdir, this->CurrentOutputDirectoryComponents);
this->CurrentOutputDirectoryComponents);
// Select the current set of configuration types. // Select the current set of configuration types.
this->CurrentConfigurationTypes.clear(); this->CurrentConfigurationTypes.clear();
@ -951,7 +950,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets(
std::string targetName = gtgt->GetName(); std::string targetName = gtgt->GetName();
// make sure ALL_BUILD, INSTALL, etc are only done once // make sure ALL_BUILD, INSTALL, etc are only done once
if (this->SpecialTargetEmitted(targetName.c_str())) { if (this->SpecialTargetEmitted(targetName)) {
continue; continue;
} }
@ -1223,7 +1222,7 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmGeneratorTarget* gtgt)
cmGeneratedFileStream fout(fname.c_str()); cmGeneratedFileStream fout(fname.c_str());
fout << "\n"; fout << "\n";
} }
if (cmSourceFile* sf = mf->GetOrCreateSource(fname.c_str())) { if (cmSourceFile* sf = mf->GetOrCreateSource(fname)) {
sf->SetProperty("LANGUAGE", llang.c_str()); sf->SetProperty("LANGUAGE", llang.c_str());
gtgt->AddSource(fname); gtgt->AddSource(fname);
} }
@ -1468,7 +1467,7 @@ void cmGlobalXCodeGenerator::AddCommandsToBuildPhase(
currentConfig != this->CurrentConfigurationTypes.end(); currentConfig != this->CurrentConfigurationTypes.end();
currentConfig++) { currentConfig++) {
this->CreateCustomRulesMakefile(makefile.c_str(), target, commands, this->CreateCustomRulesMakefile(makefile.c_str(), target, commands,
currentConfig->c_str()); *currentConfig);
} }
std::string cdir = this->CurrentLocalGenerator->GetCurrentBinaryDirectory(); std::string cdir = this->CurrentLocalGenerator->GetCurrentBinaryDirectory();
@ -1550,8 +1549,8 @@ void cmGlobalXCodeGenerator::CreateCustomRulesMakefile(
ccg.GetDepends().begin(); ccg.GetDepends().begin();
d != ccg.GetDepends().end(); ++d) { d != ccg.GetDepends().end(); ++d) {
std::string dep; std::string dep;
if (this->CurrentLocalGenerator->GetRealDependency(d->c_str(), if (this->CurrentLocalGenerator->GetRealDependency(*d, configName,
configName, dep)) { dep)) {
makefileStream << "\\\n" makefileStream << "\\\n"
<< this->ConvertToRelativeForMake(dep.c_str()); << this->ConvertToRelativeForMake(dep.c_str());
} }
@ -1662,7 +1661,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
} }
if (!extraLinkOptionsVar.empty()) { if (!extraLinkOptionsVar.empty()) {
this->CurrentLocalGenerator->AddConfigVariableFlags( this->CurrentLocalGenerator->AddConfigVariableFlags(
extraLinkOptions, extraLinkOptionsVar.c_str(), configName); extraLinkOptions, extraLinkOptionsVar, configName);
} }
if (gtgt->GetType() == cmState::OBJECT_LIBRARY || if (gtgt->GetType() == cmState::OBJECT_LIBRARY ||
@ -1678,7 +1677,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
if (!configName.empty()) { if (!configName.empty()) {
std::string linkFlagsVar = "LINK_FLAGS_"; std::string linkFlagsVar = "LINK_FLAGS_";
linkFlagsVar += cmSystemTools::UpperCase(configName); linkFlagsVar += cmSystemTools::UpperCase(configName);
if (const char* linkFlags = gtgt->GetProperty(linkFlagsVar.c_str())) { if (const char* linkFlags = gtgt->GetProperty(linkFlagsVar)) {
this->CurrentLocalGenerator->AppendFlags(extraLinkOptions, linkFlags); this->CurrentLocalGenerator->AppendFlags(extraLinkOptions, linkFlags);
} }
} }
@ -1916,7 +1915,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
configName); configName);
for (std::vector<std::string>::iterator i = includes.begin(); for (std::vector<std::string>::iterator i = includes.begin();
i != includes.end(); ++i) { i != includes.end(); ++i) {
if (this->NameResolvesToFramework(i->c_str())) { if (this->NameResolvesToFramework(*i)) {
std::string frameworkDir = *i; std::string frameworkDir = *i;
frameworkDir += "/../"; frameworkDir += "/../";
frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir); frameworkDir = cmSystemTools::CollapseFullPath(frameworkDir);
@ -2165,7 +2164,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
std::string processed = std::string processed =
ge.Parse(gtgt->GetProperty(*i)) ge.Parse(gtgt->GetProperty(*i))
->Evaluate(this->CurrentLocalGenerator, configName); ->Evaluate(this->CurrentLocalGenerator, configName);
buildSettings->AddAttribute(attribute.c_str(), buildSettings->AddAttribute(attribute,
this->CreateString(processed)); this->CreateString(processed));
} }
} }
@ -2195,7 +2194,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateUtilityTarget(
cmXCodeObject* target = cmXCodeObject* target =
this->CreateObject(cmXCodeObject::PBXAggregateTarget); this->CreateObject(cmXCodeObject::PBXAggregateTarget);
target->SetComment(gtgt->GetName().c_str()); target->SetComment(gtgt->GetName());
cmXCodeObject* buildPhases = this->CreateObject(cmXCodeObject::OBJECT_LIST); cmXCodeObject* buildPhases = this->CreateObject(cmXCodeObject::OBJECT_LIST);
std::vector<cmXCodeObject*> emptyContentVector; std::vector<cmXCodeObject*> emptyContentVector;
this->CreateCustomCommands(buildPhases, 0, 0, 0, emptyContentVector, 0, this->CreateCustomCommands(buildPhases, 0, 0, 0, emptyContentVector, 0,
@ -2233,7 +2232,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateUtilityTarget(
} }
} }
target->SetId(this->GetOrCreateId(gtgt->GetName(), target->GetId()).c_str()); target->SetId(this->GetOrCreateId(gtgt->GetName(), target->GetId()));
return target; return target;
} }
@ -2257,7 +2256,7 @@ std::string cmGlobalXCodeGenerator::AddConfigurations(cmXCodeObject* target,
comment += " \""; comment += " \"";
comment += gtgt->GetName(); comment += gtgt->GetName();
comment += "\""; comment += "\"";
configlist->SetComment(comment.c_str()); configlist->SetComment(comment);
target->AddAttribute("buildConfigurationList", target->AddAttribute("buildConfigurationList",
this->CreateObjectReference(configlist)); this->CreateObjectReference(configlist));
for (unsigned int i = 0; i < configVector.size(); ++i) { for (unsigned int i = 0; i < configVector.size(); ++i) {
@ -2266,9 +2265,9 @@ std::string cmGlobalXCodeGenerator::AddConfigurations(cmXCodeObject* target,
buildConfigurations->AddObject(config); buildConfigurations->AddObject(config);
cmXCodeObject* buildSettings = cmXCodeObject* buildSettings =
this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
this->CreateBuildSettings(gtgt, buildSettings, configVector[i].c_str()); this->CreateBuildSettings(gtgt, buildSettings, configVector[i]);
config->AddAttribute("name", this->CreateString(configVector[i])); config->AddAttribute("name", this->CreateString(configVector[i]));
config->SetComment(configVector[i].c_str()); config->SetComment(configVector[i]);
config->AddAttribute("buildSettings", buildSettings); config->AddAttribute("buildSettings", buildSettings);
} }
if (!configVector.empty()) { if (!configVector.empty()) {
@ -2367,7 +2366,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeTarget(
cmXCodeObject* buildSettings = cmXCodeObject* buildSettings =
this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
defConfig = this->CurrentMakefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); defConfig = this->CurrentMakefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
this->CreateBuildSettings(gtgt, buildSettings, defConfig.c_str()); this->CreateBuildSettings(gtgt, buildSettings, defConfig);
target->AddAttribute("buildSettings", buildSettings); target->AddAttribute("buildSettings", buildSettings);
} }
cmXCodeObject* dependencies = this->CreateObject(cmXCodeObject::OBJECT_LIST); cmXCodeObject* dependencies = this->CreateObject(cmXCodeObject::OBJECT_LIST);
@ -2385,7 +2384,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeTarget(
fullName += gtgt->GetName(); fullName += gtgt->GetName();
fullName += ".a"; fullName += ".a";
} else { } else {
fullName = gtgt->GetFullName(defConfig.c_str()); fullName = gtgt->GetFullName(defConfig);
} }
fileRef->AddAttribute("path", this->CreateString(fullName)); fileRef->AddAttribute("path", this->CreateString(fullName));
if (this->XcodeVersion == 15) { if (this->XcodeVersion == 15) {
@ -2393,7 +2392,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeTarget(
} }
fileRef->AddAttribute("sourceTree", fileRef->AddAttribute("sourceTree",
this->CreateString("BUILT_PRODUCTS_DIR")); this->CreateString("BUILT_PRODUCTS_DIR"));
fileRef->SetComment(gtgt->GetName().c_str()); fileRef->SetComment(gtgt->GetName());
target->AddAttribute("productReference", target->AddAttribute("productReference",
this->CreateObjectReference(fileRef)); this->CreateObjectReference(fileRef));
if (const char* productType = this->GetTargetProductType(gtgt)) { if (const char* productType = this->GetTargetProductType(gtgt)) {
@ -2401,7 +2400,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeTarget(
} }
target->SetTarget(gtgt); target->SetTarget(gtgt);
this->XCodeObjectMap[gtgt] = target; this->XCodeObjectMap[gtgt] = target;
target->SetId(this->GetOrCreateId(gtgt->GetName(), target->GetId()).c_str()); target->SetId(this->GetOrCreateId(gtgt->GetName(), target->GetId()));
return target; return target;
} }
@ -2426,15 +2425,14 @@ std::string cmGlobalXCodeGenerator::GetOrCreateId(const std::string& name,
std::string guidStoreName = name; std::string guidStoreName = name;
guidStoreName += "_GUID_CMAKE"; guidStoreName += "_GUID_CMAKE";
const char* storedGUID = const char* storedGUID =
this->CMakeInstance->GetCacheDefinition(guidStoreName.c_str()); this->CMakeInstance->GetCacheDefinition(guidStoreName);
if (storedGUID) { if (storedGUID) {
return storedGUID; return storedGUID;
} }
this->CMakeInstance->AddCacheEntry(guidStoreName.c_str(), id.c_str(), this->CMakeInstance->AddCacheEntry(
"Stored Xcode object GUID", guidStoreName, id.c_str(), "Stored Xcode object GUID", cmState::INTERNAL);
cmState::INTERNAL);
return id; return id;
} }
@ -2482,7 +2480,7 @@ void cmGlobalXCodeGenerator::AppendOrAddBuildSetting(cmXCodeObject* settings,
std::string oldValue = attr->GetString(); std::string oldValue = attr->GetString();
oldValue += " "; oldValue += " ";
oldValue += value; oldValue += value;
attr->SetString(oldValue.c_str()); attr->SetString(oldValue);
} }
} }
} }
@ -2582,7 +2580,7 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
std::vector<std::string> const& libDeps = cli.GetDepends(); std::vector<std::string> const& libDeps = cli.GetDepends();
for (std::vector<std::string>::const_iterator j = libDeps.begin(); for (std::vector<std::string>::const_iterator j = libDeps.begin();
j != libDeps.end(); ++j) { j != libDeps.end(); ++j) {
target->AddDependLibrary(configName, j->c_str()); target->AddDependLibrary(configName, *j);
} }
} }
@ -2891,8 +2889,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
std::string project_id = "PROJECT_"; std::string project_id = "PROJECT_";
project_id += root->GetProjectName(); project_id += root->GetProjectName();
this->RootObject->SetId( this->RootObject->SetId(
this->GetOrCreateId(project_id.c_str(), this->RootObject->GetId()) this->GetOrCreateId(project_id.c_str(), this->RootObject->GetId()));
.c_str());
group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); group = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
this->RootObject->AddAttribute("mainGroup", this->RootObject->AddAttribute("mainGroup",
@ -2963,7 +2960,7 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects(
comment += " \""; comment += " \"";
comment += this->CurrentProject; comment += this->CurrentProject;
comment += "\""; comment += "\"";
configlist->SetComment(comment.c_str()); configlist->SetComment(comment);
configlist->AddAttribute("defaultConfigurationIsVisible", configlist->AddAttribute("defaultConfigurationIsVisible",
this->CreateString("0")); this->CreateString("0"));
configlist->AddAttribute("defaultConfigurationName", configlist->AddAttribute("defaultConfigurationName",
@ -3373,8 +3370,7 @@ std::string cmGlobalXCodeGenerator::LookupFlags(
std::string varName = varNamePrefix; std::string varName = varNamePrefix;
varName += varNameLang; varName += varNameLang;
varName += varNameSuffix; varName += varNameSuffix;
if (const char* varValue = if (const char* varValue = this->CurrentMakefile->GetDefinition(varName)) {
this->CurrentMakefile->GetDefinition(varName.c_str())) {
if (*varValue) { if (*varValue) {
return varValue; return varValue;
} }

View File

@ -1373,7 +1373,7 @@ void cmLocalGenerator::GetTargetDefines(cmGeneratorTarget const* target,
} }
// Add preprocessor definitions for this target and configuration. // Add preprocessor definitions for this target and configuration.
this->AddCompileDefinitions(defines, target, config, lang.c_str()); this->AddCompileDefinitions(defines, target, config, lang);
} }
std::string cmLocalGenerator::GetTargetFortranFlags( std::string cmLocalGenerator::GetTargetFortranFlags(