Source: use std::string in place of const char*

This commit is contained in:
Vitaly Stakhovsky 2020-01-29 12:40:00 -05:00 committed by Brad King
parent feea34e7eb
commit bbc07e4561
25 changed files with 85 additions and 94 deletions

View File

@ -139,7 +139,7 @@ const char* cmCustomCommandGenerator::GetArgv0Location(unsigned int c) const
(target->IsImported() ||
target->GetProperty("CROSSCOMPILING_EMULATOR") ||
!this->LG->GetMakefile()->IsOn("CMAKE_CROSSCOMPILING"))) {
return target->GetLocation(this->Config);
return target->GetLocation(this->Config).c_str();
}
return nullptr;
}

View File

@ -61,9 +61,9 @@ void cmExportFileGenerator::SetExportFile(const char* mainFile)
cmSystemTools::GetFilenameLastExtension(this->MainImportFile);
}
const char* cmExportFileGenerator::GetMainExportFileName() const
const std::string& cmExportFileGenerator::GetMainExportFileName() const
{
return this->MainImportFile.c_str();
return this->MainImportFile;
}
bool cmExportFileGenerator::GenerateImportFile()

View File

@ -46,7 +46,7 @@ public:
/** Set the full path to the export file to generate. */
void SetExportFile(const char* mainFile);
const char* GetMainExportFileName() const;
const std::string& GetMainExportFileName() const;
/** Set the namespace in which to place exported target names. */
void SetNamespace(const std::string& ns) { this->Namespace = ns; }

View File

