diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2014-02-10 03:48:34 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-03-08 18:05:36 (GMT) |
commit | 84fdc9921cab35addba8c57cd201778de2cf87a4 (patch) | |
tree | a43cc1d2782da4bd54734beb3fa5494048a08a18 /Source/cmTarget.cxx | |
parent | f154475b65738444414312d7d5a255f3220d90c6 (diff) | |
download | CMake-84fdc9921cab35addba8c57cd201778de2cf87a4.zip CMake-84fdc9921cab35addba8c57cd201778de2cf87a4.tar.gz CMake-84fdc9921cab35addba8c57cd201778de2cf87a4.tar.bz2 |
stringapi: Pass configuration names as strings
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r-- | Source/cmTarget.cxx | 277 |
1 files changed, 146 insertions, 131 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 3273437..b8e662a 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -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. |