diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2019-04-19 11:30:03 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2019-05-02 08:06:04 (GMT) |
commit | 1f4c9aa7d2c93f2377a6d1cb4cf2c1137466e927 (patch) | |
tree | f42251d7b7489092b2dcd513d1579946f6f76ce4 /Source/cmGeneratorTarget.cxx | |
parent | 3ee16ef31b78ff73d7a0c569fdb87b41f2a5e97d (diff) | |
download | CMake-1f4c9aa7d2c93f2377a6d1cb4cf2c1137466e927.zip CMake-1f4c9aa7d2c93f2377a6d1cb4cf2c1137466e927.tar.gz CMake-1f4c9aa7d2c93f2377a6d1cb4cf2c1137466e927.tar.bz2 |
Refactor: introduce method cmGeneratorTarget::GetFilePostfix
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 3fb95bf..036a07d 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -491,6 +491,22 @@ std::string cmGeneratorTarget::GetFileSuffix( return suffix; } +std::string cmGeneratorTarget::GetFilePostfix(const std::string& config) const +{ + const char* postfix = nullptr; + if (!config.empty()) { + std::string configProp = cmSystemTools::UpperCase(config); + configProp += "_POSTFIX"; + postfix = this->GetProperty(configProp); + // Mac application bundles and frameworks have no postfix. + if (!this->IsImported() && postfix && + (this->IsAppBundleOnApple() || this->IsFrameworkOnApple())) { + postfix = nullptr; + } + } + return postfix ? postfix : std::string(); +} + const char* cmGeneratorTarget::GetFilePrefixInternal( cmStateEnums::ArtifactType artifact, const std::string& language) const { @@ -3930,17 +3946,7 @@ void cmGeneratorTarget::GetFullNameInternal( } // Compute the full name for main target types. - const char* configPostfix = nullptr; - if (!config.empty()) { - std::string configProp = cmSystemTools::UpperCase(config); - configProp += "_POSTFIX"; - configPostfix = this->GetProperty(configProp); - // Mac application bundles and frameworks have no postfix. - if (configPostfix && - (this->IsAppBundleOnApple() || this->IsFrameworkOnApple())) { - configPostfix = nullptr; - } - } + const std::string configPostfix = this->GetFilePostfix(config); // frameworks have directory prefix but no suffix std::string fw_prefix; @@ -3965,7 +3971,7 @@ void cmGeneratorTarget::GetFullNameInternal( outBase += this->GetOutputName(config, artifact); // Append the per-configuration postfix. - outBase += configPostfix ? configPostfix : ""; + outBase += configPostfix; // Name shared libraries with their version number on some platforms. if (const char* soversion = this->GetProperty("SOVERSION")) { |