@ -297,8 +297,7 @@ void cmExtraSublimeTextGenerator::AppendTarget(
fout << "\t{\n\t\t\t\"name\": \"" << lg->GetProjectName() << " - "
<< targetName << "\",\n";
fout << "\t\t\t\"cmd\": ["
<< this->BuildMakeCommand(make, makefileName.c_str(), targetName)
<< "],\n";
<< this->BuildMakeCommand(make, makefileName, targetName) << "],\n";
fout << "\t\t\t\"working_dir\": \"${project_path}\",\n";
fout << "\t\t\t\"file_regex\": \""
"^(..[^:]*)(?::|\\\\()([0-9]+)(?::|\\\\))(?:([0-9]+):)?\\\\s*(.*)"
@ -309,7 +308,8 @@ void cmExtraSublimeTextGenerator::AppendTarget(
// Create the command line for building the given target using the selected
// make
std::string cmExtraSublimeTextGenerator::BuildMakeCommand(
const std::string& make, const char* makefile, const std::string& target)
const std::string& make, const std::string& makefile,
const std::string& target)
{
std::string command = cmStrCat('"', make, '"');
std::string generator = this->GlobalGenerator->GetName();

View File

@ -44,7 +44,8 @@ private:
/** Returns the build command that needs to be executed to build the
* specified target.
*/
std::string BuildMakeCommand(const std::string& make, const char* makefile,
std::string BuildMakeCommand(const std::string& make,
const std::string& makefile,
const std::string& target);
/** Appends the specified target to the generated project file as a Sublime
* Text build system.

View File

@ -54,11 +54,11 @@ const char* cmTargetPropertyComputer::GetSources<cmGeneratorTarget>(
cmGeneratorTarget const* tgt, cmMessenger* /* messenger */,
cmListFileBacktrace const& /* context */)
{
return tgt->GetSourcesProperty();
return tgt->GetSourcesProperty().c_str();
}
template <>
const char*
const std::string&
cmTargetPropertyComputer::ComputeLocationForBuild<cmGeneratorTarget>(
cmGeneratorTarget const* tgt)
{
@ -66,7 +66,8 @@ cmTargetPropertyComputer::ComputeLocationForBuild<cmGeneratorTarget>(
}
template <>
const char* cmTargetPropertyComputer::ComputeLocation<cmGeneratorTarget>(
const std::string&
cmTargetPropertyComputer::ComputeLocation<cmGeneratorTarget>(
cmGeneratorTarget const* tgt, const std::string& config)
{
return tgt->GetLocation(config);
@ -310,7 +311,7 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg)
cmGeneratorTarget::~cmGeneratorTarget() = default;
const char* cmGeneratorTarget::GetSourcesProperty() const
const std::string& cmGeneratorTarget::GetSourcesProperty() const
{
std::vector<std::string> values;
for (auto& se : this->SourceEntries) {
@ -319,7 +320,7 @@ const char* cmGeneratorTarget::GetSourcesProperty() const
static std::string value;
value.clear();
value = cmJoin(values, ";");
return value.c_str();
return value;
}
cmGlobalGenerator* cmGeneratorTarget::GetGlobalGenerator() const
@ -996,7 +997,8 @@ void cmGeneratorTarget::GetXamlSources(std::vector<cmSourceFile const*>& data,
IMPLEMENT_VISIT(SourceKindXaml);
}
const char* cmGeneratorTarget::GetLocation(const std::string& config) const
const std::string& cmGeneratorTarget::GetLocation(
const std::string& config) const
{
static std::string location;
if (this->IsImported()) {
@ -1005,7 +1007,7 @@ const char* cmGeneratorTarget::GetLocation(const std::string& config) const
} else {
location = this->GetFullPath(config, cmStateEnums::RuntimeBinaryArtifact);
}
return location.c_str();
return location;
}
std::vector<cmCustomCommand> const& cmGeneratorTarget::GetPreBuildCommands()
@ -1036,13 +1038,13 @@ bool cmGeneratorTarget::IsImportedGloballyVisible() const
return this->Target->IsImportedGloballyVisible();
}
const char* cmGeneratorTarget::GetLocationForBuild() const
const std::string& cmGeneratorTarget::GetLocationForBuild() const
{
static std::string location;
if (this->IsImported()) {
location = this->Target->ImportedGetFullPath(
"", cmStateEnums::RuntimeBinaryArtifact);
return location.c_str();
return location;
}
// Now handle the deprecated build-time configuration location.
@ -1062,7 +1064,7 @@ const char* cmGeneratorTarget::GetLocationForBuild() const
}
location += "/";
location += this->GetFullName("", cmStateEnums::RuntimeBinaryArtifact);
return location.c_str();
return location;
}
bool cmGeneratorTarget::IsSystemIncludeDirectory(

View File

@ -46,7 +46,7 @@ public:
bool IsImported() const;
bool IsImportedGloballyVisible() const;
const char* GetLocation(const std::string& config) const;
const std::string& GetLocation(const std::string& config) const;
std::vector<cmCustomCommand> const& GetPreBuildCommands() const;
std::vector<cmCustomCommand> const& GetPreLinkCommands() const;
@ -65,7 +65,7 @@ public:
/** Get the location of the target in the build tree with a placeholder
referencing the configuration in the native build system. This
location is suitable for use as the LOCATION target property. */
const char* GetLocationForBuild() const;
const std::string& GetLocationForBuild() const;
cmComputeLinkInformation* GetLinkInformation(
const std::string& config) const;
@ -770,7 +770,7 @@ public:
std::string GetFortranModuleDirectory(std::string const& working_dir) const;
const char* GetSourcesProperty() const;
const std::string& GetSourcesProperty() const;
private:
void AddSourceCommon(const std::string& src, bool before = false);

View File

@ -615,7 +615,7 @@ void cmGlobalVisualStudio10Generator::Generate()
"To avoid this problem CMake must use a full path for this file "
"which then triggers the VS 10 property dialog bug.";
/* clang-format on */
lg->IssueMessage(MessageType::WARNING, e.str().c_str());
lg->IssueMessage(MessageType::WARNING, e.str());
}
}
@ -836,7 +836,7 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf)
// Prepare the work directory.
if (!cmSystemTools::MakeDirectory(wd)) {
std::string e = "Failed to make directory:\n " + wd;
mf->IssueMessage(MessageType::FATAL_ERROR, e.c_str());
mf->IssueMessage(MessageType::FATAL_ERROR, e);
cmSystemTools::SetFatalErrorOccured();
return false;
}
@ -957,7 +957,7 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf)
if (ret != 0) {
e << "Exit code: " << ret << "\n";
}
mf->IssueMessage(MessageType::FATAL_ERROR, e.str().c_str());
mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
cmSystemTools::SetFatalErrorOccured();
return false;
}
@ -1131,8 +1131,7 @@ std::string cmGlobalVisualStudio10Generator::GenerateRuleFile(
// Hide them away under the CMakeFiles directory.
std::string ruleDir = cmStrCat(
this->GetCMakeInstance()->GetHomeOutputDirectory(), "/CMakeFiles/",
cmSystemTools::ComputeStringMD5(
cmSystemTools::GetFilenamePath(output).c_str()));
cmSystemTools::ComputeStringMD5(cmSystemTools::GetFilenamePath(output)));
std::string ruleFile =
cmStrCat(ruleDir, '/', cmSystemTools::GetFilenameName(output), ".rule");
return ruleFile;
@ -1326,7 +1325,7 @@ cmIDEFlagTable const* cmGlobalVisualStudio10Generator::LoadFlagTable(
e << "JSON flag table \"" << filename <<
"\" could not be loaded.\n";
/* clang-format on */
mf->IssueMessage(MessageType::FATAL_ERROR, e.str().c_str());
mf->IssueMessage(MessageType::FATAL_ERROR, e.str());
}
return ret;
}

