mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-05 21:31:08 -06:00
Reduce raw string pointers usage.
* Change some functions to take `std::string` instead of `const char*` in the following classes: `cmMakeFile`, `cmake`, `cmCoreTryCompile`, `cmSystemTools`, `cmState`, `cmLocalGenerator` and a few others. * Greatly reduce using of `const char*` overloads for `cmSystemTools::MakeDirectory` and `cmSystemTools::RelativePath`. * Remove many redundant `c_str()` conversions throughout the code.
This commit is contained in:
@@ -127,7 +127,7 @@ bool cmAddCustomCommandCommand::InitialPass(
|
||||
case doing_output:
|
||||
case doing_outputs:
|
||||
case doing_byproducts:
|
||||
if (!cmSystemTools::FileIsFullPath(copy.c_str())) {
|
||||
if (!cmSystemTools::FileIsFullPath(copy)) {
|
||||
// This is an output to be generated, so it should be
|
||||
// under the build tree. CMake 2.4 placed this under the
|
||||
// source tree. However the only case that this change
|
||||
@@ -154,7 +154,7 @@ bool cmAddCustomCommandCommand::InitialPass(
|
||||
break;
|
||||
}
|
||||
|
||||
if (cmSystemTools::FileIsFullPath(filename.c_str())) {
|
||||
if (cmSystemTools::FileIsFullPath(filename)) {
|
||||
filename = cmSystemTools::CollapseFullPath(filename);
|
||||
}
|
||||
switch (doing) {
|
||||
@@ -355,7 +355,7 @@ bool cmAddCustomCommandCommand::CheckOutputs(
|
||||
for (std::string const& o : outputs) {
|
||||
// Make sure the file will not be generated into the source
|
||||
// directory during an out of source build.
|
||||
if (!this->Makefile->CanIWriteThisFile(o.c_str())) {
|
||||
if (!this->Makefile->CanIWriteThisFile(o)) {
|
||||
std::string e = "attempted to have a file \"" + o +
|
||||
"\" in a source directory as an output of custom command.";
|
||||
this->SetError(e);
|
||||
|
||||
Reference in New Issue
Block a user