stringapi: Pass configuration names as strings

This commit is contained in:
Ben Boeckel 2014-02-09 22:48:34 -05:00 committed by Brad King
parent f154475b65
commit 84fdc9921c
74 changed files with 539 additions and 485 deletions

View File

@ -623,7 +623,8 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
componentsVector.push_back(installComponent);
}
const char* buildConfig = this->GetOption("CPACK_BUILD_CONFIG");
const char* buildConfigCstr = this->GetOption("CPACK_BUILD_CONFIG");
std::string buildConfig = buildConfigCstr ? buildConfigCstr : "";
cmGlobalGenerator* globalGenerator
= this->MakefileMap->GetCMakeInstance()->CreateGlobalGenerator(
cmakeGenerator);
@ -822,9 +823,9 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
<< "'" << std::endl);
}
if ( buildConfig && *buildConfig )
if (!buildConfig.empty())
{
mf->AddDefinition("BUILD_TYPE", buildConfig);
mf->AddDefinition("BUILD_TYPE", buildConfig.c_str());
}
std::string installComponentLowerCase
= cmSystemTools::LowerCase(installComponent);

View File

@ -172,7 +172,7 @@ satisfy dependencies.
//----------------------------------------------------------------------------
cmComputeLinkDepends
::cmComputeLinkDepends(cmTarget const* target, const char* config,
::cmComputeLinkDepends(cmTarget const* target, const std::string& config,
cmTarget const* head)
{
// Store context information.
@ -184,7 +184,8 @@ cmComputeLinkDepends
this->CMakeInstance = this->GlobalGenerator->GetCMakeInstance();
// The configuration being linked.
this->Config = (config && *config)? config : 0;
this->HasConfig = !config.empty();
this->Config = (this->HasConfig)? config : std::string();
this->LinkType = this->Target->ComputeLinkType(this->Config);
// Enable debug mode if requested.
@ -255,7 +256,7 @@ cmComputeLinkDepends::Compute()
"---------------------------------------\n");
fprintf(stderr, "Link dependency analysis for target %s, config %s\n",
this->Target->GetName().c_str(),
this->Config?this->Config:"noconfig");
this->HasConfig?this->Config.c_str():"noconfig");
this->DisplayConstraintGraph();
}

View File