View File

@ -87,7 +87,7 @@ void cmGlobalVisualStudio71Generator::WriteSolutionConfigurations(
// the libraries it uses are also done here
void cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
const std::string& dspname,
const char* dir,
const std::string& dir,
cmGeneratorTarget const* t)
{
// check to see if this is a fortran build
@ -109,7 +109,7 @@ void cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
std::string guid = this->GetGUID(dspname);
fout << project << dspname << "\", \"" << this->ConvertToSolutionPath(dir)
<< (dir[0] ? "\\" : "") << dspname << ext << "\", \"{" << guid
<< (!dir.empty() ? "\\" : "") << dspname << ext << "\", \"{" << guid
<< "}\"\n";
fout << "\tProjectSection(ProjectDependencies) = postProject\n";
this->WriteProjectDepends(fout, dspname, dir, t);
@ -138,7 +138,7 @@ void cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
// Note, that dependencies from executables to
// the libraries it uses are also done here
void cmGlobalVisualStudio71Generator::WriteProjectDepends(
std::ostream& fout, const std::string&, const char*,
std::ostream& fout, const std::string&, const std::string&,
cmGeneratorTarget const* target)
{
VSDependSet const& depends = this->VSTargetDepends[target];
@ -156,7 +156,7 @@ void cmGlobalVisualStudio71Generator::WriteProjectDepends(
// Write a dsp file into the SLN file, Note, that dependencies from
// executables to the libraries it uses are also done here
void cmGlobalVisualStudio71Generator::WriteExternalProject(
std::ostream& fout, const std::string& name, const char* location,
std::ostream& fout, const std::string& name, const std::string& location,
const char* typeGuid, const std::set<BT<std::string>>& depends)
{
fout << "Project(\"{"

View File

@ -22,9 +22,10 @@ protected:
virtual void WriteSolutionConfigurations(
std::ostream& fout, std::vector<std::string> const& configs);
void WriteProject(std::ostream& fout, const std::string& name,
const char* path, const cmGeneratorTarget* t) override;
const std::string& path,
const cmGeneratorTarget* t) override;
void WriteProjectDepends(std::ostream& fout, const std::string& name,
const char* path,
const std::string& path,
cmGeneratorTarget const* t) override;
void WriteProjectConfigurations(
std::ostream& fout, const std::string& name,
@ -32,7 +33,7 @@ protected:
const std::set<std::string>& configsPartOfDefaultBuild,
const std::string& platformMapping = "") override;
void WriteExternalProject(std::ostream& fout, const std::string& name,
const char* path, const char* typeGuid,
const std::string& path, const char* typeGuid,
const std::set<BT<std::string>>& depends) override;
// Folders are not supported by VS 7.1.

View File

@ -186,7 +186,7 @@ std::string cmGlobalVisualStudio7Generator::FindDevEnvCommand()
}
const char* cmGlobalVisualStudio7Generator::ExternalProjectType(
const char* location)
const std::string& location)
{
std::string extension = cmSystemTools::GetFilenameLastExtension(location);
if (extension == ".vbproj") {
@ -346,8 +346,8 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations(
if (expath) {
std::set<std::string> allConfigurations(configs.begin(), configs.end());
const char* mapping = target->GetProperty("VS_PLATFORM_MAPPING");
this->WriteProjectConfigurations(fout, target->GetName().c_str(),
*target, configs, allConfigurations,
this->WriteProjectConfigurations(fout, target->GetName(), *target,
configs, allConfigurations,
mapping ? mapping : "");
} else {
const std::set<std::string>& configsPartOfDefaultBuild =
@ -380,7 +380,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
std::string project = target->GetName();
std::string location = expath;
this->WriteExternalProject(fout, project.c_str(), location.c_str(),
this->WriteExternalProject(fout, project, location,
target->GetProperty("VS_PROJECT_TYPE"),
target->GetUtilities());
written = true;
@ -389,11 +389,11 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
if (vcprojName) {
cmLocalGenerator* lg = target->GetLocalGenerator();
std::string dir = lg->GetCurrentBinaryDirectory();
dir = root->MaybeConvertToRelativePath(rootBinaryDir, dir.c_str());
dir = root->MaybeConvertToRelativePath(rootBinaryDir, dir);
if (dir == ".") {
dir.clear(); // msbuild cannot handle ".\" prefix
}
this->WriteProject(fout, vcprojName, dir.c_str(), target);
this->WriteProject(fout, vcprojName, dir, target);
written = true;
}
}
@ -483,7 +483,7 @@ void cmGlobalVisualStudio7Generator::WriteFoldersContent(std::ostream& fout)
}
std::string cmGlobalVisualStudio7Generator::ConvertToSolutionPath(
const char* path)
const std::string& path)
{
// Convert to backslashes. Do not use ConvertToOutputPath because
// we will add quoting ourselves, and we know these projects always

View File

@ -110,16 +110,17 @@ protected:
std::string const& GetDevEnvCommand();
virtual std::string FindDevEnvCommand();
static const char* ExternalProjectType(const char* location);
static const char* ExternalProjectType(const std::string& location);
virtual void OutputSLNFile(cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators);
virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators) = 0;
virtual void WriteProject(std::ostream& fout, const std::string& name,
const char* path, const cmGeneratorTarget* t) = 0;
const std::string& path,
const cmGeneratorTarget* t) = 0;
virtual void WriteProjectDepends(std::ostream& fout, const std::string& name,
const char* path,
const std::string& path,
cmGeneratorTarget const* t) = 0;
virtual void WriteProjectConfigurations(
std::ostream& fout, const std::string& name,
@ -141,10 +142,10 @@ protected:
OrderedTargetDependSet const& projectTargets);
virtual void WriteExternalProject(
std::ostream& fout, const std::string& name, const char* path,
std::ostream& fout, const std::string& name, const std::string& path,
const char* typeGuid, const std::set<BT<std::string>>& dependencies) = 0;
std::string ConvertToSolutionPath(const char* path);
std::string ConvertToSolutionPath(const std::string& path);
std::set<std::string> IsPartOfDefaultBuild(
std::vector<std::string> const& configs,

View File

@ -307,7 +307,7 @@ bool cmGlobalVisualStudio8Generator::ComputeTargetDepends()
}
void cmGlobalVisualStudio8Generator::WriteProjectDepends(
std::ostream& fout, const std::string&, const char*,
std::ostream& fout, const std::string&, const std::string&,
cmGeneratorTarget const* gt)
{
TargetDependSet const& unordered = this->GetTargetDirectDepends(gt);

View File

@ -74,7 +74,7 @@ protected:
const std::string& platformMapping = "") override;
bool ComputeTargetDepends() override;
void WriteProjectDepends(std::ostream& fout, const std::string& name,
const char* path,
const std::string& path,
const cmGeneratorTarget* t) override;
bool UseFolderProperty() const override;

View File

@ -308,7 +308,7 @@ void cmGlobalVisualStudioGenerator::CallVisualStudioMacro(
if (!dir.empty()) {
std::string macrosFile = dir + "/CMakeMacros/" CMAKE_VSMACROS_FILENAME;
std::string nextSubkeyName;
if (cmSystemTools::FileExists(macrosFile.c_str()) &&
if (cmSystemTools::FileExists(macrosFile) &&
IsVisualStudioMacrosFileRegistered(
macrosFile, this->GetUserMacrosRegKeyBase(), nextSubkeyName)) {
if (m == MacroReload) {
@ -593,7 +593,7 @@ bool IsVisualStudioMacrosFileRegistered(const std::string& macrosFile,
std::string filepath;
std::string filepathname;
std::string filepathpath;
if (cmSystemTools::FileExists(fullname.c_str())) {
if (cmSystemTools::FileExists(fullname)) {
filename = cmSystemTools::GetFilenameName(fullname);
filepath = cmSystemTools::GetFilenamePath(fullname);
filepathname = cmSystemTools::GetFilenameName(filepath);
@ -917,7 +917,7 @@ void cmGlobalVisualStudioGenerator::AddSymbolExportCommand(
std::string objFile = it;
// replace $(ConfigurationName) in the object names
cmSystemTools::ReplaceString(objFile, this->GetCMakeCFGIntDir(),
configName.c_str());
configName);
if (cmHasLiteralSuffix(objFile, ".obj")) {
fout << objFile << "\n";
}

View File

@ -77,8 +77,8 @@ bool cmIncludeExternalMSProjectCommand(std::vector<std::string> const& args,
if (!customGuid.empty()) {
std::string guidVariable = utility_name + "_GUID_CMAKE";
mf.GetCMakeInstance()->AddCacheEntry(guidVariable.c_str(),
customGuid.c_str(), "Stored GUID",
mf.GetCMakeInstance()->AddCacheEntry(guidVariable, customGuid.c_str(),
"Stored GUID",
cmStateEnums::INTERNAL);
}

View File

@ -2749,11 +2749,11 @@ void cmLocalGenerator::AppendPositionIndependentLinkerFlags(
}
void cmLocalGenerator::AppendCompileOptions(std::string& options,
const char* options_list,
std::string const& options_list,
const char* regex) const
{
// Short-circuit if there are no options.
if (!options_list) {
if (options_list.empty()) {
return;
}
@ -2807,11 +2807,11 @@ void cmLocalGenerator::AppendCompileOptions(
}
void cmLocalGenerator::AppendIncludeDirectories(
std::vector<std::string>& includes, const char* includes_list,
std::vector<std::string>& includes, const std::string& includes_list,
const cmSourceFile& sourceFile) const
{
// Short-circuit if there are no includes.
if (!includes_list) {
if (includes_list.empty()) {
return;
}

View File

@ -166,16 +166,9 @@ public:
/**
* Process a list of include directories
*/
void AppendIncludeDirectories(std::vector<std::string>& includes,
const char* includes_list,
const cmSourceFile& sourceFile) const;
void AppendIncludeDirectories(std::vector<std::string>& includes,
std::string const& includes_list,
const cmSourceFile& sourceFile) const
{
this->AppendIncludeDirectories(includes, includes_list.c_str(),
sourceFile);
}
const cmSourceFile& sourceFile) const;
void AppendIncludeDirectories(std::vector<std::string>& includes,
const std::vector<std::string>& includes_vec,
const cmSourceFile& sourceFile) const;
@ -195,14 +188,9 @@ public:
* Encode a list of compile options for the compiler
* command line.
*/
void AppendCompileOptions(std::string& options, const char* options_list,
const char* regex = nullptr) const;
void AppendCompileOptions(std::string& options,
std::string const& options_list,
const char* regex = nullptr) const
{
this->AppendCompileOptions(options, options_list.c_str(), regex);
}
const char* regex = nullptr) const;
void AppendCompileOptions(std::string& options,
const std::vector<std::string>& options_vec,
const char* regex = nullptr) const;

View File

@ -1972,18 +1972,18 @@ void cmLocalUnixMakefileGenerator3::WriteDivider(std::ostream& os)
}
void cmLocalUnixMakefileGenerator3::WriteCMakeArgument(std::ostream& os,
const char* s)
const std::string& s)
{
// Write the given string to the stream with escaping to get it back
// into CMake through the lexical scanner.
os << "\"";
for (const char* c = s; *c; ++c) {
if (*c == '\\') {
for (char c : s) {
if (c == '\\') {
os << "\\\\";
} else if (*c == '"') {
} else if (c == '"') {
os << "\\\"";
} else {
os << *c;
os << c;
}
}
os << "\"";

View File

@ -77,7 +77,7 @@ public:
void SetBorlandMakeCurlyHack(bool b) { this->BorlandMakeCurlyHack = b; }
// used in writing out Cmake files such as WriteDirectoryInformation
static void WriteCMakeArgument(std::ostream& os, const char* s);
static void WriteCMakeArgument(std::ostream& os, const std::string& s);
/** creates the common disclaimer text at the top of each makefile */
void WriteDisclaimer(std::ostream& os);

View File

@ -128,8 +128,7 @@ void cmLocalVisualStudio10Generator::ReadAndStoreExternalGUID(
std::string guidStoreName = cmStrCat(name, "_GUID_CMAKE");
// save the GUID in the cache
this->GlobalGenerator->GetCMakeInstance()->AddCacheEntry(
guidStoreName.c_str(), parser.GUID.c_str(), "Stored GUID",
cmStateEnums::INTERNAL);
guidStoreName, parser.GUID.c_str(), "Stored GUID", cmStateEnums::INTERNAL);
}
const char* cmLocalVisualStudio10Generator::ReportErrorLabel() const

View File

@ -419,9 +419,9 @@ public:
{
this->ComplainFileRegularExpression = regex;
}
const char* GetComplainRegularExpression() const
const std::string& GetComplainRegularExpression() const
{
return this->ComplainFileRegularExpression.c_str();
return this->ComplainFileRegularExpression;
}
// -- List of targets

View File

@ -39,13 +39,13 @@
#include "cmake.h"
template <>
const char* cmTargetPropertyComputer::ComputeLocationForBuild<cmTarget>(
const std::string& cmTargetPropertyComputer::ComputeLocationForBuild<cmTarget>(
cmTarget const* tgt)
{
static std::string loc;
if (tgt->IsImported()) {
loc = tgt->ImportedGetFullPath("", cmStateEnums::RuntimeBinaryArtifact);
return loc.c_str();
return loc;
}
cmGlobalGenerator* gg = tgt->GetGlobalGenerator();
@ -54,18 +54,18 @@ const char* cmTargetPropertyComputer::ComputeLocationForBuild<cmTarget>(
}
cmGeneratorTarget* gt = gg->FindGeneratorTarget(tgt->GetName());
loc = gt->GetLocationForBuild();
return loc.c_str();
return loc;
}
template <>
const char* cmTargetPropertyComputer::ComputeLocation<cmTarget>(
const std::string& cmTargetPropertyComputer::ComputeLocation<cmTarget>(
cmTarget const* tgt, const std::string& config)
{
static std::string loc;
if (tgt->IsImported()) {
loc =
tgt->ImportedGetFullPath(config, cmStateEnums::RuntimeBinaryArtifact);
return loc.c_str();
return loc;
}
cmGlobalGenerator* gg = tgt->GetGlobalGenerator();
@ -74,7 +74,7 @@ const char* cmTargetPropertyComputer::ComputeLocation<cmTarget>(
}
cmGeneratorTarget* gt = gg->FindGeneratorTarget(tgt->GetName());
loc = gt->GetFullPath(config, cmStateEnums::RuntimeBinaryArtifact);
return loc.c_str();
return loc;
}
template <>

View File

@ -46,10 +46,10 @@ private:
cmListFileBacktrace const& context);
template <typename Target>
static const char* ComputeLocationForBuild(Target const* tgt);
static const std::string& ComputeLocationForBuild(Target const* tgt);
template <typename Target>
static const char* ComputeLocation(Target const* tgt,
std::string const& config);
static const std::string& ComputeLocation(Target const* tgt,
std::string const& config);
template <typename Target>
static const char* GetLocation(Target const* tgt, std::string const& prop,
@ -71,7 +71,7 @@ private:
context)) {
return nullptr;
}
return ComputeLocationForBuild(tgt);
return ComputeLocationForBuild(tgt).c_str();
}
// Support "LOCATION_<CONFIG>".
@ -82,7 +82,7 @@ private:
return nullptr;
}
std::string configName = prop.substr(9);
return ComputeLocation(tgt, configName);
return ComputeLocation(tgt, configName).c_str();
}
// Support "<CONFIG>_LOCATION".
@ -95,7 +95,7 @@ private:
context)) {
return nullptr;
}
return ComputeLocation(tgt, configName);
return ComputeLocation(tgt, configName).c_str();
}
}
}

View File

@ -389,7 +389,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
}
}
cmsys::RegularExpression regex(
cmsys::Glob::PatternToRegex(entryPattern, true, true).c_str());
cmsys::Glob::PatternToRegex(entryPattern, true, true));
// go through all cache entries and collect the vars which will be
// removed
std::vector<std::string> entriesToDelete;