mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 00:11:07 -06:00
Clean a few string conversions
This commit is contained in:
@@ -829,7 +829,7 @@ int cmCPackGenerator::InstallCMakeProject(
|
||||
* - Because it was already used for component install
|
||||
* in order to put things in subdirs...
|
||||
*/
|
||||
cmSystemTools::PutEnv(std::string("DESTDIR=") + tempInstallDirectory);
|
||||
cmSystemTools::PutEnv("DESTDIR=" + tempInstallDirectory);
|
||||
cmCPackLogger(cmCPackLog::LOG_DEBUG,
|
||||
"- Creating directory: '" << dir << "'" << std::endl);
|
||||
|
||||
|
||||
@@ -1213,7 +1213,7 @@ bool cmSystemTools::UnsetEnv(const char* value)
|
||||
{
|
||||
# if !defined(HAVE_UNSETENV)
|
||||
std::string var = cmStrCat(value, '=');
|
||||
return cmSystemTools::PutEnv(var.c_str());
|
||||
return cmSystemTools::PutEnv(var);
|
||||
# else
|
||||
unsetenv(value);
|
||||
return true;
|
||||
|
||||
@@ -33,7 +33,7 @@ void cmXCodeScheme::WriteXCodeSharedScheme(const std::string& xcProjDir,
|
||||
// Create shared scheme sub-directory tree
|
||||
//
|
||||
std::string xcodeSchemeDir = cmStrCat(xcProjDir, "/xcshareddata/xcschemes");
|
||||
cmSystemTools::MakeDirectory(xcodeSchemeDir.c_str());
|
||||
cmSystemTools::MakeDirectory(xcodeSchemeDir);
|
||||
|
||||
std::string xcodeSchemeFile =
|
||||
cmStrCat(xcodeSchemeDir, '/', this->TargetName, ".xcscheme");
|
||||
|
||||
@@ -1371,7 +1371,7 @@ struct SaveCacheEntry
|
||||
|
||||
int cmake::HandleDeleteCacheVariables(const std::string& var)
|
||||
{
|
||||
std::vector<std::string> argsSplit = cmExpandedList(std::string(var), true);
|
||||
std::vector<std::string> argsSplit = cmExpandedList(var, true);
|
||||
// erase the property to avoid infinite recursion
|
||||
this->State->SetGlobalProperty("__CMAKE_DELETE_CACHE_CHANGE_VARS_", "");
|
||||
if (this->State->GetIsInTryCompile()) {
|
||||
|
||||
@@ -600,8 +600,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args)
|
||||
}
|
||||
cmsys::ifstream fin(args[3].c_str(), std::ios::in | std::ios::binary);
|
||||
if (!fin) {
|
||||
std::cerr << "could not open object list file: " << args[3].c_str()
|
||||
<< "\n";
|
||||
std::cerr << "could not open object list file: " << args[3] << "\n";
|
||||
return 1;
|
||||
}
|
||||
std::vector<std::string> files;
|
||||
@@ -624,13 +623,12 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args)
|
||||
}
|
||||
FILE* fout = cmsys::SystemTools::Fopen(args[2], "w+");
|
||||
if (!fout) {
|
||||
std::cerr << "could not open output .def file: " << args[2].c_str()
|
||||
<< "\n";
|
||||
std::cerr << "could not open output .def file: " << args[2] << "\n";
|
||||
return 1;
|
||||
}
|
||||
bindexplib deffile;
|
||||
if (args.size() >= 5) {
|
||||
auto a = args[4];
|
||||
std::string const& a = args[4];
|
||||
if (cmHasLiteralPrefix(a, "--nm=")) {
|
||||
deffile.SetNmPath(a.substr(5));
|
||||
std::cerr << a.substr(5) << "\n";
|
||||
@@ -638,7 +636,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args)
|
||||
std::cerr << "unknown argument: " << a << "\n";
|
||||
}
|
||||
}
|
||||
for (auto const& file : files) {
|
||||
for (std::string const& file : files) {
|
||||
std::string const& ext = cmSystemTools::GetFilenameLastExtension(file);
|
||||
if (cmSystemTools::LowerCase(ext) == ".def") {
|
||||
if (!deffile.AddDefinitionFile(file.c_str())) {
|
||||
@@ -1020,7 +1018,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args)
|
||||
// Command to create a symbolic link. Fails on platforms not
|
||||
// supporting them.
|
||||
if (args[1] == "create_symlink" && args.size() == 4) {
|
||||
const char* destinationFileName = args[3].c_str();
|
||||
std::string const& destinationFileName = args[3];
|
||||
if ((cmSystemTools::FileExists(destinationFileName) ||
|
||||
cmSystemTools::FileIsSymlink(destinationFileName)) &&
|
||||
!cmSystemTools::RemoveFile(destinationFileName)) {
|
||||
@@ -1377,15 +1375,12 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
// Write registry value
|
||||
if (args[1] == "write_regv" && args.size() > 3) {
|
||||
return cmSystemTools::WriteRegistryValue(args[2].c_str(),
|
||||
args[3].c_str())
|
||||
? 0
|
||||
: 1;
|
||||
return cmSystemTools::WriteRegistryValue(args[2], args[3]) ? 0 : 1;
|
||||
}
|
||||
|
||||
// Delete registry value
|
||||
if (args[1] == "delete_regv" && args.size() > 2) {
|
||||
return cmSystemTools::DeleteRegistryValue(args[2].c_str()) ? 0 : 1;
|
||||
return cmSystemTools::DeleteRegistryValue(args[2]) ? 0 : 1;
|
||||
}
|
||||
|
||||
// Remove file
|
||||
|
||||
Reference in New Issue
Block a user