diff options
author | Pavel Solodovnikov <hellyeahdominate@gmail.com> | 2018-01-31 15:20:02 (GMT) |
---|---|---|
committer | Pavel Solodovnikov <hellyeahdominate@gmail.com> | 2018-01-31 15:23:03 (GMT) |
commit | 653b894683abe63233cb8679b34ea39d9017e317 (patch) | |
tree | 200e5066b754d8ddfdc7beb86c4db179aa2e69d0 /Source/cmMakefile.h | |
parent | 4499cc8bb65e217e1cb2959452ed391af82e757b (diff) | |
download | CMake-653b894683abe63233cb8679b34ea39d9017e317.zip CMake-653b894683abe63233cb8679b34ea39d9017e317.tar.gz CMake-653b894683abe63233cb8679b34ea39d9017e317.tar.bz2 |
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.
Diffstat (limited to 'Source/cmMakefile.h')
-rw-r--r-- | Source/cmMakefile.h | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 2721277..5a30790 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -166,9 +166,9 @@ public: /** * Add a define flag to the build. */ - void AddDefineFlag(const char* definition); - void RemoveDefineFlag(const char* definition); - void AddCompileOption(const char* option); + void AddDefineFlag(std::string const& definition); + void RemoveDefineFlag(std::string const& definition); + void AddCompileOption(std::string const& option); /** Create a new imported target with the name and type given. */ cmTarget* AddImportedTarget(const std::string& name, @@ -309,13 +309,13 @@ public: bool IgnoreErrorsCMP0061() const; - const char* GetHomeDirectory() const; - const char* GetHomeOutputDirectory() const; + std::string const& GetHomeDirectory() const; + std::string const& GetHomeOutputDirectory() const; /** * Set CMAKE_SCRIPT_MODE_FILE variable when running a -P script. */ - void SetScriptModeFile(const char* scriptfile); + void SetScriptModeFile(std::string const& scriptfile); /** * Set CMAKE_ARGC, CMAKE_ARGV0 ... variables. @@ -473,7 +473,7 @@ public: /** * Make sure CMake can write this file */ - bool CanIWriteThisFile(const char* fileName) const; + bool CanIWriteThisFile(std::string const& fileName) const; #if defined(CMAKE_BUILD_WITH_CMAKE) /** @@ -878,8 +878,9 @@ protected: std::string DefineFlags; // Track the value of the computed DEFINITIONS property. - void AddDefineFlag(const char*, std::string&); - void RemoveDefineFlag(const char*, std::string::size_type, std::string&); + void AddDefineFlag(std::string const& flag, std::string&); + void RemoveDefineFlag(std::string const& flag, std::string::size_type, + std::string&); std::string DefineFlagsOrig; #if defined(CMAKE_BUILD_WITH_CMAKE) |