diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-08-04 17:19:50 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-08-05 16:20:50 (GMT) |
commit | 34c437411dad89c671261269f2067129584a4259 (patch) | |
tree | 1fcbb13800503f7103ad6022b4ca13ea07d6ef8a | |
parent | 4329a71c128f8a8fca48a8827226d09f61fcbe85 (diff) | |
download | CMake-34c437411dad89c671261269f2067129584a4259.zip CMake-34c437411dad89c671261269f2067129584a4259.tar.gz CMake-34c437411dad89c671261269f2067129584a4259.tar.bz2 |
cmGeneratorTarget: Move GetOutputName from cmTarget.
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 56 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.h | 3 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 48 | ||||
-rw-r--r-- | Source/cmTarget.h | 3 |
4 files changed, 55 insertions, 55 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 55e2922..aac941e 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -267,6 +267,54 @@ const char *cmGeneratorTarget::GetProperty(const std::string& prop) const } //---------------------------------------------------------------------------- +std::string cmGeneratorTarget::GetOutputName(const std::string& config, + bool implib) const +{ + std::vector<std::string> props; + std::string type = this->Target->GetOutputTargetType(implib); + std::string configUpper = cmSystemTools::UpperCase(config); + if(!type.empty() && !configUpper.empty()) + { + // <ARCHIVE|LIBRARY|RUNTIME>_OUTPUT_NAME_<CONFIG> + props.push_back(type + "_OUTPUT_NAME_" + configUpper); + } + if(!type.empty()) + { + // <ARCHIVE|LIBRARY|RUNTIME>_OUTPUT_NAME + props.push_back(type + "_OUTPUT_NAME"); + } + if(!configUpper.empty()) + { + // OUTPUT_NAME_<CONFIG> + props.push_back("OUTPUT_NAME_" + configUpper); + // <CONFIG>_OUTPUT_NAME + props.push_back(configUpper + "_OUTPUT_NAME"); + } + // OUTPUT_NAME + props.push_back("OUTPUT_NAME"); + + std::string outName; + for(std::vector<std::string>::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<cmCompiledGeneratorExpression> cge = ge.Parse(outName); + return cge->Evaluate(this->Makefile, config); +} + +//---------------------------------------------------------------------------- std::vector<cmSourceFile*> 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 21e0900..52ab6c0 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 e887ef3..8b64bc4 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -3663,54 +3663,6 @@ bool cmTarget::UsesDefaultOutputDir(const std::string& config, } //---------------------------------------------------------------------------- -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); - if(!type.empty() && !configUpper.empty()) - { - // <ARCHIVE|LIBRARY|RUNTIME>_OUTPUT_NAME_<CONFIG> - props.push_back(type + "_OUTPUT_NAME_" + configUpper); - } - if(!type.empty()) - { - // <ARCHIVE|LIBRARY|RUNTIME>_OUTPUT_NAME - props.push_back(type + "_OUTPUT_NAME"); - } - if(!configUpper.empty()) - { - // OUTPUT_NAME_<CONFIG> - props.push_back("OUTPUT_NAME_" + configUpper); - // <CONFIG>_OUTPUT_NAME - props.push_back(configUpper + "_OUTPUT_NAME"); - } - // OUTPUT_NAME - props.push_back("OUTPUT_NAME"); - - std::string outName; - for(std::vector<std::string>::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<cmCompiledGeneratorExpression> cge = ge.Parse(outName); - return cge->Evaluate(this->Makefile, config); -} - -//---------------------------------------------------------------------------- std::string cmTarget::GetFrameworkVersion() const { assert(this->GetType() != INTERFACE_LIBRARY); diff --git a/Source/cmTarget.h b/Source/cmTarget.h index e53afff..a6f2465 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; |