diff options
author | Brad King <brad.king@kitware.com> | 2018-09-19 11:43:34 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-09-19 12:14:48 (GMT) |
commit | 2428422c02de1feac008d2ba1a6ad075aaf7ba2c (patch) | |
tree | 4597e1d5a338aba37f4615558db6863bd8e13872 /Source/cmGeneratorTarget.cxx | |
parent | d686f81e58200c68c1e89094210e9587e0e90983 (diff) | |
download | CMake-2428422c02de1feac008d2ba1a6ad075aaf7ba2c.zip CMake-2428422c02de1feac008d2ba1a6ad075aaf7ba2c.tar.gz CMake-2428422c02de1feac008d2ba1a6ad075aaf7ba2c.tar.bz2 |
Fix regression in target output file naming logic
Refactoring in commit f4ff60a803 (cmMakefile: Make GetSafeDefinition
return std::string const&, 2018-09-05) accidentally changed the logic
for target artifact prefix and suffix names such that setting a PREFIX
or SUFFIX target property would cause an empty value to be used. Revert
that part of the change and use a simpler alternative. Add a test case.
Reported-by: Alan W. Irwin <irwin@beluga.phys.uvic.ca>
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index f563dd8..434e0a3 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -3488,13 +3488,12 @@ void cmGeneratorTarget::GetFullNameInternal( } // if there is no prefix on the target use the cmake definition - std::string targetPrefix2, targetSuffix2; if (!targetPrefix && prefixVar) { - targetPrefix2 = this->Makefile->GetSafeDefinition(prefixVar); + targetPrefix = this->Makefile->GetSafeDefinition(prefixVar).c_str(); } // if there is no suffix on the target use the cmake definition if (!targetSuffix && suffixVar) { - targetSuffix2 = this->Makefile->GetSafeDefinition(suffixVar); + targetSuffix = this->Makefile->GetSafeDefinition(suffixVar).c_str(); } // frameworks have directory prefix but no suffix @@ -3502,19 +3501,19 @@ void cmGeneratorTarget::GetFullNameInternal( if (this->IsFrameworkOnApple()) { fw_prefix = this->GetFrameworkDirectory(config, ContentLevel); fw_prefix += "/"; - targetPrefix2 = fw_prefix; - targetSuffix2.clear(); + targetPrefix = fw_prefix.c_str(); + targetSuffix = nullptr; } if (this->IsCFBundleOnApple()) { fw_prefix = this->GetCFBundleDirectory(config, FullLevel); fw_prefix += "/"; - targetPrefix2 = fw_prefix; - targetSuffix2.clear(); + targetPrefix = fw_prefix.c_str(); + targetSuffix = nullptr; } // Begin the final name with the prefix. - outPrefix = targetPrefix2; + outPrefix = targetPrefix ? targetPrefix : ""; // Append the target name or property-specified name. outBase += this->GetOutputName(config, artifact); @@ -3533,7 +3532,7 @@ void cmGeneratorTarget::GetFullNameInternal( } // Append the suffix. - outSuffix = targetSuffix2; + outSuffix = targetSuffix ? targetSuffix : ""; } std::string cmGeneratorTarget::GetLinkerLanguage( |