mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-03 21:00:01 -05:00
Merge topic 'isonoff-cstr'
6f16be6a62 Remove unnecessary c_str() calls
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2346
This commit is contained in:
@@ -327,7 +327,7 @@ int cmCTestBuildHandler::ProcessHandler()
|
||||
|
||||
std::string const& useLaunchers =
|
||||
this->CTest->GetCTestConfiguration("UseLaunchers");
|
||||
this->UseCTestLaunch = cmSystemTools::IsOn(useLaunchers.c_str());
|
||||
this->UseCTestLaunch = cmSystemTools::IsOn(useLaunchers);
|
||||
|
||||
// Create a last build log
|
||||
cmGeneratedFileStream ofs;
|
||||
|
||||
@@ -272,7 +272,7 @@ bool cmCTestGIT::UpdateImpl()
|
||||
|
||||
std::string init_submodules =
|
||||
this->CTest->GetCTestConfiguration("GITInitSubmodules");
|
||||
if (cmSystemTools::IsOn(init_submodules.c_str())) {
|
||||
if (cmSystemTools::IsOn(init_submodules)) {
|
||||
char const* git_submodule_init[] = { git, "submodule", "init", nullptr };
|
||||
ret = this->RunChild(git_submodule_init, &submodule_out, &submodule_err,
|
||||
top_dir.c_str());
|
||||
|
||||
@@ -2126,10 +2126,10 @@ bool cmCTestTestHandler::SetTestsProperties(
|
||||
for (cmCTestTestProperties& rt : this->TestList) {
|
||||
if (t == rt.Name) {
|
||||
if (key == "WILL_FAIL") {
|
||||
rt.WillFail = cmSystemTools::IsOn(val.c_str());
|
||||
rt.WillFail = cmSystemTools::IsOn(val);
|
||||
}
|
||||
if (key == "DISABLED") {
|
||||
rt.Disabled = cmSystemTools::IsOn(val.c_str());
|
||||
rt.Disabled = cmSystemTools::IsOn(val);
|
||||
}
|
||||
if (key == "ATTACHED_FILES") {
|
||||
cmSystemTools::ExpandListArgument(val, rt.AttachedFiles);
|
||||
@@ -2172,7 +2172,7 @@ bool cmCTestTestHandler::SetTestsProperties(
|
||||
cmSystemTools::ExpandListArgument(val, rt.RequiredFiles);
|
||||
}
|
||||
if (key == "RUN_SERIAL") {
|
||||
rt.RunSerial = cmSystemTools::IsOn(val.c_str());
|
||||
rt.RunSerial = cmSystemTools::IsOn(val);
|
||||
}
|
||||
if (key == "FAIL_REGULAR_EXPRESSION") {
|
||||
std::vector<std::string> lval;
|
||||
@@ -2188,7 +2188,7 @@ bool cmCTestTestHandler::SetTestsProperties(
|
||||
}
|
||||
}
|
||||
if (key == "PROCESSOR_AFFINITY") {
|
||||
rt.WantAffinity = cmSystemTools::IsOn(val.c_str());
|
||||
rt.WantAffinity = cmSystemTools::IsOn(val);
|
||||
}
|
||||
if (key == "SKIP_RETURN_CODE") {
|
||||
rt.SkipReturnCode = atoi(val.c_str());
|
||||
|
||||
@@ -146,7 +146,7 @@ bool cmCTestVC::Update()
|
||||
// if update version only is on then do not actually update,
|
||||
// just note the current version and finish
|
||||
if (!cmSystemTools::IsOn(
|
||||
this->CTest->GetCTestConfiguration("UpdateVersionOnly").c_str())) {
|
||||
this->CTest->GetCTestConfiguration("UpdateVersionOnly"))) {
|
||||
result = this->NoteOldRevision() && result;
|
||||
this->Log << "--- Begin Update ---\n";
|
||||
result = this->UpdateImpl() && result;
|
||||
|
||||
@@ -709,7 +709,7 @@ void cmCursesMainForm::FixValue(cmStateEnums::CacheEntryType type,
|
||||
cmSystemTools::ConvertToUnixSlashes(out);
|
||||
}
|
||||
if (type == cmStateEnums::BOOL) {
|
||||
if (cmSystemTools::IsOff(out.c_str())) {
|
||||
if (cmSystemTools::IsOff(out)) {
|
||||
out = "OFF";
|
||||
} else {
|
||||
out = "ON";
|
||||
|
||||
+4
-5
@@ -292,8 +292,7 @@ cmCTest::cmCTest()
|
||||
this->RepeatUntilFail = false;
|
||||
std::string outOnFail;
|
||||
if (cmSystemTools::GetEnv("CTEST_OUTPUT_ON_FAILURE", outOnFail)) {
|
||||
this->OutputTestOutputOnTestFailure =
|
||||
!cmSystemTools::IsOff(outOnFail.c_str());
|
||||
this->OutputTestOutputOnTestFailure = !cmSystemTools::IsOff(outOnFail);
|
||||
}
|
||||
this->InitStreams();
|
||||
|
||||
@@ -747,8 +746,8 @@ bool cmCTest::UpdateCTestConfiguration()
|
||||
}
|
||||
}
|
||||
if (this->ProduceXML) {
|
||||
this->CompressXMLFiles = cmSystemTools::IsOn(
|
||||
this->GetCTestConfiguration("CompressSubmission").c_str());
|
||||
this->CompressXMLFiles =
|
||||
cmSystemTools::IsOn(this->GetCTestConfiguration("CompressSubmission"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1936,7 +1935,7 @@ bool cmCTest::HandleCommandLineArguments(size_t& i,
|
||||
if (this->CheckArgument(arg, "--interactive-debug-mode") &&
|
||||
i < args.size() - 1) {
|
||||
i++;
|
||||
this->InteractiveDebugMode = cmSystemTools::IsOn(args[i].c_str());
|
||||
this->InteractiveDebugMode = cmSystemTools::IsOn(args[i]);
|
||||
}
|
||||
if (this->CheckArgument(arg, "--submit-index") && i < args.size() - 1) {
|
||||
i++;
|
||||
|
||||
@@ -616,7 +616,7 @@ void cmCacheManager::CacheIterator::SetValue(const char* value)
|
||||
|
||||
bool cmCacheManager::CacheIterator::GetValueAsBool() const
|
||||
{
|
||||
return cmSystemTools::IsOn(this->GetEntry().Value.c_str());
|
||||
return cmSystemTools::IsOn(this->GetEntry().Value);
|
||||
}
|
||||
|
||||
std::vector<std::string> cmCacheManager::CacheEntry::GetPropertyList() const
|
||||
|
||||
@@ -784,10 +784,10 @@ bool cmFileCommand::HandleGlobCommand(std::vector<std::string> const& args,
|
||||
if (*i == "LIST_DIRECTORIES") {
|
||||
++i; // skip LIST_DIRECTORIES
|
||||
if (i != args.end()) {
|
||||
if (cmSystemTools::IsOn(i->c_str())) {
|
||||
if (cmSystemTools::IsOn(*i)) {
|
||||
g.SetListDirs(true);
|
||||
g.SetRecurseListDirs(true);
|
||||
} else if (cmSystemTools::IsOff(i->c_str())) {
|
||||
} else if (cmSystemTools::IsOff(*i)) {
|
||||
g.SetListDirs(false);
|
||||
g.SetRecurseListDirs(false);
|
||||
} else {
|
||||
@@ -1756,7 +1756,7 @@ struct cmFileInstaller : public cmFileCopier
|
||||
// Check whether to copy files always or only if they have changed.
|
||||
std::string install_always;
|
||||
if (cmSystemTools::GetEnv("CMAKE_INSTALL_ALWAYS", install_always)) {
|
||||
this->Always = cmSystemTools::IsOn(install_always.c_str());
|
||||
this->Always = cmSystemTools::IsOn(install_always);
|
||||
}
|
||||
// Get the current manifest.
|
||||
this->Manifest =
|
||||
@@ -2747,7 +2747,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
|
||||
} else if (*i == "TLS_VERIFY") {
|
||||
++i;
|
||||
if (i != args.end()) {
|
||||
tls_verify = cmSystemTools::IsOn(i->c_str());
|
||||
tls_verify = cmSystemTools::IsOn(*i);
|
||||
} else {
|
||||
this->SetError("TLS_VERIFY missing bool value.");
|
||||
return false;
|
||||
|
||||
@@ -156,7 +156,7 @@ static const struct BoolNode : public cmGeneratorExpressionNode
|
||||
const GeneratorExpressionContent* /*content*/,
|
||||
cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override
|
||||
{
|
||||
return !cmSystemTools::IsOff(parameters.begin()->c_str()) ? "1" : "0";
|
||||
return !cmSystemTools::IsOff(*parameters.begin()) ? "1" : "0";
|
||||
}
|
||||
} boolNode;
|
||||
|
||||
|
||||
@@ -2556,7 +2556,7 @@ static void processIncludeDirectories(
|
||||
}
|
||||
}
|
||||
|
||||
if (!cmSystemTools::IsOff(entryInclude.c_str())) {
|
||||
if (!cmSystemTools::IsOff(entryInclude)) {
|
||||
cmSystemTools::ConvertToUnixSlashes(entryInclude);
|
||||
}
|
||||
std::string inc = entryInclude;
|
||||
|
||||
@@ -176,7 +176,7 @@ std::string cmGlobalGenerator::SelectMakeProgram(
|
||||
const std::string& inMakeProgram, const std::string& makeDefault) const
|
||||
{
|
||||
std::string makeProgram = inMakeProgram;
|
||||
if (cmSystemTools::IsOff(makeProgram.c_str())) {
|
||||
if (cmSystemTools::IsOff(makeProgram)) {
|
||||
const char* makeProgramCSTR =
|
||||
this->CMakeInstance->GetCacheDefinition("CMAKE_MAKE_PROGRAM");
|
||||
if (cmSystemTools::IsOff(makeProgramCSTR)) {
|
||||
@@ -184,7 +184,7 @@ std::string cmGlobalGenerator::SelectMakeProgram(
|
||||
} else {
|
||||
makeProgram = makeProgramCSTR;
|
||||
}
|
||||
if (cmSystemTools::IsOff(makeProgram.c_str()) && !makeProgram.empty()) {
|
||||
if (cmSystemTools::IsOff(makeProgram) && !makeProgram.empty()) {
|
||||
makeProgram = "CMAKE_MAKE_PROGRAM-NOTFOUND";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -679,7 +679,7 @@ std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
|
||||
std::unique_ptr<cmCompiledGeneratorExpression> cge =
|
||||
ge.Parse(propertyValue);
|
||||
if (cmSystemTools::IsOn(
|
||||
cge->Evaluate(target->GetLocalGenerator(), i).c_str())) {
|
||||
cge->Evaluate(target->GetLocalGenerator(), i))) {
|
||||
activeConfigs.insert(i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ void cmIncludeDirectoryCommand::NormalizeInclude(std::string& inc)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!cmSystemTools::IsOff(inc.c_str())) {
|
||||
if (!cmSystemTools::IsOff(inc)) {
|
||||
cmSystemTools::ConvertToUnixSlashes(inc);
|
||||
|
||||
if (!cmSystemTools::FileIsFullPath(inc)) {
|
||||
|
||||
@@ -102,7 +102,7 @@ bool cmInstalledFile::GetPropertyAsBool(const std::string& prop) const
|
||||
{
|
||||
std::string value;
|
||||
bool isSet = this->GetProperty(prop, value);
|
||||
return isSet && cmSystemTools::IsOn(value.c_str());
|
||||
return isSet && cmSystemTools::IsOn(value);
|
||||
}
|
||||
|
||||
void cmInstalledFile::GetPropertyAsList(const std::string& prop,
|
||||
|
||||
@@ -2024,7 +2024,7 @@ void cmLocalGenerator::AppendIncludeDirectories(
|
||||
|
||||
std::string inc = include;
|
||||
|
||||
if (!cmSystemTools::IsOff(inc.c_str())) {
|
||||
if (!cmSystemTools::IsOff(inc)) {
|
||||
cmSystemTools::ConvertToUnixSlashes(inc);
|
||||
}
|
||||
|
||||
|
||||
@@ -1738,7 +1738,7 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
|
||||
cmSystemTools::ExpandListArgument(nvalue, files);
|
||||
nvalue.clear();
|
||||
for (cc = 0; cc < files.size(); cc++) {
|
||||
if (!cmSystemTools::IsOff(files[cc].c_str())) {
|
||||
if (!cmSystemTools::IsOff(files[cc])) {
|
||||
files[cc] = cmSystemTools::CollapseFullPath(files[cc]);
|
||||
}
|
||||
if (cc > 0) {
|
||||
|
||||
@@ -67,7 +67,7 @@ bool cmOptionCommand::InitialPass(std::vector<std::string> const& args,
|
||||
if (args.size() == 3) {
|
||||
initialValue = args[2];
|
||||
}
|
||||
bool init = cmSystemTools::IsOn(initialValue.c_str());
|
||||
bool init = cmSystemTools::IsOn(initialValue);
|
||||
this->Makefile->AddCacheDefinition(args[0], init ? "ON" : "OFF",
|
||||
args[1].c_str(), cmStateEnums::BOOL);
|
||||
|
||||
|
||||
@@ -205,8 +205,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
|
||||
unsigned long iVerb = 0;
|
||||
if (!cmSystemTools::StringToULong(this->Verbosity.c_str(), &iVerb)) {
|
||||
// Non numeric verbosity
|
||||
this->Verbosity =
|
||||
cmSystemTools::IsOn(this->Verbosity.c_str()) ? "1" : "0";
|
||||
this->Verbosity = cmSystemTools::IsOn(this->Verbosity) ? "1" : "0";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -645,7 +645,7 @@ cmQtAutoGenerator::cmQtAutoGenerator()
|
||||
Logger_.SetVerbosity(static_cast<unsigned int>(iVerbose));
|
||||
} else {
|
||||
// Non numeric verbosity
|
||||
Logger_.SetVerbose(cmSystemTools::IsOn(verbose.c_str()));
|
||||
Logger_.SetVerbose(cmSystemTools::IsOn(verbose));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -653,7 +653,7 @@ cmQtAutoGenerator::cmQtAutoGenerator()
|
||||
std::string colorEnv;
|
||||
cmSystemTools::GetEnv("COLOR", colorEnv);
|
||||
if (!colorEnv.empty()) {
|
||||
Logger_.SetColorOutput(cmSystemTools::IsOn(colorEnv.c_str()));
|
||||
Logger_.SetColorOutput(cmSystemTools::IsOn(colorEnv));
|
||||
} else {
|
||||
Logger_.SetColorOutput(true);
|
||||
}
|
||||
|
||||
@@ -330,8 +330,8 @@ bool cmSetPropertyCommand::HandleTest(cmTest* test)
|
||||
bool cmSetPropertyCommand::HandleCacheMode()
|
||||
{
|
||||
if (this->PropertyName == "ADVANCED") {
|
||||
if (!this->Remove && !cmSystemTools::IsOn(this->PropertyValue.c_str()) &&
|
||||
!cmSystemTools::IsOff(this->PropertyValue.c_str())) {
|
||||
if (!this->Remove && !cmSystemTools::IsOn(this->PropertyValue) &&
|
||||
!cmSystemTools::IsOff(this->PropertyValue)) {
|
||||
std::ostringstream e;
|
||||
e << "given non-boolean value \"" << this->PropertyValue
|
||||
<< "\" for CACHE property \"ADVANCED\". ";
|
||||
|
||||
@@ -87,7 +87,7 @@ bool cmSetSourceFilesPropertiesCommand::RunCommand(
|
||||
propertyPairs.push_back(*j);
|
||||
if (*j == "GENERATED") {
|
||||
++j;
|
||||
if (j != propend && cmSystemTools::IsOn(j->c_str())) {
|
||||
if (j != propend && cmSystemTools::IsOn(*j)) {
|
||||
generated = true;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -50,7 +50,7 @@ bool cmSiteNameCommand::InitialPass(std::vector<std::string> const& args,
|
||||
}
|
||||
#else
|
||||
// try to find the hostname for this computer
|
||||
if (!cmSystemTools::IsOff(hostname_cmd.c_str())) {
|
||||
if (!cmSystemTools::IsOff(hostname_cmd)) {
|
||||
std::string host;
|
||||
cmSystemTools::RunSingleCommand(hostname_cmd.c_str(), &host, nullptr,
|
||||
nullptr, nullptr,
|
||||
|
||||
@@ -1802,7 +1802,7 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(Elem& e1,
|
||||
"EnableDebuggingInformation",
|
||||
"'$(Configuration)|$(Platform)'=='" + this->Configurations[i] +
|
||||
"|" + this->Platform + "'",
|
||||
cmSystemTools::IsOn(enableDebug.c_str()) ? "true" : "false");
|
||||
cmSystemTools::IsOn(enableDebug) ? "true" : "false");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1819,8 +1819,7 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(Elem& e1,
|
||||
"DisableOptimizations",
|
||||
"'$(Configuration)|$(Platform)'=='" + this->Configurations[i] +
|
||||
"|" + this->Platform + "'",
|
||||
(cmSystemTools::IsOn(disableOptimizations.c_str()) ? "true"
|
||||
: "false"));
|
||||
(cmSystemTools::IsOn(disableOptimizations) ? "true" : "false"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -917,8 +917,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
|
||||
if (args.size() >= 9 && args[8].length() >= 8 &&
|
||||
args[8].substr(0, 8) == "--color=") {
|
||||
// Enable or disable color based on the switch value.
|
||||
color = (args[8].size() == 8 ||
|
||||
cmSystemTools::IsOn(args[8].substr(8).c_str()));
|
||||
color =
|
||||
(args[8].size() == 8 || cmSystemTools::IsOn(args[8].substr(8)));
|
||||
}
|
||||
} else {
|
||||
// Support older signature for existing makefiles:
|
||||
@@ -1354,7 +1354,7 @@ int cmcmd::ExecuteEchoColor(std::vector<std::string>& args)
|
||||
// Enable or disable color based on the switch value.
|
||||
std::string value = args[i].substr(9);
|
||||
if (!value.empty()) {
|
||||
enabled = cmSystemTools::IsOn(value.c_str());
|
||||
enabled = cmSystemTools::IsOn(value);
|
||||
}
|
||||
} else if (cmHasLiteralPrefix(args[i], "--progress-dir=")) {
|
||||
progressDir = args[i].substr(15);
|
||||
@@ -1407,7 +1407,7 @@ int cmcmd::ExecuteLinkScript(std::vector<std::string>& args)
|
||||
bool verbose = false;
|
||||
if (args.size() >= 4) {
|
||||
if (args[3].find("--verbose=") == 0) {
|
||||
if (!cmSystemTools::IsOff(args[3].substr(10).c_str())) {
|
||||
if (!cmSystemTools::IsOff(args[3].substr(10))) {
|
||||
verbose = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user