From ac03ae75f46196c09cec0e3e45f401dc59faee73 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 22 Jan 2021 09:35:06 +0200 Subject: Redo bin.lib.version not to require empty key --- libbuild2/bin/init.cxx | 7 +++++-- libbuild2/cc/link-rule.cxx | 12 +++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) (limited to 'libbuild2') diff --git a/libbuild2/bin/init.cxx b/libbuild2/bin/init.cxx index ff00e89..fb82d21 100644 --- a/libbuild2/bin/init.cxx +++ b/libbuild2/bin/init.cxx @@ -144,8 +144,11 @@ namespace build2 vp.insert ("bin.lib.load_suffix"); vp.insert ("bin.lib.load_suffix_pattern"); - vp.insert> ("bin.lib.version"); - vp.insert ("bin.lib.version_pattern"); + // @@ TMP: update bdep-new generated projects, documentation not to use + // @ for platform-independent version. + // + vp.insert, string>> ("bin.lib.version"); + vp.insert ("bin.lib.version_pattern"); return true; } diff --git a/libbuild2/cc/link-rule.cxx b/libbuild2/cc/link-rule.cxx index 9c0b018..f500389 100644 --- a/libbuild2/cc/link-rule.cxx +++ b/libbuild2/cc/link-rule.cxx @@ -330,7 +330,7 @@ namespace build2 // string ver; bool verp (true); // Platform-specific. - using verion_map = map; + using verion_map = map, string>; if (const verion_map* m = cast_null (t["bin.lib.version"])) { // First look for the target system. @@ -347,14 +347,20 @@ namespace build2 // say "all others -- no version". // if (i == m->end ()) - i = m->find ("*"); + i = m->find (string ("*")); // Finally look for the platform-independent version. // if (i == m->end ()) { verp = false; - i = m->find (""); + + i = m->find (nullopt); + + // For backwards-compatibility. + // + if (i == m->end ()) + i = m->find (string ()); } // If we didn't find anything, fail. If the bin.lib.version was -- cgit v1.1