From a89f1e4f4efd291beedea03c65c8185b7d0df20e Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 7 Dec 2017 12:06:59 +0200 Subject: Distinguish between "fixed" and "default" target extensions This fixes wrong merging of, say, file{README} and file{README.MySQL} (in libmysqlclient). --- build2/target.txx | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'build2/target.txx') diff --git a/build2/target.txx b/build2/target.txx index a91166c..5cb4732 100644 --- a/build2/target.txx +++ b/build2/target.txx @@ -42,10 +42,15 @@ namespace build2 // // template - optional - target_extension_fix (const target_key&, const scope&, bool) + const char* + target_extension_fix (const target_key& tk) { - return string (ext); + // A generic file target type doesn't imply any extension while a very + // specific one (say man1) may have a fixed extension. So if one wasn't + // specified set it to fixed ext rather than unspecified. For file{} + // itself we make it empty which means we treat file{foo} as file{foo.}. + // + return tk.ext ? tk.ext->c_str () : ext; } template @@ -67,9 +72,12 @@ namespace build2 // else if (p == string::npos) { - v += '.'; - v += ext; - return true; + if (*ext != '\0') // Don't add empty extension (means no extension). + { + v += '.'; + v += ext; + return true; + } } return false; -- cgit v1.1