@ -32,7 +32,7 @@ class cmake;
class cmComputeLinkDepends
{
public:
cmComputeLinkDepends(cmTarget const* target, const char* config,
cmComputeLinkDepends(cmTarget const* target, const std::string& config,
cmTarget const* head);
~cmComputeLinkDepends();
@ -68,7 +68,8 @@ private:
bool DebugMode;
// Configuration information.
const char* Config;
bool HasConfig;
std::string Config;
cmTarget::LinkLibraryType LinkType;
// Output information.

View File

@ -239,7 +239,7 @@ because this need be done only for shared libraries without soname-s.
//----------------------------------------------------------------------------
cmComputeLinkInformation
::cmComputeLinkInformation(cmTarget const* target, const char* config,
::cmComputeLinkInformation(cmTarget const* target, const std::string& config,
cmTarget const* headTarget)
{
// Store context information.
@ -505,7 +505,8 @@ bool cmComputeLinkInformation::Compute()
}
// Compute the ordered link line items.
cmComputeLinkDepends cld(this->Target, this->Config, this->HeadTarget);
cmComputeLinkDepends cld(this->Target, this->Config.c_str(),
this->HeadTarget);
cld.SetOldLinkDirMode(this->OldLinkDirMode);
cmComputeLinkDepends::EntryVector const& linkEntries = cld.Compute();
@ -624,7 +625,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
cmTarget const* tgt)
{
// Compute the proper name to use to link this library.
const char* config = this->Config;
const std::string& config = this->Config;
bool impexe = (tgt && tgt->IsExecutableWithExports());
if(impexe && !this->UseImportLibrary && !this->LoaderFlag)
{

View File

@ -29,7 +29,7 @@ class cmOrderDirectories;
class cmComputeLinkInformation
{
public:
cmComputeLinkInformation(cmTarget const* target, const char* config,
cmComputeLinkInformation(cmTarget const* target, const std::string& config,
cmTarget const* headTarget);
~cmComputeLinkInformation();
bool Compute();
@ -82,7 +82,7 @@ private:
cmake* CMakeInstance;
// Configuration information.
const char* Config;
std::string Config;
std::string LinkLanguage;
bool LinkDependsNoShared;

View File

@ -214,7 +214,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
std::set<std::string> emitted;
{
std::vector<std::string> tlibs;
depender->GetDirectLinkLibraries(0, tlibs, depender);
depender->GetDirectLinkLibraries("", tlibs, depender);
// A target should not depend on itself.
emitted.insert(depender->GetName());
for(std::vector<std::string>::const_iterator lib = tlibs.begin();
@ -274,7 +274,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
//----------------------------------------------------------------------------
void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
cmTarget const* dependee,
const char *config,
const std::string& config,
std::set<std::string> &emitted)
{
cmTarget const* depender = this->Targets[depender_index];
@ -317,7 +317,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
if(dependee)
{
this->AddInterfaceDepends(depender_index, dependee, 0, emitted);
this->AddInterfaceDepends(depender_index, dependee, "", emitted);
std::vector<std::string> configs;
depender->GetMakefile()->GetConfigurations(configs);
for (std::vector<std::string>::const_iterator it = configs.begin();

View File

@ -55,7 +55,7 @@ private:
const std::string& dependee_name,
bool linking, std::set<std::string> &emitted);
void AddInterfaceDepends(int depender_index, cmTarget const* dependee,
const char *config,
const std::string& config,
std::set<std::string> &emitted);
cmGlobalGenerator* GlobalGenerator;
bool DebugMode;

View File

@ -357,7 +357,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
cmExportTryCompileFileGenerator tcfg;
tcfg.SetExportFile((this->BinaryDirectory + fname).c_str());
tcfg.SetExports(targets);
tcfg.SetConfig(this->Makefile->GetDefinition(
tcfg.SetConfig(this->Makefile->GetSafeDefinition(
"CMAKE_TRY_COMPILE_CONFIGURATION"));
if(!tcfg.GenerateImportFile())

View File

@ -18,7 +18,7 @@
//----------------------------------------------------------------------------
cmCustomCommandGenerator::cmCustomCommandGenerator(
cmCustomCommand const& cc, const char* config, cmMakefile* mf):
cmCustomCommand const& cc, const std::string& config, cmMakefile* mf):
CC(cc), Config(config), Makefile(mf), LG(mf->GetLocalGenerator()),
OldStyle(cc.GetEscapeOldStyle()), MakeVars(cc.GetEscapeAllowMakeVars()),
GE(new cmGeneratorExpression(cc.GetBacktrace()))

View File

@ -22,14 +22,15 @@ class cmGeneratorExpression;
class cmCustomCommandGenerator
{
cmCustomCommand const& CC;
const char* Config;
std::string Config;
cmMakefile* Makefile;
cmLocalGenerator* LG;
bool OldStyle;
bool MakeVars;
cmGeneratorExpression* GE;
public:
cmCustomCommandGenerator(cmCustomCommand const& cc, const char* config,
cmCustomCommandGenerator(cmCustomCommand const& cc,
const std::string& config,
cmMakefile* mf);
~cmCustomCommandGenerator();
unsigned int GetNumberOfCommands() const;

View File

@ -118,8 +118,9 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
void
cmExportBuildFileGenerator
::GenerateImportTargetsConfig(std::ostream& os,
const char* config, std::string const& suffix,
std::vector<std::string> &missingTargets)
const std::string& config,
std::string const& suffix,
std::vector<std::string> &missingTargets)
{
for(std::vector<cmTarget*>::const_iterator
tei = this->Exports.begin();
@ -166,7 +167,8 @@ void cmExportBuildFileGenerator::SetExportSet(cmExportSet *exportSet)
//----------------------------------------------------------------------------
void
cmExportBuildFileGenerator
::SetImportLocationProperty(const char* config, std::string const& suffix,
::SetImportLocationProperty(const std::string& config,
std::string const& suffix,
cmTarget* target, ImportPropertyMap& properties)
{
// Get the makefile in which to lookup target information.

View File

@ -52,7 +52,7 @@ protected:
// Implement virtual methods from the superclass.
virtual bool GenerateMainFile(std::ostream& os);
virtual void GenerateImportTargetsConfig(std::ostream& os,
const char* config,
const std::string& config,
std::string const& suffix,
std::vector<std::string> &missingTargets);
virtual void HandleMissingTarget(std::string& link_libs,
@ -66,7 +66,7 @@ protected:
int occurrences);
/** Fill in properties indicating built file locations. */
void SetImportLocationProperty(const char* config,
void SetImportLocationProperty(const std::string& config,
std::string const& suffix,
cmTarget* target,
ImportPropertyMap& properties);

View File

@ -35,7 +35,7 @@ cmExportFileGenerator::cmExportFileGenerator()
}
//----------------------------------------------------------------------------
void cmExportFileGenerator::AddConfiguration(const char* config)
void cmExportFileGenerator::AddConfiguration(const std::string& config)
{
this->Configurations.push_back(config);
}
@ -117,12 +117,12 @@ bool cmExportFileGenerator::GenerateImportFile()
//----------------------------------------------------------------------------
void cmExportFileGenerator::GenerateImportConfig(std::ostream& os,
const char* config,
const std::string& config,
std::vector<std::string> &missingTargets)
{
// Construct the property configuration suffix.
std::string suffix = "_";
if(config && *config)
if(!config.empty())
{
suffix += cmSystemTools::UpperCase(config);
}
@ -345,7 +345,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
true);
this->ReplaceInstallPrefix(dirs);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(dirs);
std::string exportDirs = cge->Evaluate(target->GetMakefile(), 0,
std::string exportDirs = cge->Evaluate(target->GetMakefile(), "",
false, target);
if (cge->GetHadContextSensitiveCondition())
@ -426,7 +426,7 @@ void getPropertyContents(cmTarget const* tgt, const std::string& prop,
//----------------------------------------------------------------------------
void getCompatibleInterfaceProperties(cmTarget *target,
std::set<std::string> &ifaceProperties,
const char *config)
const std::string& config)
{
cmComputeLinkInformation *info = target->GetLinkInformation(config);
@ -490,7 +490,7 @@ void cmExportFileGenerator::PopulateCompatibleInterfaceProperties(
if (target->GetType() != cmTarget::INTERFACE_LIBRARY)
{
getCompatibleInterfaceProperties(target, ifaceProperties, 0);
getCompatibleInterfaceProperties(target, ifaceProperties, "");
std::vector<std::string> configNames;
target->GetMakefile()->GetConfigurations(configNames);
@ -687,7 +687,7 @@ cmExportFileGenerator::ReplaceInstallPrefix(std::string &)
//----------------------------------------------------------------------------
void
cmExportFileGenerator
::SetImportLinkInterface(const char* config, std::string const& suffix,
::SetImportLinkInterface(const std::string& config, std::string const& suffix,
cmGeneratorExpression::PreprocessContext preprocessRule,
cmTarget* target, ImportPropertyMap& properties,
std::vector<std::string>& missingTargets)
@ -762,7 +762,8 @@ cmExportFileGenerator
//----------------------------------------------------------------------------
void
cmExportFileGenerator
::SetImportDetailProperties(const char* config, std::string const& suffix,
::SetImportDetailProperties(const std::string& config,
std::string const& suffix,
cmTarget* target, ImportPropertyMap& properties,
std::vector<std::string>& missingTargets
)
@ -864,11 +865,11 @@ cmExportFileGenerator
//----------------------------------------------------------------------------
void cmExportFileGenerator::GenerateImportHeaderCode(std::ostream& os,
const char* config)
const std::string& config)
{
os << "#----------------------------------------------------------------\n"
<< "# Generated CMake target import file";
if(config)
if(!config.empty())
{
os << " for configuration \"" << config << "\".\n";
}
@ -999,7 +1000,7 @@ cmExportFileGenerator
//----------------------------------------------------------------------------
void
cmExportFileGenerator
::GenerateImportPropertyCode(std::ostream& os, const char* config,
::GenerateImportPropertyCode(std::ostream& os, const std::string& config,
cmTarget const* target,
ImportPropertyMap const& properties)
{
@ -1013,7 +1014,7 @@ cmExportFileGenerator
<< config << "\"\n";
os << "set_property(TARGET " << targetName
<< " APPEND PROPERTY IMPORTED_CONFIGURATIONS ";
if(config && *config)
if(!config.empty())
{
os << cmSystemTools::UpperCase(config);
}

View File

@ -56,7 +56,7 @@ public:
void SetExportOld(bool exportOld) { this->ExportOld = exportOld; }
/** Add a configuration to be exported. */
void AddConfiguration(const char* config);
void AddConfiguration(const std::string& config);
/** Actually generate the export file. Returns whether there was an
error. */
@ -67,15 +67,16 @@ protected:
// Generate per-configuration target information to the given output
// stream.
void GenerateImportConfig(std::ostream& os, const char* config,
void GenerateImportConfig(std::ostream& os, const std::string& config,
std::vector<std::string> &missingTargets);
// Methods to implement export file code generation.
void GenerateImportHeaderCode(std::ostream& os, const char* config = 0);
void GenerateImportHeaderCode(std::ostream& os,
const std::string& config = "");
void GenerateImportFooterCode(std::ostream& os);
void GenerateImportVersionCode(std::ostream& os);
void GenerateImportTargetCode(std::ostream& os, cmTarget const* target);
void GenerateImportPropertyCode(std::ostream& os, const char* config,
void GenerateImportPropertyCode(std::ostream& os, const std::string& config,
cmTarget const* target,
ImportPropertyMap const& properties);
void GenerateImportedFileChecksCode(std::ostream& os, cmTarget* target,
@ -90,7 +91,7 @@ protected:
// Collect properties with detailed information about targets beyond
// their location on disk.
void SetImportDetailProperties(const char* config,
void SetImportDetailProperties(const std::string& config,
std::string const& suffix, cmTarget* target,
ImportPropertyMap& properties,
std::vector<std::string>& missingTargets);
@ -105,7 +106,7 @@ protected:
/** Each subclass knows where the target files are located. */
virtual void GenerateImportTargetsConfig(std::ostream& os,
const char* config,
const std::string& config,
std::string const& suffix,
std::vector<std::string> &missingTargets) = 0;
@ -137,7 +138,8 @@ protected:
ImportPropertyMap &properties,
std::vector<std::string> &missingTargets);
void SetImportLinkInterface(const char* config, std::string const& suffix,
void SetImportLinkInterface(const std::string& config,
std::string const& suffix,
cmGeneratorExpression::PreprocessContext preprocessRule,
cmTarget* target, ImportPropertyMap& properties,
std::vector<std::string>& missingTargets);

View File

@ -240,7 +240,8 @@ cmExportInstallFileGenerator::ReplaceInstallPrefix(std::string &input)
//----------------------------------------------------------------------------
bool
cmExportInstallFileGenerator::GenerateImportFileConfig(const char* config,
cmExportInstallFileGenerator::GenerateImportFileConfig(
const std::string& config,
std::vector<std::string> &missingTargets)
{
// Skip configurations not enabled for this export.
@ -254,7 +255,7 @@ cmExportInstallFileGenerator::GenerateImportFileConfig(const char* config,
fileName += "/";
fileName += this->FileBase;
fileName += "-";
if(config && *config)
if(!config.empty())
{
fileName += cmSystemTools::LowerCase(config);
}
@ -296,7 +297,8 @@ cmExportInstallFileGenerator::GenerateImportFileConfig(const char* config,
void
cmExportInstallFileGenerator
::GenerateImportTargetsConfig(std::ostream& os,
const char* config, std::string const& suffix,
const std::string& config,
std::string const& suffix,
std::vector<std::string> &missingTargets)
{
// Add each target in the set to the export.
@ -355,7 +357,8 @@ cmExportInstallFileGenerator
//----------------------------------------------------------------------------
void
cmExportInstallFileGenerator
::SetImportLocationProperty(const char* config, std::string const& suffix,
::SetImportLocationProperty(const std::string& config,
std::string const& suffix,
cmInstallTargetGenerator* itgen,
ImportPropertyMap& properties,
std::set<std::string>& importedLocations

View File

@ -52,7 +52,7 @@ protected:
// Implement virtual methods from the superclass.
virtual bool GenerateMainFile(std::ostream& os);
virtual void GenerateImportTargetsConfig(std::ostream& os,
const char* config,
const std::string& config,
std::string const& suffix,
std::vector<std::string> &missingTargets);
virtual void HandleMissingTarget(std::string& link_libs,
@ -72,11 +72,11 @@ protected:
/** Generate a per-configuration file for the targets. */
bool GenerateImportFileConfig(const char* config,
bool GenerateImportFileConfig(const std::string& config,
std::vector<std::string> &missingTargets);
/** Fill in properties indicating installed file locations. */
void SetImportLocationProperty(const char* config,
void SetImportLocationProperty(const std::string& config,
std::string const& suffix,
cmInstallTargetGenerator* itgen,
ImportPropertyMap& properties,

View File

@ -23,14 +23,14 @@ public:
/** Set the list of targets to export. */
void SetExports(const std::vector<cmTarget const*> &exports)
{ this->Exports = exports; }
void SetConfig(const char *config) { this->Config = config; }
void SetConfig(const std::string& config) { this->Config = config; }
protected:
// Implement virtual methods from the superclass.
virtual bool GenerateMainFile(std::ostream& os);
virtual void GenerateImportTargetsConfig(std::ostream&,
const char*,
const std::string&,
std::string const&,
std::vector<std::string>&) {}
virtual void HandleMissingTarget(std::string&,
@ -51,7 +51,7 @@ private:
std::vector<cmTarget const*> Exports;
const char *Config;
std::string Config;
};
#endif

View File

@ -375,7 +375,7 @@ cmExtraSublimeTextGenerator::ComputeFlagsForObject(cmSourceFile* source,
{
language = "C";
}
const char* config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
const std::string& config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
// Add language-specific flags.
lg->AddLanguageFlags(flags, language, config);
@ -425,7 +425,7 @@ ComputeDefines(cmSourceFile *source, cmLocalGenerator* lg, cmTarget *target,
std::set<std::string> defines;
cmMakefile *makefile = lg->GetMakefile();
const std::string& language = source->GetLanguage();
const char* config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
const std::string& config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
// Add the export symbol definition for shared library objects.
if(const char* exportMacro = target->GetExportMacro())

View File

@ -52,7 +52,7 @@ cmGeneratorExpression::~cmGeneratorExpression()
//----------------------------------------------------------------------------
const char *cmCompiledGeneratorExpression::Evaluate(
cmMakefile* mf, const char* config, bool quiet,
cmMakefile* mf, const std::string& config, bool quiet,
cmTarget const* headTarget,
cmGeneratorExpressionDAGChecker *dagChecker) const
{
@ -66,7 +66,7 @@ const char *cmCompiledGeneratorExpression::Evaluate(
//----------------------------------------------------------------------------
const char *cmCompiledGeneratorExpression::Evaluate(
cmMakefile* mf, const char* config, bool quiet,
cmMakefile* mf, const std::string& config, bool quiet,
cmTarget const* headTarget,
cmTarget const* currentTarget,
cmGeneratorExpressionDAGChecker *dagChecker) const

View File

@ -78,12 +78,12 @@ private:
class cmCompiledGeneratorExpression
{
public:
const char* Evaluate(cmMakefile* mf, const char* config,
const char* Evaluate(cmMakefile* mf, const std::string& config,
bool quiet = false,
cmTarget const* headTarget = 0,
cmTarget const* currentTarget = 0,
cmGeneratorExpressionDAGChecker *dagChecker = 0) const;
const char* Evaluate(cmMakefile* mf, const char* config,
const char* Evaluate(cmMakefile* mf, const std::string& config,
bool quiet,
cmTarget const* headTarget,
cmGeneratorExpressionDAGChecker *dagChecker) const;

View File

@ -33,7 +33,7 @@ cmGeneratorExpressionEvaluationFile::cmGeneratorExpressionEvaluationFile(
}
//----------------------------------------------------------------------------
void cmGeneratorExpressionEvaluationFile::Generate(const char *config,
void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config,
cmCompiledGeneratorExpression* inputExpression,
std::map<std::string, std::string> &outputFiles)
{
@ -135,7 +135,7 @@ void cmGeneratorExpressionEvaluationFile::Generate()
if (allConfigs.empty())
{
this->Generate(0, inputExpression.get(), outputFiles);
this->Generate("", inputExpression.get(), outputFiles);
}
else
{

View File

@ -32,7 +32,7 @@ public:
std::vector<std::string> GetFiles() const { return this->Files; }
private:
void Generate(const char *config,
void Generate(const std::string& config,
cmCompiledGeneratorExpression* inputExpression,
std::map<std::string, std::string> &outputFiles);

View File

@ -689,7 +689,7 @@ static const struct ConfigurationNode : public cmGeneratorExpressionNode
cmGeneratorExpressionDAGChecker *) const
{
context->HadContextSensitiveCondition = true;
return context->Config ? context->Config : "";
return context->Config;
}
} configurationNode;
@ -718,13 +718,13 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode
return std::string();
}
context->HadContextSensitiveCondition = true;
if (!context->Config)
if (context->Config.empty())
{
return parameters.front().empty() ? "1" : "0";
}
if (cmsysString_strcasecmp(parameters.begin()->c_str(),
context->Config) == 0)
context->Config.c_str()) == 0)
{
return "1";
}

View File

@ -27,7 +27,7 @@ struct cmGeneratorExpressionContext
std::set<cmTarget const*> AllTargets;
std::set<std::string> SeenTargetProperties;
cmMakefile *Makefile;
const char *Config;
std::string Config;
cmTarget const* HeadTarget; // The target whose property is being evaluated.
cmTarget const* CurrentTarget; // The dependent of HeadTarget which appears
// directly or indirectly in the property.

View File

@ -252,7 +252,8 @@ cmGeneratorTarget::GetSourceDepends(cmSourceFile* sf) const
}
static void handleSystemIncludesDep(cmMakefile *mf, cmTarget* depTgt,
const char *config, cmTarget *headTarget,
const std::string& config,
cmTarget *headTarget,
cmGeneratorExpressionDAGChecker *dagChecker,
std::vector<std::string>& result,
bool excludeImported)
@ -390,12 +391,12 @@ void cmGeneratorTarget::GetResxSources(std::vector<cmSourceFile*>& srcs) const
}
//----------------------------------------------------------------------------
bool cmGeneratorTarget::IsSystemIncludeDirectory(const char *dir,
const char *config) const
bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir,
const std::string& config) const
{
assert(this->GetType() != cmTarget::INTERFACE_LIBRARY);
std::string config_upper;
if(config && *config)
if(!config.empty())
{
config_upper = cmSystemTools::UpperCase(config);
}
@ -802,7 +803,7 @@ cmTargetTraceDependencies
{
const cmsys::auto_ptr<cmCompiledGeneratorExpression> cge
= ge.Parse(*cli);
cge->Evaluate(this->Makefile, 0, true);
cge->Evaluate(this->Makefile, "", true);
std::set<cmTarget*> geTargets = cge->GetTargets();
for(std::set<cmTarget*>::const_iterator it = geTargets.begin();
it != geTargets.end(); ++it)
@ -863,11 +864,11 @@ void cmGeneratorTarget::TraceDependencies()
}
//----------------------------------------------------------------------------
void cmGeneratorTarget::GetAppleArchs(const char* config,
void cmGeneratorTarget::GetAppleArchs(const std::string& config,
std::vector<std::string>& archVec) const
{
const char* archs = 0;
if(config && *config)
if(!config.empty())
{
std::string defVarName = "OSX_ARCHITECTURES_";
defVarName += cmSystemTools::UpperCase(config);
@ -904,13 +905,14 @@ const char* cmGeneratorTarget::GetCreateRuleVariable() const
//----------------------------------------------------------------------------
std::vector<std::string>
cmGeneratorTarget::GetIncludeDirectories(const char *config) const
cmGeneratorTarget::GetIncludeDirectories(const std::string& config) const
{
return this->Target->GetIncludeDirectories(config);
}
//----------------------------------------------------------------------------
void cmGeneratorTarget::GenerateTargetManifest(const char* config) const
void cmGeneratorTarget::GenerateTargetManifest(
const std::string& config) const
{
if (this->Target->IsImported())
{
@ -953,35 +955,35 @@ void cmGeneratorTarget::GenerateTargetManifest(const char* config) const
f = dir;
f += "/";
f += name;
gg->AddToManifest(config? config:"", f);
gg->AddToManifest(config, f);
}
if(!soName.empty())
{
f = dir;
f += "/";
f += soName;
gg->AddToManifest(config? config:"", f);
gg->AddToManifest(config, f);
}
if(!realName.empty())
{
f = dir;
f += "/";
f += realName;
gg->AddToManifest(config? config:"", f);
gg->AddToManifest(config, f);
}
if(!pdbName.empty())
{
f = dir;
f += "/";
f += pdbName;
gg->AddToManifest(config? config:"", f);
gg->AddToManifest(config, f);
}
if(!impName.empty())
{
f = this->Target->GetDirectory(config, true);
f += "/";
f += impName;
gg->AddToManifest(config? config:"", f);
gg->AddToManifest(config, f);
}
}

View File

@ -61,7 +61,7 @@ public:
void UseObjectLibraries(std::vector<std::string>& objs) const;
void GetAppleArchs(const char* config,
void GetAppleArchs(const std::string& config,
std::vector<std::string>& archVec) const;
///! Return the rule variable used to create this type of target,
@ -69,12 +69,14 @@ public:
const char* GetCreateRuleVariable() const;
/** Get the include directories for this target. */
std::vector<std::string> GetIncludeDirectories(const char *config) const;
std::vector<std::string> GetIncludeDirectories(
const std::string& config) const;
bool IsSystemIncludeDirectory(const char *dir, const char *config) const;
bool IsSystemIncludeDirectory(const std::string& dir,
const std::string& config) const;
/** Add the target output files to the global generator manifest. */
void GenerateTargetManifest(const char* config) const;
void GenerateTargetManifest(const std::string& config) const;
/**
* Trace through the source files in this target and add al source files

View File

@ -1655,7 +1655,8 @@ int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir,
#endif // WIN32
#endif
}
const char* config = mf->GetDefinition("CMAKE_TRY_COMPILE_CONFIGURATION");
std::string config =
mf->GetSafeDefinition("CMAKE_TRY_COMPILE_CONFIGURATION");
return this->Build(srcdir,bindir,projectName,
newTarget.c_str(),
output,0,config,false,fast,
@ -1664,7 +1665,7 @@ int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir,
void cmGlobalGenerator::GenerateBuildCommand(
std::vector<std::string>& makeCommand, const char*, const std::string&,
const char*, const std::string&, const char*, bool,
const char*, const std::string&, const std::string&, bool,
std::vector<std::string> const&)
{
makeCommand.push_back(
@ -1676,7 +1677,7 @@ int cmGlobalGenerator::Build(
const std::string& projectName, const std::string& target,
std::string *output,
const char *makeCommandCSTR,
const char *config,
const std::string& config,
bool clean, bool fast,
double timeout,
cmSystemTools::OutputOption outputflag,
@ -1788,13 +1789,14 @@ int cmGlobalGenerator::Build(
//----------------------------------------------------------------------------
std::string cmGlobalGenerator::GenerateCMakeBuildCommand(
const std::string& target, const char* config, const char* native,
const std::string& target, const std::string& config,
const char* native,
bool ignoreErrors)
{
std::string makeCommand = cmSystemTools::GetCMakeCommand();
makeCommand = cmSystemTools::ConvertToOutputPath(makeCommand.c_str());
makeCommand += " --build .";
if(config && *config)
if(!config.empty())
{
makeCommand += " --config \"";
makeCommand += config;
@ -2526,7 +2528,8 @@ std::string cmGlobalGenerator::GetSharedLibFlagsForLanguage(
}
//----------------------------------------------------------------------------
void cmGlobalGenerator::AppendDirectoryForConfig(const char*, const char*,
void cmGlobalGenerator::AppendDirectoryForConfig(const char*,
const std::string&,
const char*, std::string&)
{
// Subclasses that support multiple configurations should implement
@ -2677,7 +2680,7 @@ void cmGlobalGenerator::AddTargetDepends(cmTarget const* target,
//----------------------------------------------------------------------------
void cmGlobalGenerator::AddToManifest(const char* config,
void cmGlobalGenerator::AddToManifest(const std::string& config,
std::string const& f)
{
// Add to the main manifest for this configuration.

View File

@ -120,7 +120,7 @@ public:
int Build(const char *srcdir, const char *bindir,
const std::string& projectName, const std::string& targetName,
std::string *output,
const char *makeProgram, const char *config,
const char *makeProgram, const std::string& config,
bool clean, bool fast,
double timeout,
cmSystemTools::OutputOption outputflag=cmSystemTools::OUTPUT_NONE,
@ -131,13 +131,13 @@ public:
std::vector<std::string>& makeCommand,
const char* makeProgram,
const std::string& projectName, const char *projectDir,
const std::string& targetName, const char* config, bool fast,
const std::string& targetName, const std::string& config, bool fast,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
/** Generate a "cmake --build" call for a given target and config. */
std::string GenerateCMakeBuildCommand(const std::string& target,
const char* config,
const std::string& config,
const char* native,
bool ignoreErrors);
@ -173,7 +173,7 @@ public:
cmExportSetMap& GetExportSets() {return this->ExportSets;}
/** Add a file to the manifest of generated targets for a configuration. */
void AddToManifest(const char* config, std::string const& f);
void AddToManifest(const std::string& config, std::string const& f);
void EnableInstallTarget();
@ -231,7 +231,7 @@ public:
appended the given prefix and suffix will be appended around it, which
is useful for leading or trailing slashes. */
virtual void AppendDirectoryForConfig(const char* prefix,
const char* config,
const std::string& config,
const char* suffix,
std::string& dir);

View File

@ -555,7 +555,7 @@ void cmGlobalNinjaGenerator
const std::string& /*projectName*/,
const char* /*projectDir*/,
const std::string& targetName,
const char* /*config*/,
const std::string& /*config*/,
bool /*fast*/,
std::vector<std::string> const& makeOptions)
{
@ -834,8 +834,8 @@ void
cmGlobalNinjaGenerator
::AppendTargetOutputs(cmTarget const* target, cmNinjaDeps& outputs)
{
const char* configName =
target->GetMakefile()->GetDefinition("CMAKE_BUILD_TYPE");
std::string configName =
target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE");
cmLocalNinjaGenerator *ng =
static_cast<cmLocalNinjaGenerator *>(this->LocalGenerators[0]);

View File

@ -197,7 +197,7 @@ public:
const std::string& projectName,
const char* projectDir,
const std::string& targetName,
const char* config,
const std::string& config,
bool fast,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);

View File

@ -569,7 +569,7 @@ void cmGlobalUnixMakefileGenerator3
const std::string& /*projectName*/,
const char* /*projectDir*/,
const std::string& targetName,
const char* /*config*/,
const std::string& /*config*/,
bool fast,
std::vector<std::string> const& makeOptions)
{

View File

@ -113,7 +113,7 @@ public:
const std::string& projectName,
const char* projectDir,
const std::string& targetName,
const char* config,
const std::string& config,
bool fast,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);

View File

@ -314,7 +314,7 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand(
const std::string& projectName,
const char* projectDir,
const std::string& targetName,
const char* config,
const std::string& config,
bool fast,
std::vector<std::string> const& makeOptions)
{
@ -397,7 +397,7 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand(
makeCommand.push_back(targetProject);
}
std::string configArg = "/p:Configuration=";
if(config && strlen(config))
if(!config.empty())
{
configArg += config;
}

View File

@ -38,7 +38,7 @@ public:
const std::string& projectName,
const char* projectDir,
const std::string& targetName,
const char* config,
const std::string& config,
bool fast,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);

View File

@ -120,7 +120,7 @@ cmGlobalVisualStudio6Generator::GenerateBuildCommand(
const std::string& projectName,
const char* /*projectDir*/,
const std::string& targetName,
const char* config,
const std::string& config,
bool /*fast*/,
std::vector<std::string> const& makeOptions
)
@ -149,7 +149,7 @@ cmGlobalVisualStudio6Generator::GenerateBuildCommand(
targetArg += "ALL_BUILD";
}
targetArg += " - ";
if(config && strlen(config))
if(!config.empty())
{
targetArg += config;
}
@ -419,11 +419,11 @@ void cmGlobalVisualStudio6Generator
void
cmGlobalVisualStudio6Generator
::AppendDirectoryForConfig(const char* prefix,
const char* config,
const std::string& config,
const char* suffix,
std::string& dir)
{
if(config)
if(!config.empty())
{
dir += prefix;
dir += config;

View File

@ -58,7 +58,7 @@ public:
const std::string& projectName,
const char* projectDir,
const std::string& targetName,
const char* config,
const std::string& config,
bool fast,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
@ -82,7 +82,7 @@ public:
/** Append the subdirectory for the given configuration. */
virtual void AppendDirectoryForConfig(const char* prefix,
const char* config,
const std::string& config,
const char* suffix,
std::string& dir);

View File

@ -187,7 +187,7 @@ void cmGlobalVisualStudio7Generator::GenerateBuildCommand(
const std::string& projectName,
const char* /*projectDir*/,
const std::string& targetName,
const char* config,
const std::string& config,
bool /*fast*/,
std::vector<std::string> const& makeOptions)
{
@ -224,7 +224,7 @@ void cmGlobalVisualStudio7Generator::GenerateBuildCommand(
makeCommand.push_back("/build");
}
if(config && strlen(config))
if(!config.empty())
{
makeCommand.push_back(config);
}
@ -962,11 +962,11 @@ void cmGlobalVisualStudio7Generator
void
cmGlobalVisualStudio7Generator
::AppendDirectoryForConfig(const char* prefix,
const char* config,
const std::string& config,
const char* suffix,
std::string& dir)
{
if(config)
if(!config.empty())
{
dir += prefix;
dir += config;

View File

@ -66,7 +66,7 @@ public:
const std::string& projectName,
const char* projectDir,
const std::string& targetName,
const char* config,
const std::string& config,
bool fast,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
@ -94,7 +94,7 @@ public:
/** Append the subdirectory for the given configuration. */
virtual void AppendDirectoryForConfig(const char* prefix,
const char* config,
const std::string& config,
const char* suffix,
std::string& dir);

View File

@ -264,7 +264,7 @@ cmGlobalXCodeGenerator::GenerateBuildCommand(
const std::string& projectName,
const char* /*projectDir*/,
const std::string& targetName,
const char* config,
const std::string& config,
bool /*fast*/,
std::vector<std::string> const& makeOptions)
{
@ -298,11 +298,6 @@ cmGlobalXCodeGenerator::GenerateBuildCommand(
makeCommand.push_back("build");
}
makeCommand.push_back("-target");
// if it is a null string for config don't use it
if(config && *config == 0)
{
config = 0;
}
if (!realTarget.empty())
{
makeCommand.push_back(realTarget);
@ -319,7 +314,7 @@ cmGlobalXCodeGenerator::GenerateBuildCommand(
else
{
makeCommand.push_back("-configuration");
makeCommand.push_back(config?config:"Debug");
makeCommand.push_back(!config.empty()?config:"Debug");
}
makeCommand.insert(makeCommand.end(),
makeOptions.begin(), makeOptions.end());
@ -1547,7 +1542,7 @@ void cmGlobalXCodeGenerator
cmTarget& target,
std::vector<cmCustomCommand>
const & commands,
const char* configName,
const std::string& configName,
const std::map<std::string,
std::string>& multipleOutputPairs
)
@ -1690,8 +1685,8 @@ void cmGlobalXCodeGenerator
//----------------------------------------------------------------------------
void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
cmXCodeObject* buildSettings,
const char* configName)
cmXCodeObject* buildSettings,
const std::string& configName)
{
if(target.GetType() == cmTarget::INTERFACE_LIBRARY)
{
@ -1804,7 +1799,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
this->CurrentLocalGenerator->
AppendFlags(extraLinkOptions, targetLinkFlags);
}
if(configName && *configName)
if(!configName.empty())
{
std::string linkFlagsVar = "LINK_FLAGS_";
linkFlagsVar += cmSystemTools::UpperCase(configName);
@ -2738,7 +2733,7 @@ void cmGlobalXCodeGenerator
::AppendBuildSettingAttribute(cmXCodeObject* target,
const char* attribute,
const char* value,
const char* configName)
const std::string& configName)
{
if(this->XcodeVersion < 21)
{
@ -2761,9 +2756,9 @@ void cmGlobalXCodeGenerator
for(std::vector<cmXCodeObject*>::iterator i = list.begin();
i != list.end(); ++i)
{
if(configName)
if(!configName.empty())
{
if(strcmp((*i)->GetObject("name")->GetString(), configName) == 0)
if((*i)->GetObject("name")->GetString() == configName)
{
cmXCodeObject* settings = (*i)->GetObject("buildSettings");
this->AppendOrAddBuildSetting(settings, attribute, value);
@ -3777,13 +3772,13 @@ std::string cmGlobalXCodeGenerator::XCodeEscapePath(const char* p)
void
cmGlobalXCodeGenerator
::AppendDirectoryForConfig(const char* prefix,
const char* config,
const std::string& config,
const char* suffix,
std::string& dir)
{
if(this->XcodeVersion > 20)
{
if(config)
if(!config.empty())
{
dir += prefix;
dir += config;

View File

@ -59,7 +59,7 @@ public:
const std::string& projectName,
const char* projectDir,
const std::string& targetName,
const char* config,
const std::string& config,
bool fast,
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
@ -73,7 +73,7 @@ public:
/** Append the subdirectory for the given configuration. */
virtual void AppendDirectoryForConfig(const char* prefix,
const char* config,
const std::string& config,
const char* suffix,
std::string& dir);
@ -123,7 +123,7 @@ private:
void CreateCustomRulesMakefile(const char* makefileBasename,
cmTarget& target,
std::vector<cmCustomCommand> const & commands,
const char* configName,
const std::string& configName,
const std::map<std::string, std::string>&
multipleOutputPairs
);
@ -147,12 +147,13 @@ private:
void AppendOrAddBuildSetting(cmXCodeObject* settings, const char* attr,
const char* value);
void AppendBuildSettingAttribute(cmXCodeObject* target, const char* attr,
const char* value, const char* configName);
const char* value,
const std::string& configName);
cmXCodeObject* CreateUtilityTarget(cmTarget& target);
void AddDependAndLinkInformation(cmXCodeObject* target);
void CreateBuildSettings(cmTarget& target,
cmXCodeObject* buildSettings,
const char* buildType);
const std::string& buildType);
std::string ExtractFlag(const char* flag, std::string& flags);
// delete all objects in the this->XCodeObjects vector.
void ClearXCodeObjects();

View File

@ -142,7 +142,7 @@ void cmInstallExportGenerator::GenerateScript(std::ostream& os)
this->EFGen->SetExportOld(this->ExportOld);
if(this->ConfigurationTypes->empty())
{
if(this->ConfigurationName && *this->ConfigurationName)
if(!this->ConfigurationName.empty())
{
this->EFGen->AddConfiguration(this->ConfigurationName);
}

View File

@ -80,8 +80,8 @@ void cmInstallFilesGenerator::GenerateScriptActions(std::ostream& os,
//----------------------------------------------------------------------------
void cmInstallFilesGenerator::GenerateScriptForConfig(std::ostream& os,
const char* config,
Indent const& indent)
const std::string& config,
Indent const& indent)
{
std::vector<std::string> files;
cmListFileBacktrace lfbt;

View File

@ -35,7 +35,7 @@ public:
protected:
virtual void GenerateScriptActions(std::ostream& os, Indent const& indent);
virtual void GenerateScriptForConfig(std::ostream& os,
const char* config,
const std::string& config,
Indent const& indent);
void AddFilesInstallRule(std::ostream& os, Indent const& indent,
std::vector<std::string> const& files);

View File

@ -163,7 +163,7 @@ void cmInstallGenerator::GenerateScript(std::ostream& os)
}
//----------------------------------------------------------------------------
bool cmInstallGenerator::InstallsForConfig(const char* config)
bool cmInstallGenerator::InstallsForConfig(const std::string& config)
{
return this->GeneratesForConfig(config);
}

View File

@ -48,7 +48,7 @@ public:
std::string GetInstallDestination() const;
/** Test if this generator installs something for a given configuration. */
bool InstallsForConfig(const char*);
bool InstallsForConfig(const std::string& config);
protected:
virtual void GenerateScript(std::ostream& os);

View File

@ -59,8 +59,8 @@ void cmInstallTargetGenerator::GenerateScript(std::ostream& os)
//----------------------------------------------------------------------------
void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
const char* config,
Indent const& indent)
const std::string& config,
Indent const& indent)
{
// Compute the build tree directory from which to copy the target.
std::string fromDirConfig;
@ -319,7 +319,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
//----------------------------------------------------------------------------
std::string
cmInstallTargetGenerator::GetInstallFilename(const char* config) const
cmInstallTargetGenerator::GetInstallFilename(const std::string& config) const
{
NameType nameType = this->ImportLibrary? NameImplib : NameNormal;
return
@ -330,7 +330,7 @@ cmInstallTargetGenerator::GetInstallFilename(const char* config) const
//----------------------------------------------------------------------------
std::string
cmInstallTargetGenerator::GetInstallFilename(cmTarget const* target,
const char* config,
const std::string& config,
NameType nameType)
{
std::string fname;
@ -405,7 +405,7 @@ cmInstallTargetGenerator::GetInstallFilename(cmTarget const* target,
//----------------------------------------------------------------------------
void
cmInstallTargetGenerator
::AddTweak(std::ostream& os, Indent const& indent, const char* config,
::AddTweak(std::ostream& os, Indent const& indent, const std::string& config,
std::string const& file, TweakMethod tweak)
{
cmOStringStream tw;
@ -423,7 +423,7 @@ cmInstallTargetGenerator
//----------------------------------------------------------------------------
void
cmInstallTargetGenerator
::AddTweak(std::ostream& os, Indent const& indent, const char* config,
::AddTweak(std::ostream& os, Indent const& indent, const std::string& config,
std::vector<std::string> const& files, TweakMethod tweak)
{
if(files.size() == 1)
@ -470,7 +470,7 @@ std::string cmInstallTargetGenerator::GetDestDirPath(std::string const& file)
//----------------------------------------------------------------------------
void cmInstallTargetGenerator::PreReplacementTweaks(std::ostream& os,
Indent const& indent,
const char* config,
const std::string& config,
std::string const& file)
{
this->AddRPathCheckRule(os, indent, config, file);
@ -478,9 +478,9 @@ void cmInstallTargetGenerator::PreReplacementTweaks(std::ostream& os,
//----------------------------------------------------------------------------
void cmInstallTargetGenerator::PostReplacementTweaks(std::ostream& os,
Indent const& indent,
const char* config,
std::string const& file)
Indent const& indent,
const std::string& config,
std::string const& file)
{
this->AddInstallNamePatchRule(os, indent, config, file);
this->AddChrpathPatchRule(os, indent, config, file);
@ -492,7 +492,8 @@ void cmInstallTargetGenerator::PostReplacementTweaks(std::ostream& os,
void
cmInstallTargetGenerator
::AddInstallNamePatchRule(std::ostream& os, Indent const& indent,
const char* config, std::string const& toDestDirPath)
const std::string& config,
std::string const& toDestDirPath)
{
if(this->ImportLibrary ||
!(this->Target->GetType() == cmTarget::SHARED_LIBRARY ||
@ -605,7 +606,8 @@ cmInstallTargetGenerator
void
cmInstallTargetGenerator
::AddRPathCheckRule(std::ostream& os, Indent const& indent,
const char* config, std::string const& toDestDirPath)
const std::string& config,
std::string const& toDestDirPath)
{
// Skip the chrpath if the target does not need it.
if(this->ImportLibrary || !this->Target->IsChrpathUsed(config))
@ -642,7 +644,8 @@ cmInstallTargetGenerator
void
cmInstallTargetGenerator
::AddChrpathPatchRule(std::ostream& os, Indent const& indent,
const char* config, std::string const& toDestDirPath)
const std::string& config,
std::string const& toDestDirPath)
{
// Skip the chrpath if the target does not need it.
if(this->ImportLibrary || !this->Target->IsChrpathUsed(config))

View File

@ -43,7 +43,7 @@ public:
void SetNamelinkMode(NamelinkModeType mode) { this->NamelinkMode = mode; }
NamelinkModeType GetNamelinkMode() const { return this->NamelinkMode; }
std::string GetInstallFilename(const char* config) const;
std::string GetInstallFilename(const std::string& config) const;
enum NameType
{
@ -54,7 +54,7 @@ public:
};
static std::string GetInstallFilename(cmTarget const* target,
const char* config,
const std::string& config,
NameType nameType = NameNormal);
cmTarget* GetTarget() const { return this->Target; }
@ -63,30 +63,33 @@ public:
protected:
virtual void GenerateScript(std::ostream& os);
virtual void GenerateScriptForConfig(std::ostream& os,
const char* config,
const std::string& config,
Indent const& indent);
typedef void (cmInstallTargetGenerator::*TweakMethod)(
std::ostream&, Indent const&, const char*, std::string const&
std::ostream&, Indent const&, const std::string&, std::string const&
);
void AddTweak(std::ostream& os, Indent const& indent,
const char* config, std::string const& file,
const std::string& config, std::string const& file,
TweakMethod tweak);
void AddTweak(std::ostream& os, Indent const& indent,
const char* config, std::vector<std::string> const& files,
const std::string& config,
std::vector<std::string> const& files,
TweakMethod tweak);
std::string GetDestDirPath(std::string const& file);
void PreReplacementTweaks(std::ostream& os, Indent const& indent,
const char* config, std::string const& file);
const std::string& config,
std::string const& file);
void PostReplacementTweaks(std::ostream& os, Indent const& indent,
const char* config, std::string const& file);
const std::string& config,
std::string const& file);
void AddInstallNamePatchRule(std::ostream& os, Indent const& indent,
const char* config,
const std::string& config,
const std::string& toDestDirPath);
void AddChrpathPatchRule(std::ostream& os, Indent const& indent,
const char* config,
const std::string& config,
std::string const& toDestDirPath);
void AddRPathCheckRule(std::ostream& os, Indent const& indent,
const char* config,
const std::string& config,
std::string const& toDestDirPath);
void AddStripRule(std::ostream& os, Indent const& indent,

View File

@ -280,7 +280,7 @@ void cmLocalGenerator::GenerateTestFiles()
// Compute the set of configurations.
std::vector<std::string> configurationTypes;
const char* config =
const std::string& config =
this->Makefile->GetConfigurations(configurationTypes, false);
std::string file = this->Makefile->GetStartOutputDirectory();
@ -384,11 +384,11 @@ void cmLocalGenerator::GenerateInstallRules()
// Compute the set of configurations.
std::vector<std::string> configurationTypes;
const char* config =
const std::string& config =
this->Makefile->GetConfigurations(configurationTypes, false);
// Choose a default install configuration.
const char* default_config = config;
const char* default_config = config.c_str();
const char* default_order[] = {"RELEASE", "MINSIZEREL",
"RELWITHDEBINFO", "DEBUG", 0};
for(const char** c = default_order; *c && !default_config; ++c)
@ -557,7 +557,7 @@ void cmLocalGenerator::GenerateTargetManifest()
}
if(configNames.empty())
{
target.GenerateTargetManifest(0);
target.GenerateTargetManifest("");
}
else
{
@ -712,8 +712,8 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang,
vars.LinkFlags = linkFlags.c_str();
std::string langFlags;
this->AddLanguageFlags(langFlags, llang, 0);
this->AddArchitectureFlags(langFlags, &target, llang, 0);
this->AddLanguageFlags(langFlags, llang, "");
this->AddArchitectureFlags(langFlags, &target, llang, "");
vars.LanguageCompileFlags = langFlags.c_str();
cmCustomCommandLines commandLines;
@ -1292,7 +1292,7 @@ std::string cmLocalGenerator::GetIncludeFlags(
cmGeneratorTarget* target,
const std::string& lang,
bool forResponseFile,
const char *config)
const std::string& config)
{
if(lang.empty())
{
@ -1370,7 +1370,7 @@ std::string cmLocalGenerator::GetIncludeFlags(
if(!flagUsed || repeatFlag)
{
if(sysIncludeFlag && target &&
target->IsSystemIncludeDirectory(i->c_str(), config))
target->IsSystemIncludeDirectory(*i, config))
{
includeFlags << sysIncludeFlag;
}
@ -1405,7 +1405,7 @@ std::string cmLocalGenerator::GetIncludeFlags(
//----------------------------------------------------------------------------
void cmLocalGenerator::AddCompileDefinitions(std::set<std::string>& defines,
cmTarget const* target,
const char* config)
const std::string& config)
{
std::vector<std::string> targetDefines;
target->GetCompileDefinitions(targetDefines,
@ -1416,7 +1416,7 @@ void cmLocalGenerator::AddCompileDefinitions(std::set<std::string>& defines,
//----------------------------------------------------------------------------
void cmLocalGenerator::AddCompileOptions(
std::string& flags, cmTarget* target,
const std::string& lang, const char* config
const std::string& lang, const std::string& config
)
{
std::string langFlagRegexVar = std::string("CMAKE_")+lang+"_FLAG_REGEX";
@ -1465,7 +1465,7 @@ void cmLocalGenerator::AddCompileOptions(
void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
cmGeneratorTarget* target,
const std::string& lang,
const char *config,
const std::string& config,
bool stripImplicitInclDirs
)
{
@ -1698,7 +1698,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
target->Target->GetName().c_str());
return;
}
this->AddLanguageFlags(flags, linkLanguage, buildType.c_str());
this->AddLanguageFlags(flags, linkLanguage, buildType);
this->OutputLinkLibraries(linkLibs, frameworkPath, linkPath,
*target, false, false);
if(cmSystemTools::IsOn
@ -1945,7 +1945,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
cmGeneratorTarget* target,
const std::string& lang,
const char* config)
const std::string& config)
{
// Only add Mac OS X specific flags on Darwin platforms (OSX and iphone):
if(!this->Makefile->IsOn("APPLE"))
@ -2002,7 +2002,7 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags,
//----------------------------------------------------------------------------
void cmLocalGenerator::AddLanguageFlags(std::string& flags,
const std::string& lang,
const char* config)
const std::string& config)
{
// Add language-specific flags.
std::string flagsVar = "CMAKE_";
@ -2013,7 +2013,7 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
//----------------------------------------------------------------------------
bool cmLocalGenerator::GetRealDependency(const std::string& inName,
const char* config,
const std::string& config,
std::string& dep)
{
// Older CMake code may specify the dependency using the target
@ -2211,7 +2211,7 @@ void cmLocalGenerator
//----------------------------------------------------------------------------
void cmLocalGenerator::AddCMP0018Flags(std::string &flags, cmTarget* target,
std::string const& lang,
const char *config)
const std::string& config)
{
int targetType = target->GetType();
@ -2327,13 +2327,13 @@ void cmLocalGenerator::AddPositionIndependentFlags(std::string& flags,
//----------------------------------------------------------------------------
void cmLocalGenerator::AddConfigVariableFlags(std::string& flags,
const std::string& var,
const char* config)
const std::string& config)
{
// Add the flags from the variable itself.
std::string flagsVar = var;
this->AppendFlags(flags, this->Makefile->GetDefinition(flagsVar.c_str()));
// Add the flags from the build-type specific variable.
if(config && *config)
if(!config.empty())
{
flagsVar += "_";
flagsVar += cmSystemTools::UpperCase(config);
@ -2837,7 +2837,7 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector<std::string>& local,
void
cmLocalGenerator
::GenerateTargetInstallRules(
std::ostream& os, const char* config,
std::ostream& os, const std::string& config,
std::vector<std::string> const& configurationTypes)
{
// Convert the old-style install specification from each target to

View File

@ -138,16 +138,16 @@ public:
void AddArchitectureFlags(std::string& flags, cmGeneratorTarget* target,
const std::string&lang, const char* config);
const std::string&lang, const std::string& config);
void AddLanguageFlags(std::string& flags, const std::string& lang,
const char* config);
const std::string& config);
void AddCMP0018Flags(std::string &flags, cmTarget* target,
std::string const& lang, const char *config);
std::string const& lang, const std::string& config);
void AddVisibilityPresetFlags(std::string &flags, cmTarget* target,
const std::string& lang);
void AddConfigVariableFlags(std::string& flags, const std::string& var,
const char* config);
const std::string& config);
///! Append flags to a string.
virtual void AppendFlags(std::string& flags, const char* newFlags);
virtual void AppendFlagEscape(std::string& flags,
@ -157,7 +157,7 @@ public:
cmGeneratorTarget* target,
const std::string& lang,
bool forResponseFile = false,
const char *config = 0);
const std::string& config = "");
/**
* Encode a list of preprocessor definitions for the compiler
@ -196,7 +196,7 @@ public:
* the source directory of this generator. This should only be
* used for dependencies of custom commands.
*/
bool GetRealDependency(const std::string& name, const char* config,
bool GetRealDependency(const std::string& name, const std::string& config,
std::string& dep);
///! for existing files convert to output path and short path if spaces
@ -227,13 +227,13 @@ public:
void GetIncludeDirectories(std::vector<std::string>& dirs,
cmGeneratorTarget* target,
const std::string& lang = "C",
const char *config = 0,
const std::string& config = "",
bool stripImplicitInclDirs = true);
void AddCompileOptions(std::string& flags, cmTarget* target,
const std::string& lang, const char* config);
const std::string& lang, const std::string& config);
void AddCompileDefinitions(std::set<std::string>& defines,
cmTarget const* target,
const char* config);
const std::string& config);
/** Compute the language used to compile the given source file. */
std::string GetSourceFileLanguage(const cmSourceFile& source);
@ -410,7 +410,7 @@ protected:
// Handle old-style install rules stored in the targets.
void GenerateTargetInstallRules(
std::ostream& os, const char* config,
std::ostream& os, const std::string& config,
std::vector<std::string> const& configurationTypes);
std::string& CreateSafeUniqueObjectFileName(const std::string& sin,

View File

@ -38,7 +38,7 @@ class cmLocalVisualStudio6Generator::EventWriter
{
public:
EventWriter(cmLocalVisualStudio6Generator* lg,
const char* config, std::string& code):
const std::string& config, std::string& code):
LG(lg), Config(config), Code(code), First(true) {}
void Start(const char* event)
{
@ -72,7 +72,7 @@ public:
}
private:
cmLocalVisualStudio6Generator* LG;
const char* Config;
std::string Config;
std::string& Code;
bool First;
std::string Event;
@ -785,7 +785,7 @@ void cmLocalVisualStudio6Generator::SetBuildType(BuildType b,
//----------------------------------------------------------------------------
cmsys::auto_ptr<cmCustomCommand>
cmLocalVisualStudio6Generator::MaybeCreateOutputDir(cmTarget& target,
const char* config)
const std::string& config)
{
cmsys::auto_ptr<cmCustomCommand> pcc;
@ -813,7 +813,7 @@ cmLocalVisualStudio6Generator::MaybeCreateOutputDir(cmTarget& target,
// look for custom rules on a target and collect them together
std::string
cmLocalVisualStudio6Generator::CreateTargetRules(cmTarget &target,
const char* configName,
const std::string& configName,
const std::string& /* libName */)
{
if (target.GetType() >= cmTarget::UTILITY )
@ -863,7 +863,7 @@ inline std::string removeQuotes(const std::string& s)
std::string
cmLocalVisualStudio6Generator::GetTargetIncludeOptions(cmTarget &target,
const char *config)
const std::string& config)
{
std::string includeOptions;
@ -1704,7 +1704,7 @@ void cmLocalVisualStudio6Generator
flagsRelWithDebInfo = this->Makefile->GetSafeDefinition(flagVar.c_str());
flagsRelWithDebInfo += " -DCMAKE_INTDIR=\\\"RelWithDebInfo\\\" ";
this->AddCompileOptions(flags, &target, linkLanguage, 0);
this->AddCompileOptions(flags, &target, linkLanguage, "");
this->AddCompileOptions(flagsDebug, &target, linkLanguage, "Debug");
this->AddCompileOptions(flagsRelease, &target, linkLanguage, "Release");
this->AddCompileOptions(flagsMinSizeRel, &target, linkLanguage,
@ -1730,7 +1730,7 @@ void cmLocalVisualStudio6Generator
std::set<std::string> minsizeDefinesSet;
std::set<std::string> debugrelDefinesSet;
this->AddCompileDefinitions(definesSet, &target, 0);
this->AddCompileDefinitions(definesSet, &target, "");
this->AddCompileDefinitions(debugDefinesSet, &target, "DEBUG");
this->AddCompileDefinitions(releaseDefinesSet, &target, "RELEASE");
this->AddCompileDefinitions(minsizeDefinesSet, &target, "MINSIZEREL");
@ -1800,7 +1800,7 @@ void cmLocalVisualStudio6Generator::WriteDSPFooter(std::ostream& fout)
//----------------------------------------------------------------------------
void cmLocalVisualStudio6Generator
::ComputeLinkOptions(cmTarget& target,
const char* configName,
const std::string& configName,
const std::string extraOptions,
std::string& options)
{

View File

@ -81,16 +81,17 @@ private:
class EventWriter;
friend class EventWriter;
cmsys::auto_ptr<cmCustomCommand>
MaybeCreateOutputDir(cmTarget& target, const char* config);
MaybeCreateOutputDir(cmTarget& target, const std::string& config);
std::string CreateTargetRules(cmTarget &target,
const char* configName,
const std::string& configName,
const std::string& libName);
void ComputeLinkOptions(cmTarget& target, const char* configName,
void ComputeLinkOptions(cmTarget& target, const std::string& configName,
const std::string extraOptions,
std::string& options);
void OutputObjects(cmTarget& target, const char* tool,
std::string& options);
std::string GetTargetIncludeOptions(cmTarget &target, const char *config);
std::string GetTargetIncludeOptions(cmTarget &target,
const std::string& config);
std::vector<std::string> Configurations;
std::string GetConfigName(std::string const& configuration) const;

View File

@ -588,7 +588,7 @@ class cmLocalVisualStudio7Generator::EventWriter
{
public:
EventWriter(cmLocalVisualStudio7Generator* lg,
const char* config, std::ostream& os):
const std::string& config, std::ostream& os):
LG(lg), Config(config), Stream(os), First(true) {}
void Start(const char* tool)
{
@ -629,14 +629,14 @@ public:
}
private:
cmLocalVisualStudio7Generator* LG;
const char* Config;
std::string Config;
std::ostream& Stream;
bool First;
};
//----------------------------------------------------------------------------
void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
const char* configName,
const std::string& configName,
const std::string& libName,
cmTarget &target)
{
@ -745,7 +745,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
table,
this->ExtraFlagTable);
targetOptions.FixExceptionHandlingDefault();
std::string asmLocation = std::string(configName) + "/";
std::string asmLocation = configName + "/";
targetOptions.AddFlag("AssemblerListingLocation", asmLocation.c_str());
targetOptions.Parse(flags.c_str());
targetOptions.Parse(defineFlags.c_str());
@ -944,7 +944,8 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
//----------------------------------------------------------------------------
std::string
cmLocalVisualStudio7Generator
::GetBuildTypeLinkerFlags(std::string rootLinkerFlags, const char* configName)
::GetBuildTypeLinkerFlags(std::string rootLinkerFlags,
const std::string& configName)
{
std::string configTypeUpper = cmSystemTools::UpperCase(configName);
std::string extraLinkOptionsBuildTypeDef =
@ -958,7 +959,8 @@ cmLocalVisualStudio7Generator
}
void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
const char* configName, cmTarget &target, const Options& targetOptions)
const std::string& configName, cmTarget &target,
const Options& targetOptions)
{
cmGlobalVisualStudio7Generator* gg =
static_cast<cmGlobalVisualStudio7Generator*>(this->GlobalGenerator);
@ -1903,7 +1905,7 @@ void cmLocalVisualStudio7Generator::WriteVCProjEndGroup(std::ostream& fout)
// look for custom rules on a target and collect them together
void cmLocalVisualStudio7Generator
::OutputTargetRules(std::ostream& fout,
const char* configName,
const std::string& configName,
cmTarget &target,
const std::string& /*libName*/)
{

View File

@ -71,7 +71,7 @@ private:
typedef cmVisualStudioGeneratorOptions Options;
typedef cmLocalVisualStudio7GeneratorFCInfo FCInfo;
std::string GetBuildTypeLinkerFlags(std::string rootLinkerFlags,
const char* configName);
const std::string& configName);
void FixGlobalTargets();
void WriteProjectFiles();
void WriteVCProjHeader(std::ostream& fout, const std::string& libName,
@ -82,14 +82,14 @@ private:
void WriteConfigurations(std::ostream& fout,
const std::string& libName, cmTarget &tgt);
void WriteConfiguration(std::ostream& fout,
const char* configName,
const std::string& configName,
const std::string& libName, cmTarget &tgt);
std::string EscapeForXML(const std::string& s);
std::string ConvertToXMLOutputPath(const char* path);
std::string ConvertToXMLOutputPathSingle(const char* path);
void OutputTargetRules(std::ostream& fout, const char* configName,
void OutputTargetRules(std::ostream& fout, const std::string& configName,
cmTarget &target, const std::string& libName);
void OutputBuildTool(std::ostream& fout, const char* configName,
void OutputBuildTool(std::ostream& fout, const std::string& configName,
cmTarget& t, const Options& targetOptions);
void OutputLibraryDirectories(std::ostream& fout,
std::vector<std::string> const& dirs);

View File

@ -33,7 +33,7 @@ cmLocalVisualStudioGenerator::~cmLocalVisualStudioGenerator()
//----------------------------------------------------------------------------
cmsys::auto_ptr<cmCustomCommand>
cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmTarget& target,
const char* config,
const std::string& config,
bool isFortran)
{
cmsys::auto_ptr<cmCustomCommand> pcc;
@ -80,7 +80,7 @@ const char* cmLocalVisualStudioGenerator::GetReportErrorLabel() const
std::string
cmLocalVisualStudioGenerator
::ConstructScript(cmCustomCommand const& cc,
const char* configName,
const std::string& configName,
const char* newline_text)
{
bool useLocal = this->CustomCommandUseLocal();

View File

@ -47,7 +47,7 @@ public:
/** Construct a script from the given list of command lines. */
std::string ConstructScript(cmCustomCommand const& cc,
const char* configName,
const std::string& configName,
const char* newline = "\n");
/** Label to which to jump in a batch file after a failed step in a
@ -67,7 +67,8 @@ protected:
/** Construct a custom command to make exe import lib dir. */
cmsys::auto_ptr<cmCustomCommand>
MaybeCreateImplibDir(cmTarget& target, const char* config, bool isFortran);
MaybeCreateImplibDir(cmTarget& target, const std::string& config,
bool isFortran);
VSVersion Version;
};

View File

@ -54,7 +54,7 @@ void cmLocalXCodeGenerator::Generate()
iter != targets.end(); ++iter)
{
cmTarget* t = &iter->second;
t->HasMacOSXRpathInstallNameDir(NULL);
t->HasMacOSXRpathInstallNameDir("");
}
}
@ -68,6 +68,6 @@ void cmLocalXCodeGenerator::GenerateInstallRules()
iter != targets.end(); ++iter)
{
cmTarget* t = &iter->second;
t->HasMacOSXRpathInstallNameDir(NULL);
t->HasMacOSXRpathInstallNameDir("");
}
}

View File

@ -2734,7 +2734,7 @@ void cmMakefile::AddDefaultDefinitions()
}
//----------------------------------------------------------------------------
const char*
std::string
cmMakefile::GetConfigurations(std::vector<std::string>& configs,
bool single) const
{
@ -2745,12 +2745,12 @@ cmMakefile::GetConfigurations(std::vector<std::string>& configs,
{
cmSystemTools::ExpandListArgument(configTypes, configs);
}
return 0;
return "";
}
else
{
const char* buildType = this->GetDefinition("CMAKE_BUILD_TYPE");
if(single && buildType && *buildType)
const std::string& buildType = this->GetSafeDefinition("CMAKE_BUILD_TYPE");
if(single && !buildType.empty())
{
configs.push_back(buildType);
}
@ -3801,11 +3801,12 @@ bool cmMakefile::GetPropertyAsBool(const std::string& prop) const
}
//----------------------------------------------------------------------------
const char* cmMakefile::GetFeature(const char* feature, const char* config)
const char* cmMakefile::GetFeature(const char* feature,
const std::string& config)
{
// TODO: Define accumulation policy for features (prepend, append, replace).
// Currently we always replace.
if(config && *config)
if(!config.empty())
{
std::string featureConfig = feature;
featureConfig += "_";

View File

@ -320,7 +320,7 @@ public:
}
/** Get the configurations to be generated. */
const char* GetConfigurations(std::vector<std::string>& configs,
std::string GetConfigurations(std::vector<std::string>& configs,
bool single = true) const;
/**
@ -811,7 +811,7 @@ public:
cmProperty::ScopeType scope) const;
bool GetPropertyAsBool(const std::string& prop) const;
const char* GetFeature(const char* feature, const char* config);
const char* GetFeature(const char* feature, const std::string& config);
// Get the properties
cmPropertyMap &GetProperties() { return this->Properties; };

View File

@ -133,7 +133,8 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
this->Makefile->GetProperty
("ADDITIONAL_MAKE_CLEAN_FILES"))
{
const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE");
const std::string& config =
this->Makefile->GetDefinition("CMAKE_BUILD_TYPE");
cmListFileBacktrace lfbt;
cmGeneratorExpression ge(lfbt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
@ -1070,7 +1071,8 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
<< "set(CMAKE_C_TARGET_INCLUDE_PATH\n";
std::vector<std::string> includes;
const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE");
const std::string& config =
this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
this->LocalGenerator->GetIncludeDirectories(includes,
this->GeneratorTarget,
"C", config);
@ -1567,7 +1569,8 @@ std::string cmMakefileTargetGenerator::GetFrameworkFlags(std::string const& l)
#endif
std::vector<std::string> includes;
const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE");
const std::string& config =
this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
this->LocalGenerator->GetIncludeDirectories(includes,
this->GeneratorTarget,
"C", config);
@ -1952,7 +1955,8 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags,
std::vector<std::string> includes;
const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE");
const std::string& config =
this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
this->LocalGenerator->GetIncludeDirectories(includes,
this->GeneratorTarget,
lang, config);
@ -2059,7 +2063,8 @@ void cmMakefileTargetGenerator::AddFortranFlags(std::string& flags)
this->Makefile->GetDefinition("CMAKE_Fortran_MODPATH_FLAG"))
{
std::vector<std::string> includes;
const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE");
const std::string& config =
this->Makefile->GetDefinition("CMAKE_BUILD_TYPE");
this->LocalGenerator->GetIncludeDirectories(includes,
this->GeneratorTarget,
"C", config);

View File

@ -183,7 +183,7 @@ protected:
cmLocalUnixMakefileGenerator3 *LocalGenerator;
cmGlobalUnixMakefileGenerator3 *GlobalGenerator;
cmMakefile *Makefile;
const char *ConfigName;
std::string ConfigName;
enum CustomCommandDriveType { OnBuild, OnDepends, OnUtility };
CustomCommandDriveType CustomCommandDriver;

View File

@ -19,7 +19,7 @@
//----------------------------------------------------------------------------
cmOSXBundleGenerator::
cmOSXBundleGenerator(cmGeneratorTarget* target,
const char* configName)
const std::string& configName)
: GT(target)
, Makefile(target->Target->GetMakefile())
, LocalGenerator(Makefile->GetLocalGenerator())

View File

@ -27,7 +27,7 @@ class cmOSXBundleGenerator
{
public:
cmOSXBundleGenerator(cmGeneratorTarget* target,
const char* configName);
const std::string& configName);
// create an app bundle at a given root, and return
// the directory within the bundle that contains the executable
@ -62,7 +62,7 @@ private:
cmGeneratorTarget* GT;
cmMakefile* Makefile;
cmLocalGenerator* LocalGenerator;
const char* ConfigName;
std::string ConfigName;
std::set<std::string>* MacContentFolders;
};

View File

@ -306,7 +306,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target)
}
static void GetCompileDefinitionsAndDirectories(cmTarget const* target,
const char * config,
const std::string& config,
std::string &incs,
std::string &defs)
{
@ -366,7 +366,7 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target)
qtVersion = makefile->GetDefinition("QT_VERSION_MAJOR");
}
if (const char *targetQtVersion =
target->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", 0))
target->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", ""))
{
qtVersion = targetQtVersion;
}
@ -563,7 +563,7 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target,
std::string _moc_incs;
std::string _moc_compile_defs;
std::vector<std::string> configs;
const char *config = makefile->GetConfigurations(configs);
const std::string& config = makefile->GetConfigurations(configs);
GetCompileDefinitionsAndDirectories(target, config,
_moc_incs, _moc_compile_defs);
@ -675,7 +675,7 @@ void cmQtAutoGenerators::MergeUicOptions(std::vector<std::string> &opts,
opts.insert(opts.end(), extraOpts.begin(), extraOpts.end());
}
static void GetUicOpts(cmTarget const* target, const char * config,
static void GetUicOpts(cmTarget const* target, const std::string& config,
std::string &optString)
{
std::vector<std::string> opts;
@ -717,7 +717,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target,
std::string _uic_opts;
std::vector<std::string> configs;
const char *config = makefile->GetConfigurations(configs);
const std::string& config = makefile->GetConfigurations(configs);
GetUicOpts(target, config, _uic_opts);
if (!_uic_opts.empty())
@ -967,7 +967,8 @@ static cmGlobalGenerator* CreateGlobalGenerator(cmake* cm,
return gg;
}
bool cmQtAutoGenerators::Run(const char* targetDirectory, const char *config)
bool cmQtAutoGenerators::Run(const char* targetDirectory,
const std::string& config)
{
bool success = true;
cmake cm;
@ -994,7 +995,7 @@ bool cmQtAutoGenerators::Run(const char* targetDirectory, const char *config)
bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile,
const char* targetDirectory,
const char *config)
const std::string& config)
{
std::string filename(cmSystemTools::CollapseFullPath(targetDirectory));
cmSystemTools::ConvertToUnixSlashes(filename);
@ -1027,7 +1028,7 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile,
{
std::string compileDefsPropOrig = "AM_MOC_COMPILE_DEFINITIONS";
std::string compileDefsProp = compileDefsPropOrig;
if(config)
if(!config.empty())
{
compileDefsProp += "_";
compileDefsProp += config;
@ -1039,7 +1040,7 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile,
{
std::string includesPropOrig = "AM_MOC_INCLUDES";
std::string includesProp = includesPropOrig;
if(config)
if(!config.empty())
{
includesProp += "_";
includesProp += config;
@ -1058,7 +1059,7 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile,
= makefile->GetSafeDefinition("AM_UIC_OPTIONS_FILES");
std::string uicOptionsPropOrig = "AM_UIC_TARGET_OPTIONS";
std::string uicOptionsProp = uicOptionsPropOrig;
if(config)
if(!config.empty())
{
uicOptionsProp += "_";
uicOptionsProp += config;

View File

@ -21,7 +21,7 @@ class cmQtAutoGenerators
{
public:
cmQtAutoGenerators();
bool Run(const char* targetDirectory, const char *config);
bool Run(const char* targetDirectory, const std::string& config);
bool InitializeAutogenTarget(cmTarget* target);
void SetupAutoGenerateTarget(cmTarget const* target);
@ -38,7 +38,7 @@ private:
bool ReadAutogenInfoFile(cmMakefile* makefile,
const char* targetDirectory,
const char *config);
const std::string& config);
bool ReadOldMocDefinitionsFile(cmMakefile* makefile,
const char* targetDirectory);
void WriteOldMocDefinitionsFile(const char* targetDirectory);

View File

@ -19,7 +19,7 @@ cmScriptGenerator
std::vector<std::string> const& configurations):
RuntimeConfigVariable(config_var),
Configurations(configurations),
ConfigurationName(0),
ConfigurationName(""),
ConfigurationTypes(0),
ActionsPerConfig(false)
{
@ -34,21 +34,21 @@ cmScriptGenerator
//----------------------------------------------------------------------------
void
cmScriptGenerator
::Generate(std::ostream& os, const char* config,
::Generate(std::ostream& os, const std::string& config,
std::vector<std::string> const& configurationTypes)
{
this->ConfigurationName = config;
this->ConfigurationTypes = &configurationTypes;
this->GenerateScript(os);
this->ConfigurationName = 0;
this->ConfigurationName = "";
this->ConfigurationTypes = 0;
}
//----------------------------------------------------------------------------
static void cmScriptGeneratorEncodeConfig(const char* config,
static void cmScriptGeneratorEncodeConfig(const std::string& config,
std::string& result)
{
for(const char* c = config; *c; ++c)
for(const char* c = config.c_str(); *c; ++c)
{
if(*c >= 'a' && *c <= 'z')
{
@ -73,12 +73,12 @@ static void cmScriptGeneratorEncodeConfig(const char* config,
//----------------------------------------------------------------------------
std::string
cmScriptGenerator::CreateConfigTest(const char* config)
cmScriptGenerator::CreateConfigTest(const std::string& config)
{
std::string result = "\"${";
result += this->RuntimeConfigVariable;
result += "}\" MATCHES \"^(";
if(config && *config)
if(!config.empty())
{
cmScriptGeneratorEncodeConfig(config, result);
}
@ -142,14 +142,15 @@ void cmScriptGenerator::GenerateScriptActions(std::ostream& os,
}
//----------------------------------------------------------------------------
void cmScriptGenerator::GenerateScriptForConfig(std::ostream&, const char*,
void cmScriptGenerator::GenerateScriptForConfig(std::ostream&,
const std::string&,
Indent const&)
{
// No actions for this generator.
}
//----------------------------------------------------------------------------
bool cmScriptGenerator::GeneratesForConfig(const char* config)
bool cmScriptGenerator::GeneratesForConfig(const std::string& config)
{
// If this is not a configuration-specific rule then we install.
if(this->Configurations.empty())
@ -159,7 +160,7 @@ bool cmScriptGenerator::GeneratesForConfig(const char* config)
// This is a configuration-specific rule. Check if the config
// matches this rule.
std::string config_upper = cmSystemTools::UpperCase(config?config:"");
std::string config_upper = cmSystemTools::UpperCase(config);
for(std::vector<std::string>::const_iterator i =
this->Configurations.begin();
i != this->Configurations.end(); ++i)

View File

@ -51,7 +51,7 @@ public:
std::vector<std::string> const& configurations);
virtual ~cmScriptGenerator();
void Generate(std::ostream& os, const char* config,
void Generate(std::ostream& os, const std::string& config,
std::vector<std::string> const& configurationTypes);
const std::vector<std::string>& GetConfigurations() const
@ -63,15 +63,15 @@ protected:
virtual void GenerateScriptConfigs(std::ostream& os, Indent const& indent);
virtual void GenerateScriptActions(std::ostream& os, Indent const& indent);
virtual void GenerateScriptForConfig(std::ostream& os,
const char* config,
const std::string& config,
Indent const& indent);
virtual void GenerateScriptNoConfig(std::ostream&, Indent const&) {}
virtual bool NeedsScriptNoConfig() const { return false; }
// Test if this generator does something for a given configuration.
bool GeneratesForConfig(const char*);
bool GeneratesForConfig(const std::string&);
std::string CreateConfigTest(const char* config);
std::string CreateConfigTest(const std::string& config);
std::string CreateConfigTest(std::vector<std::string> const& configs);
std::string CreateComponentTest(const char* component);
@ -80,7 +80,7 @@ protected:
std::vector<std::string> const Configurations;
// Information used during generation.
const char* ConfigurationName;
std::string ConfigurationName;
std::vector<std::string> const* ConfigurationTypes;
// True if the subclass needs to generate an explicit rule for each

View File

@ -109,7 +109,8 @@ public:
const char* ExplicitLibraries;
};
void ComputeLinkInterface(cmTarget const* thisTarget,
const char* config, OptionalLinkInterface& iface,
const std::string& config,
OptionalLinkInterface& iface,
cmTarget const* head,
const char *explicitLibraries) const;
@ -692,10 +693,11 @@ const std::vector<std::string>& cmTarget::GetLinkDirectories() const
}
//----------------------------------------------------------------------------
cmTarget::LinkLibraryType cmTarget::ComputeLinkType(const char* config) const
cmTarget::LinkLibraryType cmTarget::ComputeLinkType(
const std::string& config) const
{
// No configuration is always optimized.
if(!(config && *config))
if(config.empty())
{
return cmTarget::OPTIMIZED;
}
@ -755,7 +757,7 @@ bool cmTarget::NameResolvesToFramework(const std::string& libname) const
}
//----------------------------------------------------------------------------
void cmTarget::GetDirectLinkLibraries(const char *config,
void cmTarget::GetDirectLinkLibraries(const std::string& config,
std::vector<std::string> &libs,
cmTarget const* head) const
{
@ -789,7 +791,7 @@ void cmTarget::GetDirectLinkLibraries(const char *config,
}
//----------------------------------------------------------------------------
void cmTarget::GetInterfaceLinkLibraries(const char *config,
void cmTarget::GetInterfaceLinkLibraries(const std::string& config,
std::vector<std::string> &libs,
cmTarget const* head) const
{
@ -1565,7 +1567,7 @@ static void processIncludeDirectories(cmTarget const* tgt,
std::vector<std::string> &includes,
std::set<std::string> &uniqueIncludes,
cmGeneratorExpressionDAGChecker *dagChecker,
const char *config, bool debugIncludes)
const std::string& config, bool debugIncludes)
{
cmMakefile *mf = tgt->GetMakefile();
@ -1730,7 +1732,7 @@ static void processIncludeDirectories(cmTarget const* tgt,
//----------------------------------------------------------------------------
std::vector<std::string>
cmTarget::GetIncludeDirectories(const char *config) const
cmTarget::GetIncludeDirectories(const std::string& config) const
{
std::vector<std::string> includes;
std::set<std::string> uniqueIncludes;
@ -1767,8 +1769,7 @@ cmTarget::GetIncludeDirectories(const char *config) const
config,
debugIncludes);
std::string configString = config ? config : "";
if (!this->Internal->CacheLinkInterfaceIncludeDirectoriesDone[configString])
if (!this->Internal->CacheLinkInterfaceIncludeDirectoriesDone[config])
{
for (std::vector<cmValueWithOrigin>::const_iterator
it = this->Internal->LinkImplementationPropertyEntries.begin(),
@ -1805,7 +1806,7 @@ cmTarget::GetIncludeDirectories(const char *config) const
includeGenex);
this->Internal
->CachedLinkInterfaceIncludeDirectoriesEntries[configString].push_back(
->CachedLinkInterfaceIncludeDirectoriesEntries[config].push_back(
new cmTargetInternals::TargetPropertyEntry(cge,
it->Value));
}
@ -1833,14 +1834,14 @@ cmTarget::GetIncludeDirectories(const char *config) const
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
ge.Parse(libDir.c_str());
this->Internal
->CachedLinkInterfaceIncludeDirectoriesEntries[configString]
->CachedLinkInterfaceIncludeDirectoriesEntries[config]
.push_back(new cmTargetInternals::TargetPropertyEntry(cge));
}
}
}
processIncludeDirectories(this,
this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries[configString],
this->Internal->CachedLinkInterfaceIncludeDirectoriesEntries[config],
includes,
uniqueIncludes,
&dagChecker,
@ -1854,7 +1855,7 @@ cmTarget::GetIncludeDirectories(const char *config) const
}
else
{
this->Internal->CacheLinkInterfaceIncludeDirectoriesDone[configString]
this->Internal->CacheLinkInterfaceIncludeDirectoriesDone[config]
= true;
}
@ -1867,7 +1868,7 @@ static void processCompileOptionsInternal(cmTarget const* tgt,
std::vector<std::string> &options,
std::set<std::string> &uniqueOptions,
cmGeneratorExpressionDAGChecker *dagChecker,
const char *config, bool debugOptions, const char *logName)
const std::string& config, bool debugOptions, const char *logName)
{
cmMakefile *mf = tgt->GetMakefile();
@ -1926,7 +1927,7 @@ static void processCompileOptions(cmTarget const* tgt,
std::vector<std::string> &options,
std::set<std::string> &uniqueOptions,
cmGeneratorExpressionDAGChecker *dagChecker,
const char *config, bool debugOptions)
const std::string& config, bool debugOptions)
{
processCompileOptionsInternal(tgt, entries, options, uniqueOptions,
dagChecker, config, debugOptions, "options");
@ -1934,7 +1935,7 @@ static void processCompileOptions(cmTarget const* tgt,
//----------------------------------------------------------------------------
void cmTarget::GetAutoUicOptions(std::vector<std::string> &result,
const char *config) const
const std::string& config) const
{
const char *prop
= this->GetLinkInterfaceDependentStringProperty("AUTOUIC_OPTIONS",
@ -1960,7 +1961,7 @@ void cmTarget::GetAutoUicOptions(std::vector<std::string> &result,
//----------------------------------------------------------------------------
void cmTarget::GetCompileOptions(std::vector<std::string> &result,
const char *config) const
const std::string& config) const
{
std::set<std::string> uniqueOptions;
cmListFileBacktrace lfbt;
@ -1996,8 +1997,7 @@ void cmTarget::GetCompileOptions(std::vector<std::string> &result,
config,
debugOptions);
std::string configString = config ? config : "";
if (!this->Internal->CacheLinkInterfaceCompileOptionsDone[configString])
if (!this->Internal->CacheLinkInterfaceCompileOptionsDone[config])
{
for (std::vector<cmValueWithOrigin>::const_iterator
it = this->Internal->LinkImplementationPropertyEntries.begin(),
@ -2034,14 +2034,14 @@ void cmTarget::GetCompileOptions(std::vector<std::string> &result,
optionGenex);
this->Internal
->CachedLinkInterfaceCompileOptionsEntries[configString].push_back(
->CachedLinkInterfaceCompileOptionsEntries[config].push_back(
new cmTargetInternals::TargetPropertyEntry(cge,
it->Value));
}
}
processCompileOptions(this,
this->Internal->CachedLinkInterfaceCompileOptionsEntries[configString],
this->Internal->CachedLinkInterfaceCompileOptionsEntries[config],
result,
uniqueOptions,
&dagChecker,
@ -2054,7 +2054,7 @@ void cmTarget::GetCompileOptions(std::vector<std::string> &result,
}
else
{
this->Internal->CacheLinkInterfaceCompileOptionsDone[configString] = true;
this->Internal->CacheLinkInterfaceCompileOptionsDone[config] = true;
}
}
@ -2064,7 +2064,7 @@ static void processCompileDefinitions(cmTarget const* tgt,
std::vector<std::string> &options,
std::set<std::string> &uniqueOptions,
cmGeneratorExpressionDAGChecker *dagChecker,
const char *config, bool debugOptions)
const std::string& config, bool debugOptions)
{
processCompileOptionsInternal(tgt, entries, options, uniqueOptions,
dagChecker, config, debugOptions,
@ -2073,7 +2073,7 @@ static void processCompileDefinitions(cmTarget const* tgt,
//----------------------------------------------------------------------------
void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
const char *config) const
const std::string& config) const
{
std::set<std::string> uniqueOptions;
cmListFileBacktrace lfbt;
@ -2109,8 +2109,7 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
config,
debugDefines);
std::string configString = config ? config : "";
if (!this->Internal->CacheLinkInterfaceCompileDefinitionsDone[configString])
if (!this->Internal->CacheLinkInterfaceCompileDefinitionsDone[config])
{
for (std::vector<cmValueWithOrigin>::const_iterator
it = this->Internal->LinkImplementationPropertyEntries.begin(),
@ -2147,11 +2146,11 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
defsGenex);
this->Internal
->CachedLinkInterfaceCompileDefinitionsEntries[configString].push_back(
->CachedLinkInterfaceCompileDefinitionsEntries[config].push_back(
new cmTargetInternals::TargetPropertyEntry(cge,
it->Value));
}
if (config)
if (!config.empty())
{
std::string configPropName = "COMPILE_DEFINITIONS_"
+ cmSystemTools::UpperCase(config);
@ -2174,7 +2173,7 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
ge.Parse(configProp);
this->Internal
->CachedLinkInterfaceCompileDefinitionsEntries[configString]
->CachedLinkInterfaceCompileDefinitionsEntries[config]
.push_back(new cmTargetInternals::TargetPropertyEntry(cge));
}
break;
@ -2189,7 +2188,7 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
}
processCompileDefinitions(this,
this->Internal->CachedLinkInterfaceCompileDefinitionsEntries[configString],
this->Internal->CachedLinkInterfaceCompileDefinitionsEntries[config],
list,
uniqueOptions,
&dagChecker,
@ -2203,7 +2202,7 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
}
else
{
this->Internal->CacheLinkInterfaceCompileDefinitionsDone[configString]
this->Internal->CacheLinkInterfaceCompileDefinitionsDone[config]
= true;
}
}
@ -2333,7 +2332,8 @@ bool cmTarget::HaveWellDefinedOutputFiles() const
}
//----------------------------------------------------------------------------
cmTarget::OutputInfo const* cmTarget::GetOutputInfo(const char* config) const
cmTarget::OutputInfo const* cmTarget::GetOutputInfo(
const std::string& config) const
{
// There is no output information for imported targets.
if(this->IsImported())
@ -2355,7 +2355,7 @@ cmTarget::OutputInfo const* cmTarget::GetOutputInfo(const char* config) const
// Lookup/compute/cache the output information for this configuration.
std::string config_upper;
if(config && *config)
if(!config.empty())
{
config_upper = cmSystemTools::UpperCase(config);
}
@ -2378,7 +2378,8 @@ cmTarget::OutputInfo const* cmTarget::GetOutputInfo(const char* config) const
}
//----------------------------------------------------------------------------
cmTarget::CompileInfo const* cmTarget::GetCompileInfo(const char* config) const
cmTarget::CompileInfo const* cmTarget::GetCompileInfo(
const std::string& config) const
{
// There is no compile information for imported targets.
if(this->IsImported())
@ -2399,7 +2400,7 @@ cmTarget::CompileInfo const* cmTarget::GetCompileInfo(const char* config) const
// Lookup/compute/cache the compile information for this configuration.
std::string config_upper;
if(config && *config)
if(!config.empty())
{
config_upper = cmSystemTools::UpperCase(config);
}
@ -2417,7 +2418,8 @@ cmTarget::CompileInfo const* cmTarget::GetCompileInfo(const char* config) const
}
//----------------------------------------------------------------------------
std::string cmTarget::GetDirectory(const char* config, bool implib) const
std::string cmTarget::GetDirectory(const std::string& config,
bool implib) const
{
if (this->IsImported())
{
@ -2435,7 +2437,7 @@ std::string cmTarget::GetDirectory(const char* config, bool implib) const
}
//----------------------------------------------------------------------------
std::string cmTarget::GetPDBDirectory(const char* config) const
std::string cmTarget::GetPDBDirectory(const std::string& config) const
{
if(OutputInfo const* info = this->GetOutputInfo(config))
{
@ -2446,7 +2448,7 @@ std::string cmTarget::GetPDBDirectory(const char* config) const
}
//----------------------------------------------------------------------------
std::string cmTarget::GetCompilePDBDirectory(const char* config) const
std::string cmTarget::GetCompilePDBDirectory(const std::string& config) const
{
if(CompileInfo const* info = this->GetCompileInfo(config))
{
@ -2456,7 +2458,7 @@ std::string cmTarget::GetCompilePDBDirectory(const char* config) const
}
//----------------------------------------------------------------------------
const char* cmTarget::GetLocation(const char* config) const
const char* cmTarget::GetLocation(const std::string& config) const
{
static std::string location;
if (this->IsImported())
@ -2547,9 +2549,10 @@ void cmTarget::GetTargetVersion(bool soversion,
}
//----------------------------------------------------------------------------
const char* cmTarget::GetFeature(const char* feature, const char* config) const
const char* cmTarget::GetFeature(const char* feature,
const std::string& config) const
{
if(config && *config)
if(!config.empty())
{
std::string featureConfig = feature;
featureConfig += "_";
@ -2798,7 +2801,8 @@ bool cmTarget::GetPropertyAsBool(const std::string& prop) const
class cmTargetCollectLinkLanguages
{
public:
cmTargetCollectLinkLanguages(cmTarget const* target, const char* config,
cmTargetCollectLinkLanguages(cmTarget const* target,
const std::string& config,
std::set<std::string>& languages,
cmTarget const* head):
Config(config), Languages(languages), HeadTarget(head),
@ -2870,7 +2874,7 @@ public:
}
}
private:
const char* Config;
std::string Config;
std::set<std::string>& Languages;
cmTarget const* HeadTarget;
cmMakefile* Makefile;
@ -2879,7 +2883,7 @@ private:
};
//----------------------------------------------------------------------------
std::string cmTarget::GetLinkerLanguage(const char* config,
std::string cmTarget::GetLinkerLanguage(const std::string& config,
cmTarget const* head) const
{
cmTarget const* headTarget = head ? head : this;
@ -2887,10 +2891,11 @@ std::string cmTarget::GetLinkerLanguage(const char* config,
}
//----------------------------------------------------------------------------
cmTarget::LinkClosure const* cmTarget::GetLinkClosure(const char* config,
cmTarget::LinkClosure const* cmTarget::GetLinkClosure(
const std::string& config,
cmTarget const* head) const
{
TargetConfigPair key(head, cmSystemTools::UpperCase(config ? config : ""));
TargetConfigPair key(head, cmSystemTools::UpperCase(config));
cmTargetInternals::LinkClosureMapType::iterator
i = this->Internal->LinkClosureMap.find(key);
if(i == this->Internal->LinkClosureMap.end())
@ -2957,7 +2962,7 @@ public:
};
//----------------------------------------------------------------------------
void cmTarget::ComputeLinkClosure(const char* config, LinkClosure& lc,
void cmTarget::ComputeLinkClosure(const std::string& config, LinkClosure& lc,
cmTarget const* head) const
{
// Get languages built in this target.
@ -3070,7 +3075,7 @@ const char* cmTarget::GetPrefixVariableInternal(bool implib) const
}
//----------------------------------------------------------------------------
std::string cmTarget::GetPDBName(const char* config) const
std::string cmTarget::GetPDBName(const std::string& config) const
{
std::string prefix;
std::string base;
@ -3078,8 +3083,7 @@ std::string cmTarget::GetPDBName(const char* config) const
this->GetFullNameInternal(config, false, prefix, base, suffix);
std::vector<std::string> props;
std::string configUpper =
cmSystemTools::UpperCase(config? config : "");
std::string configUpper = cmSystemTools::UpperCase(config);
if(!configUpper.empty())
{
// PDB_NAME_<CONFIG>
@ -3102,7 +3106,7 @@ std::string cmTarget::GetPDBName(const char* config) const
}
//----------------------------------------------------------------------------
std::string cmTarget::GetCompilePDBName(const char* config) const
std::string cmTarget::GetCompilePDBName(const std::string& config) const
{
std::string prefix;
std::string base;
@ -3110,7 +3114,7 @@ std::string cmTarget::GetCompilePDBName(const char* config) const
this->GetFullNameInternal(config, false, prefix, base, suffix);
// Check for a per-configuration output directory target property.
std::string configUpper = cmSystemTools::UpperCase(config? config : "");
std::string configUpper = cmSystemTools::UpperCase(config);
std::string configProp = "COMPILE_PDB_NAME_";
configProp += configUpper;
const char* config_name = this->GetProperty(configProp.c_str());
@ -3129,7 +3133,7 @@ std::string cmTarget::GetCompilePDBName(const char* config) const
}
//----------------------------------------------------------------------------
std::string cmTarget::GetCompilePDBPath(const char* config) const
std::string cmTarget::GetCompilePDBPath(const std::string& config) const
{
std::string dir = this->GetCompilePDBDirectory(config);
std::string name = this->GetCompilePDBName(config);
@ -3145,7 +3149,7 @@ std::string cmTarget::GetCompilePDBPath(const char* config) const
}
//----------------------------------------------------------------------------
bool cmTarget::HasSOName(const char* config) const
bool cmTarget::HasSOName(const std::string& config) const
{
// soname is supported only for shared libraries and modules,
// and then only when the platform supports an soname flag.
@ -3157,7 +3161,7 @@ bool cmTarget::HasSOName(const char* config) const
}
//----------------------------------------------------------------------------
std::string cmTarget::GetSOName(const char* config) const
std::string cmTarget::GetSOName(const std::string& config) const
{
if(this->IsImported())
{
@ -3199,7 +3203,7 @@ std::string cmTarget::GetSOName(const char* config) const
}
//----------------------------------------------------------------------------
bool cmTarget::HasMacOSXRpathInstallNameDir(const char* config) const
bool cmTarget::HasMacOSXRpathInstallNameDir(const std::string& config) const
{
bool install_name_is_rpath = false;
bool macosx_rpath = false;
@ -3311,7 +3315,8 @@ bool cmTarget::MacOSXRpathInstallNameDirDefault() const
}
//----------------------------------------------------------------------------
bool cmTarget::IsImportedSharedLibWithoutSOName(const char* config) const
bool cmTarget::IsImportedSharedLibWithoutSOName(
const std::string& config) const
{
if(this->IsImported() && this->GetType() == cmTarget::SHARED_LIBRARY)
{
@ -3324,7 +3329,7 @@ bool cmTarget::IsImportedSharedLibWithoutSOName(const char* config) const
}
//----------------------------------------------------------------------------
std::string cmTarget::NormalGetRealName(const char* config) const
std::string cmTarget::NormalGetRealName(const std::string& config) const
{
// This should not be called for imported targets.
// TODO: Split cmTarget into a class hierarchy to get compile-time
@ -3362,7 +3367,8 @@ std::string cmTarget::NormalGetRealName(const char* config) const
}
//----------------------------------------------------------------------------
std::string cmTarget::GetFullName(const char* config, bool implib) const
std::string cmTarget::GetFullName(const std::string& config,
bool implib) const
{
if(this->IsImported())
{
@ -3376,7 +3382,7 @@ std::string cmTarget::GetFullName(const char* config, bool implib) const
//----------------------------------------------------------------------------
std::string
cmTarget::GetFullNameImported(const char* config, bool implib) const
cmTarget::GetFullNameImported(const std::string& config, bool implib) const
{
return cmSystemTools::GetFilenameName(
this->ImportedGetFullPath(config, implib));
@ -3384,14 +3390,15 @@ cmTarget::GetFullNameImported(const char* config, bool implib) const
//----------------------------------------------------------------------------
void cmTarget::GetFullNameComponents(std::string& prefix, std::string& base,
std::string& suffix, const char* config,
std::string& suffix,
const std::string& config,
bool implib) const
{
this->GetFullNameInternal(config, implib, prefix, base, suffix);
}
//----------------------------------------------------------------------------
std::string cmTarget::GetFullPath(const char* config, bool implib,
std::string cmTarget::GetFullPath(const std::string& config, bool implib,
bool realname) const
{
if(this->IsImported())
@ -3405,8 +3412,8 @@ std::string cmTarget::GetFullPath(const char* config, bool implib,
}
//----------------------------------------------------------------------------
std::string cmTarget::NormalGetFullPath(const char* config, bool implib,
bool realname) const
std::string cmTarget::NormalGetFullPath(const std::string& config,
bool implib, bool realname) const
{
std::string fpath = this->GetDirectory(config, implib);
fpath += "/";
@ -3434,7 +3441,7 @@ std::string cmTarget::NormalGetFullPath(const char* config, bool implib,
//----------------------------------------------------------------------------
std::string
cmTarget::ImportedGetFullPath(const char* config, bool implib) const
cmTarget::ImportedGetFullPath(const std::string& config, bool implib) const
{
std::string result;
if(cmTarget::ImportInfo const* info = this->GetImportInfo(config, this))
@ -3451,7 +3458,7 @@ cmTarget::ImportedGetFullPath(const char* config, bool implib) const
//----------------------------------------------------------------------------
std::string
cmTarget::GetFullNameInternal(const char* config, bool implib) const
cmTarget::GetFullNameInternal(const std::string& config, bool implib) const
{
std::string prefix;
std::string base;
@ -3461,7 +3468,7 @@ cmTarget::GetFullNameInternal(const char* config, bool implib) const
}
//----------------------------------------------------------------------------
void cmTarget::GetFullNameInternal(const char* config,
void cmTarget::GetFullNameInternal(const std::string& config,
bool implib,
std::string& outPrefix,
std::string& outBase,
@ -3507,7 +3514,7 @@ void cmTarget::GetFullNameInternal(const char* config,
? this->GetProperty("IMPORT_SUFFIX")
: this->GetProperty("SUFFIX"));
const char* configPostfix = 0;
if(config && *config)
if(!config.empty())
{
std::string configProp = cmSystemTools::UpperCase(config);
configProp += "_POSTFIX";
@ -3604,7 +3611,7 @@ void cmTarget::GetLibraryNames(std::string& name,
std::string& realName,
std::string& impName,
std::string& pdbName,
const char* config) const
const std::string& config) const
{
// This should not be called for imported targets.
// TODO: Split cmTarget into a class hierarchy to get compile-time
@ -3708,7 +3715,7 @@ void cmTarget::GetExecutableNames(std::string& name,
std::string& realName,
std::string& impName,
std::string& pdbName,
const char* config) const
const std::string& config) const
{
// This should not be called for imported targets.
// TODO: Split cmTarget into a class hierarchy to get compile-time
@ -3804,7 +3811,7 @@ void cmTarget::SetPropertyDefault(const std::string& property,
}
//----------------------------------------------------------------------------
bool cmTarget::HaveBuildTreeRPATH(const char *config) const
bool cmTarget::HaveBuildTreeRPATH(const std::string& config) const
{
if (this->GetPropertyAsBool("SKIP_BUILD_RPATH"))
{
@ -3824,7 +3831,7 @@ bool cmTarget::HaveInstallTreeRPATH() const
}
//----------------------------------------------------------------------------
bool cmTarget::NeedRelinkBeforeInstall(const char* config) const
bool cmTarget::NeedRelinkBeforeInstall(const std::string& config) const
{
// Only executables and shared libraries can have an rpath and may
// need relinking.
@ -3888,7 +3895,8 @@ bool cmTarget::NeedRelinkBeforeInstall(const char* config) const
}
//----------------------------------------------------------------------------
std::string cmTarget::GetInstallNameDirForBuildTree(const char* config) const
std::string cmTarget::GetInstallNameDirForBuildTree(
const std::string& config) const
{
// If building directly for installation then the build tree install_name
// is the same as the install tree.
@ -4010,10 +4018,11 @@ const char* cmTarget::GetOutputTargetType(bool implib) const
}
//----------------------------------------------------------------------------
bool cmTarget::ComputeOutputDir(const char* config,
bool cmTarget::ComputeOutputDir(const std::string& config,
bool implib, std::string& out) const
{
bool usesDefaultOutputDir = false;
std::string conf = config;
// Look for a target property defining the target output directory
// based on the target type.
@ -4027,7 +4036,7 @@ bool cmTarget::ComputeOutputDir(const char* config,
}
// Check for a per-configuration output directory target property.
std::string configUpper = cmSystemTools::UpperCase(config? config : "");
std::string configUpper = cmSystemTools::UpperCase(conf);
const char* configProp = 0;
std::string configPropStr = targetTypeName;
if(!configPropStr.empty())
@ -4044,7 +4053,7 @@ bool cmTarget::ComputeOutputDir(const char* config,
out = config_outdir;
// Skip per-configuration subdirectory.
config = 0;
conf = "";
}
else if(const char* outdir = this->GetProperty(propertyName))
{
@ -4077,21 +4086,21 @@ bool cmTarget::ComputeOutputDir(const char* config,
(out.c_str(), this->Makefile->GetStartOutputDirectory()));
// The generator may add the configuration's subdirectory.
if(config && *config)
if(!conf.empty())
{
const char *platforms = this->Makefile->GetDefinition(
"CMAKE_XCODE_EFFECTIVE_PLATFORMS");
std::string suffix =
usesDefaultOutputDir && platforms ? "$(EFFECTIVE_PLATFORM_NAME)" : "";
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()->
AppendDirectoryForConfig("/", config, suffix.c_str(), out);
AppendDirectoryForConfig("/", conf, suffix.c_str(), out);
}
return usesDefaultOutputDir;
}
//----------------------------------------------------------------------------
bool cmTarget::ComputePDBOutputDir(const char* kind, const char* config,
bool cmTarget::ComputePDBOutputDir(const char* kind, const std::string& config,
std::string& out) const
{
// Look for a target property defining the target output directory
@ -4103,9 +4112,10 @@ bool cmTarget::ComputePDBOutputDir(const char* kind, const char* config,
propertyNameStr += "_OUTPUT_DIRECTORY";
propertyName = propertyNameStr.c_str();
}
std::string conf = config;
// Check for a per-configuration output directory target property.
std::string configUpper = cmSystemTools::UpperCase(config? config : "");
std::string configUpper = cmSystemTools::UpperCase(conf);
const char* configProp = 0;
std::string configPropStr = kind;
if(!configPropStr.empty())
@ -4122,7 +4132,7 @@ bool cmTarget::ComputePDBOutputDir(const char* kind, const char* config,
out = config_outdir;
// Skip per-configuration subdirectory.
config = 0;
conf = "";
}
else if(const char* outdir = this->GetProperty(propertyName))
{
@ -4141,27 +4151,29 @@ bool cmTarget::ComputePDBOutputDir(const char* kind, const char* config,
(out.c_str(), this->Makefile->GetStartOutputDirectory()));
// The generator may add the configuration's subdirectory.
if(config && *config)
if(!conf.empty())
{
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()->
AppendDirectoryForConfig("/", config, "", out);
AppendDirectoryForConfig("/", conf, "", out);
}
return true;
}
//----------------------------------------------------------------------------
bool cmTarget::UsesDefaultOutputDir(const char* config, bool implib) const
bool cmTarget::UsesDefaultOutputDir(const std::string& config,
bool implib) const
{
std::string dir;
return this->ComputeOutputDir(config, implib, dir);
}
//----------------------------------------------------------------------------
std::string cmTarget::GetOutputName(const char* config, bool implib) const
std::string cmTarget::GetOutputName(const std::string& config,
bool implib) const
{
std::vector<std::string> props;
std::string type = this->GetOutputTargetType(implib);
std::string configUpper = cmSystemTools::UpperCase(config? config : "");
std::string configUpper = cmSystemTools::UpperCase(config);
if(!type.empty() && !configUpper.empty())
{
// <ARCHIVE|LIBRARY|RUNTIME>_OUTPUT_NAME_<CONFIG>
@ -4495,7 +4507,7 @@ std::string compatibilityAgree(CompatibleType t, bool dominant)
template<typename PropertyType>
PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
const std::string &p,
const char *config,
const std::string& config,
const char *defaultValue,
CompatibleType t,
PropertyType *)
@ -4679,7 +4691,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt,
//----------------------------------------------------------------------------
bool cmTarget::GetLinkInterfaceDependentBoolProperty(const std::string &p,
const char *config) const
const std::string& config) const
{
return checkInterfacePropertyCompatibility<bool>(this, p, config, "FALSE",
BoolType, 0);
@ -4687,8 +4699,8 @@ bool cmTarget::GetLinkInterfaceDependentBoolProperty(const std::string &p,
//----------------------------------------------------------------------------
const char * cmTarget::GetLinkInterfaceDependentStringProperty(
const std::string &p,
const char *config) const
const std::string &p,
const std::string& config) const
{
return checkInterfacePropertyCompatibility<const char *>(this,
p,
@ -4699,8 +4711,8 @@ const char * cmTarget::GetLinkInterfaceDependentStringProperty(
//----------------------------------------------------------------------------
const char * cmTarget::GetLinkInterfaceDependentNumberMinProperty(
const std::string &p,
const char *config) const
const std::string &p,
const std::string& config) const
{
return checkInterfacePropertyCompatibility<const char *>(this,
p,
@ -4711,8 +4723,8 @@ const char * cmTarget::GetLinkInterfaceDependentNumberMinProperty(
//----------------------------------------------------------------------------
const char * cmTarget::GetLinkInterfaceDependentNumberMaxProperty(
const std::string &p,
const char *config) const
const std::string &p,
const std::string& config) const
{
return checkInterfacePropertyCompatibility<const char *>(this,
p,
@ -4724,7 +4736,7 @@ const char * cmTarget::GetLinkInterfaceDependentNumberMaxProperty(
//----------------------------------------------------------------------------
bool isLinkDependentProperty(cmTarget const* tgt, const std::string &p,
const std::string& interfaceProperty,
const char *config)
const std::string& config)
{
std::vector<cmTarget*> deps;
tgt->GetTransitiveTargetClosure(config, tgt, deps);
@ -4762,7 +4774,7 @@ bool isLinkDependentProperty(cmTarget const* tgt, const std::string &p,
//----------------------------------------------------------------------------
bool cmTarget::IsLinkInterfaceDependentBoolProperty(const std::string &p,
const char *config) const
const std::string& config) const
{
if (this->TargetTypeValue == OBJECT_LIBRARY
|| this->TargetTypeValue == INTERFACE_LIBRARY)
@ -4776,7 +4788,7 @@ bool cmTarget::IsLinkInterfaceDependentBoolProperty(const std::string &p,
//----------------------------------------------------------------------------
bool cmTarget::IsLinkInterfaceDependentStringProperty(const std::string &p,
const char *config) const
const std::string& config) const
{
if (this->TargetTypeValue == OBJECT_LIBRARY
|| this->TargetTypeValue == INTERFACE_LIBRARY)
@ -4790,7 +4802,7 @@ bool cmTarget::IsLinkInterfaceDependentStringProperty(const std::string &p,
//----------------------------------------------------------------------------
bool cmTarget::IsLinkInterfaceDependentNumberMinProperty(const std::string &p,
const char *config) const
const std::string& config) const
{
if (this->TargetTypeValue == OBJECT_LIBRARY
|| this->TargetTypeValue == INTERFACE_LIBRARY)
@ -4803,7 +4815,7 @@ bool cmTarget::IsLinkInterfaceDependentNumberMinProperty(const std::string &p,
//----------------------------------------------------------------------------
bool cmTarget::IsLinkInterfaceDependentNumberMaxProperty(const std::string &p,
const char *config) const
const std::string& config) const
{
if (this->TargetTypeValue == OBJECT_LIBRARY
|| this->TargetTypeValue == INTERFACE_LIBRARY)
@ -4829,7 +4841,7 @@ void cmTarget::GetLanguages(std::set<std::string>& languages) const
}
//----------------------------------------------------------------------------
bool cmTarget::IsChrpathUsed(const char* config) const
bool cmTarget::IsChrpathUsed(const std::string& config) const
{
// Only certain target types have an rpath.
if(!(this->GetType() == cmTarget::SHARED_LIBRARY ||
@ -4897,7 +4909,8 @@ bool cmTarget::IsChrpathUsed(const char* config) const
//----------------------------------------------------------------------------
cmTarget::ImportInfo const*
cmTarget::GetImportInfo(const char* config, cmTarget const* headTarget) const
cmTarget::GetImportInfo(const std::string& config,
cmTarget const* headTarget) const
{
// There is no imported information for non-imported targets.
if(!this->IsImported())
@ -4908,7 +4921,7 @@ cmTarget::GetImportInfo(const char* config, cmTarget const* headTarget) const
// Lookup/compute/cache the import information for this
// configuration.
std::string config_upper;
if(config && *config)
if(!config.empty())
{
config_upper = cmSystemTools::UpperCase(config);
}
@ -5262,7 +5275,8 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config,
}
//----------------------------------------------------------------------------
cmTarget::LinkInterface const* cmTarget::GetLinkInterface(const char* config,
cmTarget::LinkInterface const* cmTarget::GetLinkInterface(
const std::string& config,
cmTarget const* head) const
{
// Imported targets have their own link interface.
@ -5284,7 +5298,7 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface(const char* config,
}
// Lookup any existing link interface for this configuration.
TargetConfigPair key(head, cmSystemTools::UpperCase(config? config : ""));
TargetConfigPair key(head, cmSystemTools::UpperCase(config));
cmTargetInternals::LinkInterfaceMapType::iterator
i = this->Internal->LinkInterfaceMap.find(key);
@ -5315,7 +5329,7 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface(const char* config,
//----------------------------------------------------------------------------
cmTarget::LinkInterface const*
cmTarget::GetLinkInterfaceLibraries(const char* config,
cmTarget::GetLinkInterfaceLibraries(const std::string& config,
cmTarget const* head) const
{
// Imported targets have their own link interface.
@ -5337,7 +5351,7 @@ cmTarget::GetLinkInterfaceLibraries(const char* config,
}
// Lookup any existing link interface for this configuration.
TargetConfigPair key(head, cmSystemTools::UpperCase(config? config : ""));
TargetConfigPair key(head, cmSystemTools::UpperCase(config));
cmTargetInternals::LinkInterfaceMapType::iterator
i = this->Internal->LinkInterfaceMap.find(key);
@ -5359,7 +5373,7 @@ cmTarget::GetLinkInterfaceLibraries(const char* config,
}
//----------------------------------------------------------------------------
void processILibs(const char* config,
void processILibs(const std::string& config,
cmTarget const* headTarget,
std::string const& name,
std::vector<cmTarget*>& tgts, std::set<cmTarget*>& emitted)
@ -5387,7 +5401,7 @@ void processILibs(const char* config,
}
//----------------------------------------------------------------------------
void cmTarget::GetTransitiveTargetClosure(const char* config,
void cmTarget::GetTransitiveTargetClosure(const std::string& config,
cmTarget const* headTarget,
std::vector<cmTarget*> &tgts) const
{
@ -5404,7 +5418,7 @@ void cmTarget::GetTransitiveTargetClosure(const char* config,
}
//----------------------------------------------------------------------------
void cmTarget::GetTransitivePropertyTargets(const char* config,
void cmTarget::GetTransitivePropertyTargets(const std::string& config,
cmTarget const* headTarget,
std::vector<cmTarget*> &tgts) const
{
@ -5464,14 +5478,14 @@ void cmTarget::GetTransitivePropertyTargets(const char* config,
}
//----------------------------------------------------------------------------
const char* cmTarget::ComputeLinkInterfaceLibraries(const char* config,
const char* cmTarget::ComputeLinkInterfaceLibraries(const std::string& config,
LinkInterface& iface,
cmTarget const* headTarget,
bool &exists) const
{
// Construct the property name suffix for this configuration.
std::string suffix = "_";
if(config && *config)
if(!config.empty())
{
suffix += cmSystemTools::UpperCase(config);
}
@ -5642,7 +5656,7 @@ const char* cmTarget::ComputeLinkInterfaceLibraries(const char* config,
//----------------------------------------------------------------------------
void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget,
const char* config,
const std::string& config,
OptionalLinkInterface& iface,
cmTarget const* headTarget,
const char* explicitLibraries) const
@ -5714,7 +5728,7 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget,
{
// Construct the property name suffix for this configuration.
std::string suffix = "_";
if(config && *config)
if(!config.empty())
{
suffix += cmSystemTools::UpperCase(config);
}
@ -5742,7 +5756,8 @@ void cmTargetInternals::ComputeLinkInterface(cmTarget const* thisTarget,
//----------------------------------------------------------------------------
cmTarget::LinkImplementation const*
cmTarget::GetLinkImplementation(const char* config, cmTarget const* head) const
cmTarget::GetLinkImplementation(const std::string& config,
cmTarget const* head) const
{
// There is no link implementation for imported targets.
if(this->IsImported())
@ -5751,7 +5766,7 @@ cmTarget::GetLinkImplementation(const char* config, cmTarget const* head) const
}
// Lookup any existing link implementation for this configuration.
TargetConfigPair key(head, cmSystemTools::UpperCase(config? config : ""));
TargetConfigPair key(head, cmSystemTools::UpperCase(config));
cmTargetInternals::LinkImplMapType::iterator
i = this->Internal->LinkImplMap.find(key);
@ -5776,7 +5791,7 @@ cmTarget::GetLinkImplementation(const char* config, cmTarget const* head) const
//----------------------------------------------------------------------------
cmTarget::LinkImplementation const*
cmTarget::GetLinkImplementationLibraries(const char* config,
cmTarget::GetLinkImplementationLibraries(const std::string& config,
cmTarget const* head) const
{
// There is no link implementation for imported targets.
@ -5786,7 +5801,7 @@ cmTarget::GetLinkImplementationLibraries(const char* config,
}
// Lookup any existing link implementation for this configuration.
TargetConfigPair key(head, cmSystemTools::UpperCase(config? config : ""));
TargetConfigPair key(head, cmSystemTools::UpperCase(config));
cmTargetInternals::LinkImplMapType::iterator
i = this->Internal->LinkImplMap.find(key);
@ -5805,7 +5820,7 @@ cmTarget::GetLinkImplementationLibraries(const char* config,
}
//----------------------------------------------------------------------------
void cmTarget::ComputeLinkImplementation(const char* config,
void cmTarget::ComputeLinkImplementation(const std::string& config,
LinkImplementation& impl,
cmTarget const* head) const
{
@ -5970,14 +5985,14 @@ std::string cmTarget::CheckCMP0004(std::string const& item) const
template<typename PropertyType>
PropertyType getLinkInterfaceDependentProperty(cmTarget const* tgt,
const std::string& prop,
const char *config,
const std::string& config,
CompatibleType,
PropertyType *);
template<>
bool getLinkInterfaceDependentProperty(cmTarget const* tgt,
const std::string& prop,
const char *config,
const std::string& config,
CompatibleType, bool *)
{
return tgt->GetLinkInterfaceDependentBoolProperty(prop, config);
@ -5986,7 +6001,7 @@ bool getLinkInterfaceDependentProperty(cmTarget const* tgt,
template<>
const char * getLinkInterfaceDependentProperty(cmTarget const* tgt,
const std::string& prop,
const char *config,
const std::string& config,
CompatibleType t,
const char **)
{
@ -6012,7 +6027,7 @@ void checkPropertyConsistency(cmTarget const* depender,
cmTarget const* dependee,
const std::string& propName,
std::set<std::string> &emitted,
const char *config,
const std::string& config,
CompatibleType t,
PropertyType *)
{
@ -6101,7 +6116,7 @@ static std::string intersect(const std::set<std::string> &s1,
//----------------------------------------------------------------------------
void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info,
const char* config) const
const std::string& config) const
{
const cmComputeLinkInformation::ItemVector &deps = info->GetItems();
@ -6205,12 +6220,12 @@ void cmTarget::CheckPropertyCompatibility(cmComputeLinkInformation *info,
//----------------------------------------------------------------------------
cmComputeLinkInformation*
cmTarget::GetLinkInformation(const char* config, cmTarget const* head) const
cmTarget::GetLinkInformation(const std::string& config,
cmTarget const* head) const
{
cmTarget const* headTarget = head ? head : this;
// Lookup any existing information for this configuration.
TargetConfigPair key(headTarget,
cmSystemTools::UpperCase(config?config:""));
TargetConfigPair key(headTarget, cmSystemTools::UpperCase(config));
cmTargetLinkInformationMap::iterator
i = this->LinkInformation.find(key);
if(i == this->LinkInformation.end())
@ -6237,7 +6252,7 @@ cmTarget::GetLinkInformation(const char* config, cmTarget const* head) const
}
//----------------------------------------------------------------------------
std::string cmTarget::GetFrameworkDirectory(const char* config,
std::string cmTarget::GetFrameworkDirectory(const std::string& config,
bool rootDir) const
{
std::string fpath;
@ -6252,7 +6267,7 @@ std::string cmTarget::GetFrameworkDirectory(const char* config,
}
//----------------------------------------------------------------------------
std::string cmTarget::GetCFBundleDirectory(const char* config,
std::string cmTarget::GetCFBundleDirectory(const std::string& config,
bool contentOnly) const
{
std::string fpath;
@ -6271,7 +6286,7 @@ std::string cmTarget::GetCFBundleDirectory(const char* config,
}
//----------------------------------------------------------------------------
std::string cmTarget::GetAppBundleDirectory(const char* config,
std::string cmTarget::GetAppBundleDirectory(const std::string& config,
bool contentOnly) const
{
std::string fpath = this->GetFullName(config, false);
@ -6283,7 +6298,7 @@ std::string cmTarget::GetAppBundleDirectory(const char* config,
//----------------------------------------------------------------------------
std::string cmTarget::BuildMacContentDirectory(const std::string& base,
const char* config,
const std::string& config,
bool contentOnly) const
{
std::string fpath = base;
@ -6303,7 +6318,7 @@ std::string cmTarget::BuildMacContentDirectory(const std::string& base,
}
//----------------------------------------------------------------------------
std::string cmTarget::GetMacContentDirectory(const char* config,
std::string cmTarget::GetMacContentDirectory(const std::string& config,
bool implib) const
{
// Start with the output directory for the target.

View File

@ -155,15 +155,15 @@ public:
return this->LinkLibraries;}
const LinkLibraryVectorType &GetOriginalLinkLibraries() const
{return this->OriginalLinkLibraries;}
void GetDirectLinkLibraries(const char *config,
void GetDirectLinkLibraries(const std::string& config,
std::vector<std::string> &,
cmTarget const* head) const;
void GetInterfaceLinkLibraries(const char *config,
void GetInterfaceLinkLibraries(const std::string& config,
std::vector<std::string> &,
cmTarget const* head) const;
/** Compute the link type to use for the given configuration. */
LinkLibraryType ComputeLinkType(const char* config) const;
LinkLibraryType ComputeLinkType(const std::string& config) const;
/**
* Clear the dependency information recorded for this target, if any.
@ -232,7 +232,8 @@ public:
bool GetPropertyAsBool(const std::string& prop) const;
void CheckProperty(const std::string& prop, cmMakefile* context) const;
const char* GetFeature(const char* feature, const char* config) const;
const char* GetFeature(const char* feature,
const std::string& config) const;
bool IsImported() const {return this->IsImportedTarget;}
@ -264,14 +265,14 @@ public:
/** Get the link interface for the given configuration. Returns 0
if the target cannot be linked. */
LinkInterface const* GetLinkInterface(const char* config,
LinkInterface const* GetLinkInterface(const std::string& config,
cmTarget const* headTarget) const;
LinkInterface const* GetLinkInterfaceLibraries(const char* config,
LinkInterface const* GetLinkInterfaceLibraries(const std::string& config,
cmTarget const* headTarget) const;
void GetTransitivePropertyTargets(const char* config,
void GetTransitivePropertyTargets(const std::string& config,
cmTarget const* headTarget,
std::vector<cmTarget*> &libs) const;
void GetTransitiveTargetClosure(const char* config,
void GetTransitiveTargetClosure(const std::string& config,
cmTarget const* headTarget,
std::vector<cmTarget*> &libs) const;
@ -289,10 +290,11 @@ public:
// Needed only for OLD behavior of CMP0003.
std::vector<std::string> WrongConfigLibraries;
};
LinkImplementation const* GetLinkImplementation(const char* config,
LinkImplementation const* GetLinkImplementation(const std::string& config,
cmTarget const* head) const;
LinkImplementation const* GetLinkImplementationLibraries(const char* config,
LinkImplementation const* GetLinkImplementationLibraries(
const std::string& config,
cmTarget const* head) const;
/** Link information from the transitive closure of the link
@ -305,7 +307,7 @@ public:
// Languages whose runtime libraries must be linked.
std::vector<std::string> Languages;
};
LinkClosure const* GetLinkClosure(const char* config,
LinkClosure const* GetLinkClosure(const std::string& config,
cmTarget const* head) const;
/** Strip off leading and trailing whitespace from an item named in
@ -316,23 +318,24 @@ public:
configuration name is given then the generator will add its
subdirectory for that configuration. Otherwise just the canonical
output directory is given. */
std::string GetDirectory(const char* config = 0, bool implib = false) const;
std::string GetDirectory(const std::string& config = "",
bool implib = false) const;
/** Get the directory in which this targets .pdb files will be placed.
If the configuration name is given then the generator will add its
subdirectory for that configuration. Otherwise just the canonical
pdb output directory is given. */
std::string GetPDBDirectory(const char* config) const;
std::string GetPDBDirectory(const std::string& config) const;
/** Get the directory in which to place the target compiler .pdb file.
If the configuration name is given then the generator will add its
subdirectory for that configuration. Otherwise just the canonical
compiler pdb output directory is given. */
std::string GetCompilePDBDirectory(const char* config = 0) const;
std::string GetCompilePDBDirectory(const std::string& config = "") const;
/** Get the location of the target in the build tree for the given
configuration. */
const char* GetLocation(const char* config) const;
const char* GetLocation(const std::string& config) const;
/** Get the location of the target in the build tree with a placeholder
referencing the configuration in the native build system. This
@ -351,44 +354,46 @@ public:
GetTargetVersion(bool soversion, int& major, int& minor, int& patch) const;
///! Return the preferred linker language for this target
std::string GetLinkerLanguage(const char* config = 0,
std::string GetLinkerLanguage(const std::string& config = "",
cmTarget const* head = 0) const;
/** Get the full name of the target according to the settings in its
makefile. */
std::string GetFullName(const char* config=0, bool implib = false) const;
std::string GetFullName(const std::string& config="",
bool implib = false) const;
void GetFullNameComponents(std::string& prefix,
std::string& base, std::string& suffix,
const char* config=0, bool implib = false) const;
const std::string& config="",
bool implib = false) const;
/** Get the name of the pdb file for the target. */
std::string GetPDBName(const char* config) const;
std::string GetPDBName(const std::string& config) const;
/** Get the name of the compiler pdb file for the target. */
std::string GetCompilePDBName(const char* config=0) const;
std::string GetCompilePDBName(const std::string& config="") const;
/** Get the path for the MSVC /Fd option for this target. */
std::string GetCompilePDBPath(const char* config=0) const;
std::string GetCompilePDBPath(const std::string& config="") const;
/** Whether this library has soname enabled and platform supports it. */
bool HasSOName(const char* config) const;
bool HasSOName(const std::string& config) const;
/** Get the soname of the target. Allowed only for a shared library. */
std::string GetSOName(const char* config) const;
std::string GetSOName(const std::string& config) const;
/** Whether this library has \@rpath and platform supports it. */
bool HasMacOSXRpathInstallNameDir(const char* config) const;
bool HasMacOSXRpathInstallNameDir(const std::string& config) const;
/** Whether this library defaults to \@rpath. */
bool MacOSXRpathInstallNameDirDefault() const;
/** Test for special case of a third-party shared library that has
no soname at all. */
bool IsImportedSharedLibWithoutSOName(const char* config) const;
bool IsImportedSharedLibWithoutSOName(const std::string& config) const;
/** Get the full path to the target according to the settings in its
makefile and the configuration type. */
std::string GetFullPath(const char* config=0, bool implib = false,
std::string GetFullPath(const std::string& config="", bool implib = false,
bool realname = false) const;
/** Get the names of the library needed to generate a build rule
@ -396,14 +401,15 @@ public:
should be called only on a library target. */
void GetLibraryNames(std::string& name, std::string& soName,
std::string& realName, std::string& impName,
std::string& pdbName, const char* config) const;
std::string& pdbName, const std::string& config) const;
/** Get the names of the executable needed to generate a build rule
that takes into account executable version numbers. This should
be called only on an executable target. */
void GetExecutableNames(std::string& name, std::string& realName,
std::string& impName,
std::string& pdbName, const char* config) const;
std::string& pdbName,
const std::string& config) const;
/** Does this target have a GNU implib to convert to MS format? */
bool HasImplibGNUtoMS() const;
@ -416,24 +422,24 @@ public:
/**
* Compute whether this target must be relinked before installing.
*/
bool NeedRelinkBeforeInstall(const char* config) const;
bool NeedRelinkBeforeInstall(const std::string& config) const;
bool HaveBuildTreeRPATH(const char *config) const;
bool HaveBuildTreeRPATH(const std::string& config) const;
bool HaveInstallTreeRPATH() const;
/** Return true if builtin chrpath will work for this target */
bool IsChrpathUsed(const char* config) const;
bool IsChrpathUsed(const std::string& config) const;
/** Return the install name directory for the target in the
* build tree. For example: "\@rpath/", "\@loader_path/",
* or "/full/path/to/library". */
std::string GetInstallNameDirForBuildTree(const char* config) const;
std::string GetInstallNameDirForBuildTree(const std::string& config) const;
/** Return the install name directory for the target in the
* install tree. For example: "\@rpath/" or "\@loader_path/". */
std::string GetInstallNameDirForInstallTree() const;
cmComputeLinkInformation* GetLinkInformation(const char* config,
cmComputeLinkInformation* GetLinkInformation(const std::string& config,
cmTarget const* head = 0) const;
// Get the properties
@ -452,7 +458,7 @@ public:
const char* GetExportMacro() const;
void GetCompileDefinitions(std::vector<std::string> &result,
const char *config) const;
const std::string& config) const;
// Compute the set of languages compiled by the target. This is
// computed every time it is called because the languages can change
@ -500,26 +506,29 @@ public:
/** Return whether this target uses the default value for its output
directory. */
bool UsesDefaultOutputDir(const char* config, bool implib) const;
bool UsesDefaultOutputDir(const std::string& config, bool implib) const;
/** @return the mac content directory for this target. */
std::string GetMacContentDirectory(const char* config,
std::string GetMacContentDirectory(const std::string& config,
bool implib) const;
/** @return whether this target have a well defined output file name. */
bool HaveWellDefinedOutputFiles() const;
/** @return the Mac framework directory without the base. */
std::string GetFrameworkDirectory(const char* config, bool rootDir) const;
std::string GetFrameworkDirectory(const std::string& config,
bool rootDir) const;
/** @return the Mac CFBundle directory without the base */
std::string GetCFBundleDirectory(const char* config, bool contentOnly) const;
std::string GetCFBundleDirectory(const std::string& config,
bool contentOnly) const;
/** @return the Mac App directory without the base */
std::string GetAppBundleDirectory(const char* config,
std::string GetAppBundleDirectory(const std::string& config,
bool contentOnly) const;
std::vector<std::string> GetIncludeDirectories(const char *config) const;
std::vector<std::string> GetIncludeDirectories(
const std::string& config) const;
void InsertInclude(const cmValueWithOrigin &entry,
bool before = false);
void InsertCompileOption(const cmValueWithOrigin &entry,
@ -529,29 +538,29 @@ public:
void AppendBuildInterfaceIncludes();
void GetCompileOptions(std::vector<std::string> &result,
const char *config) const;
const std::string& config) const;
void GetAutoUicOptions(std::vector<std::string> &result,
const char *config) const;
const std::string& config) const;
bool IsNullImpliedByLinkLibraries(const std::string &p) const;
bool IsLinkInterfaceDependentBoolProperty(const std::string &p,
const char *config) const;
const std::string& config) const;
bool IsLinkInterfaceDependentStringProperty(const std::string &p,
const char *config) const;
const std::string& config) const;
bool IsLinkInterfaceDependentNumberMinProperty(const std::string &p,
const char *config) const;
const std::string& config) const;
bool IsLinkInterfaceDependentNumberMaxProperty(const std::string &p,
const char *config) const;
const std::string& config) const;
bool GetLinkInterfaceDependentBoolProperty(const std::string &p,
const char *config) const;
const std::string& config) const;
const char *GetLinkInterfaceDependentStringProperty(const std::string &p,
const char *config) const;
const std::string& config) const;
const char *GetLinkInterfaceDependentNumberMinProperty(const std::string &p,
const char *config) const;
const std::string& config) const;
const char *GetLinkInterfaceDependentNumberMaxProperty(const std::string &p,
const char *config) const;
const std::string& config) const;
std::string GetDebugGeneratorExpressions(const std::string &value,
cmTarget::LinkLibraryType llt) const;
@ -631,8 +640,9 @@ private:
const char* GetSuffixVariableInternal(bool implib) const;
const char* GetPrefixVariableInternal(bool implib) const;
std::string GetFullNameInternal(const char* config, bool implib) const;
void GetFullNameInternal(const char* config, bool implib,
std::string GetFullNameInternal(const std::string& config,
bool implib) const;
void GetFullNameInternal(const std::string& config, bool implib,
std::string& outPrefix, std::string& outBase,
std::string& outSuffix) const;
@ -645,23 +655,25 @@ private:
const char* GetOutputTargetType(bool implib) const;
// Get the target base name.
std::string GetOutputName(const char* config, bool implib) const;
std::string GetOutputName(const std::string& config, bool implib) const;
std::string GetFullNameImported(const char* config, bool implib) const;
std::string GetFullNameImported(const std::string& config,
bool implib) const;
std::string ImportedGetFullPath(const char* config, bool implib) const;
std::string NormalGetFullPath(const char* config, bool implib,
std::string ImportedGetFullPath(const std::string& config,
bool implib) const;
std::string NormalGetFullPath(const std::string& config, bool implib,
bool realname) const;
/** Get the real name of the target. Allowed only for non-imported
targets. When a library or executable file is versioned this is
the full versioned name. If the target is not versioned this is
the same as GetFullName. */
std::string NormalGetRealName(const char* config) const;
std::string NormalGetRealName(const std::string& config) const;
/** Append to @a base the mac content directory and return it. */
std::string BuildMacContentDirectory(const std::string& base,
const char* config,
const std::string& config,
bool contentOnly) const;
private:
@ -698,37 +710,38 @@ private:
// Cache target output paths for each configuration.
struct OutputInfo;
OutputInfo const* GetOutputInfo(const char* config) const;
OutputInfo const* GetOutputInfo(const std::string& config) const;
bool
ComputeOutputDir(const char* config, bool implib, std::string& out) const;
bool ComputePDBOutputDir(const char* kind, const char* config,
ComputeOutputDir(const std::string& config,
bool implib, std::string& out) const;
bool ComputePDBOutputDir(const char* kind, const std::string& config,
std::string& out) const;
// Cache import information from properties for each configuration.
struct ImportInfo;
ImportInfo const* GetImportInfo(const char* config,
ImportInfo const* GetImportInfo(const std::string& config,
cmTarget const* workingTarget) const;
void ComputeImportInfo(std::string const& desired_config, ImportInfo& info,
cmTarget const* head) const;
// Cache target compile paths for each configuration.
struct CompileInfo;
CompileInfo const* GetCompileInfo(const char* config) const;
CompileInfo const* GetCompileInfo(const std::string& config) const;
mutable cmTargetLinkInformationMap LinkInformation;
void CheckPropertyCompatibility(cmComputeLinkInformation *info,
const char* config) const;
const std::string& config) const;
const char* ComputeLinkInterfaceLibraries(const char* config,
const char* ComputeLinkInterfaceLibraries(const std::string& config,
LinkInterface& iface,
cmTarget const* head,
bool &exists) const;
void ComputeLinkImplementation(const char* config,
void ComputeLinkImplementation(const std::string& config,
LinkImplementation& impl,
cmTarget const* head) const;
void ComputeLinkImplementationLanguages(LinkImplementation& impl) const;
void ComputeLinkClosure(const char* config, LinkClosure& lc,
void ComputeLinkClosure(const std::string& config, LinkClosure& lc,
cmTarget const* head) const;
void ClearLinkMaps();

View File

@ -64,7 +64,7 @@ void cmTestGenerator::GenerateScriptActions(std::ostream& os,
//----------------------------------------------------------------------------
void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
const char* config,
const std::string& config,
Indent const& indent)
{
this->TestGenerated = true;

View File

@ -32,7 +32,7 @@ protected:
virtual void GenerateScriptConfigs(std::ostream& os, Indent const& indent);
virtual void GenerateScriptActions(std::ostream& os, Indent const& indent);
virtual void GenerateScriptForConfig(std::ostream& os,
const char* config,
const std::string& config,
Indent const& indent);
virtual void GenerateScriptNoConfig(std::ostream& os, Indent const& indent);
virtual bool NeedsScriptNoConfig() const;

View File

@ -140,7 +140,7 @@ cmVisualStudio10TargetGenerator::~cmVisualStudio10TargetGenerator()
void cmVisualStudio10TargetGenerator::WritePlatformConfigTag(
const char* tag,
const char* config,
const std::string& config,
int indentLevel,
const char* attribute,
const char* end,

View File

@ -35,7 +35,7 @@ public:
// used by cmVisualStudioGeneratorOptions
void WritePlatformConfigTag(
const char* tag,
const char* config,
const std::string& config,
int indentLevel,
const char* attribute = 0,
const char* end = 0,

View File

@ -122,26 +122,18 @@ public:
void CopyAttributes(cmXCodeObject* );
void AddDependLibrary(const char* configName,
void AddDependLibrary(const std::string& configName,
const std::string& l)
{
if(!configName)
{
configName = "";
}
this->DependLibraries[configName].push_back(l);
}
std::map<std::string, StringVec> const& GetDependLibraries()
{
return this->DependLibraries;
}
void AddDependTarget(const char* configName,
void AddDependTarget(const std::string& configName,
const std::string& tName)
{
if(!configName)
{
configName = "";
}
this->DependTargets[configName].push_back(tName);
}
std::map<std::string, StringVec> const& GetDependTargets()

View File

@ -666,7 +666,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
else if (args[1] == "cmake_autogen" && args.size() >= 4)
{
cmQtAutoGenerators autogen;
const char *config = args[3].empty() ? 0 : args[3].c_str();
std::string const& config = args[3];
bool autogenSuccess = autogen.Run(args[2].c_str(), config);
return autogenSuccess ? 0 : 1;
}