diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 55e29224d..aac941e6a 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -266,6 +266,54 @@ const char *cmGeneratorTarget::GetProperty(const std::string& prop) const return this->Target->GetProperty(prop); } +//---------------------------------------------------------------------------- +std::string cmGeneratorTarget::GetOutputName(const std::string& config, + bool implib) const +{ + std::vector props; + std::string type = this->Target->GetOutputTargetType(implib); + std::string configUpper = cmSystemTools::UpperCase(config); + if(!type.empty() && !configUpper.empty()) + { + // _OUTPUT_NAME_ + props.push_back(type + "_OUTPUT_NAME_" + configUpper); + } + if(!type.empty()) + { + // _OUTPUT_NAME + props.push_back(type + "_OUTPUT_NAME"); + } + if(!configUpper.empty()) + { + // OUTPUT_NAME_ + props.push_back("OUTPUT_NAME_" + configUpper); + // _OUTPUT_NAME + props.push_back(configUpper + "_OUTPUT_NAME"); + } + // OUTPUT_NAME + props.push_back("OUTPUT_NAME"); + + std::string outName; + for(std::vector::const_iterator i = props.begin(); + i != props.end(); ++i) + { + if (const char* outNameProp = this->Target->GetProperty(*i)) + { + outName = outNameProp; + break; + } + } + + if (outName.empty()) + { + outName = this->GetName(); + } + + cmGeneratorExpression ge; + cmsys::auto_ptr cge = ge.Parse(outName); + return cge->Evaluate(this->Makefile, config); +} + //---------------------------------------------------------------------------- std::vector const* cmGeneratorTarget::GetSourceDepends(cmSourceFile const* sf) const @@ -922,7 +970,7 @@ std::string cmGeneratorTarget::GetCFBundleDirectory(const std::string& config, bool contentOnly) const { std::string fpath; - fpath += this->Target->GetOutputName(config, false); + fpath += this->GetOutputName(config, false); fpath += "."; const char *ext = this->Target->GetProperty("BUNDLE_EXTENSION"); if (!ext) @@ -949,7 +997,7 @@ cmGeneratorTarget::GetFrameworkDirectory(const std::string& config, bool rootDir) const { std::string fpath; - fpath += this->Target->GetOutputName(config, false); + fpath += this->GetOutputName(config, false); fpath += ".framework"; if(!rootDir) { @@ -2247,7 +2295,7 @@ void cmGeneratorTarget::GetFullNameInternal(const std::string& config, std::string fw_prefix; if(this->Target->IsFrameworkOnApple()) { - fw_prefix = this->Target->GetOutputName(config, false); + fw_prefix = this->GetOutputName(config, false); fw_prefix += ".framework/"; targetPrefix = fw_prefix.c_str(); targetSuffix = 0; @@ -2265,7 +2313,7 @@ void cmGeneratorTarget::GetFullNameInternal(const std::string& config, outPrefix = targetPrefix?targetPrefix:""; // Append the target name or property-specified name. - outBase += this->Target->GetOutputName(config, implib); + outBase += this->GetOutputName(config, implib); // Append the per-configuration postfix. outBase += configPostfix?configPostfix:""; diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 21e0900ba..52ab6c0c5 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -230,6 +230,9 @@ public: /** Get the path for the MSVC /Fd option for this target. */ std::string GetCompilePDBPath(const std::string& config="") const; + // Get the target base name. + std::string GetOutputName(const std::string& config, bool implib) const; + /** * Flags for a given source file as used in this target. Typically assigned * via SET_TARGET_PROPERTIES when the property is a list of source files. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index e887ef338..8b64bc4ab 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -3662,54 +3662,6 @@ bool cmTarget::UsesDefaultOutputDir(const std::string& config, return this->ComputeOutputDir(config, implib, dir); } -//---------------------------------------------------------------------------- -std::string cmTarget::GetOutputName(const std::string& config, - bool implib) const -{ - std::vector props; - std::string type = this->GetOutputTargetType(implib); - std::string configUpper = cmSystemTools::UpperCase(config); - if(!type.empty() && !configUpper.empty()) - { - // _OUTPUT_NAME_ - props.push_back(type + "_OUTPUT_NAME_" + configUpper); - } - if(!type.empty()) - { - // _OUTPUT_NAME - props.push_back(type + "_OUTPUT_NAME"); - } - if(!configUpper.empty()) - { - // OUTPUT_NAME_ - props.push_back("OUTPUT_NAME_" + configUpper); - // _OUTPUT_NAME - props.push_back(configUpper + "_OUTPUT_NAME"); - } - // OUTPUT_NAME - props.push_back("OUTPUT_NAME"); - - std::string outName; - for(std::vector::const_iterator i = props.begin(); - i != props.end(); ++i) - { - if (const char* outNameProp = this->GetProperty(*i)) - { - outName = outNameProp; - break; - } - } - - if (outName.empty()) - { - outName = this->GetName(); - } - - cmGeneratorExpression ge; - cmsys::auto_ptr cge = ge.Parse(outName); - return cge->Evaluate(this->Makefile, config); -} - //---------------------------------------------------------------------------- std::string cmTarget::GetFrameworkVersion() const { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index e53afff8d..a6f246522 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -552,9 +552,6 @@ private: // Returns ARCHIVE, LIBRARY, or RUNTIME based on platform and type. const char* GetOutputTargetType(bool implib) const; - // Get the target base name. - std::string GetOutputName(const std::string& config, bool implib) const; - std::string GetFullNameImported(const std::string& config, bool implib) const;