aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/cc/link-rule.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-02-03 14:51:43 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-02-03 14:51:43 +0200
commit1195f9307c425ed28075a17671c13676b65f4a43 (patch)
tree6014ef54bb736a2949eb1f31a63a95d336fffd9b /libbuild2/cc/link-rule.cxx
parenta9cadecf15385f93ad3eb6b6b0bdeaafd741b0a7 (diff)
Add header/library search paths from compiler mode to sys_*_dirs
Diffstat (limited to 'libbuild2/cc/link-rule.cxx')
-rw-r--r--libbuild2/cc/link-rule.cxx68
1 files changed, 35 insertions, 33 deletions
diff --git a/libbuild2/cc/link-rule.cxx b/libbuild2/cc/link-rule.cxx
index 6969ef2..bf474e6 100644
--- a/libbuild2/cc/link-rule.cxx
+++ b/libbuild2/cc/link-rule.cxx
@@ -2331,39 +2331,6 @@ namespace build2
append_options (args, t, x_loptions);
append_options (args, t, c_loptions);
- // Extra system library dirs (last).
- //
- assert (sys_lib_dirs_extra <= sys_lib_dirs.size ());
-
- if (tsys == "win32-msvc")
- {
- // If we have no LIB environment variable set, then we add all of
- // them. But we want extras to come first.
- //
- auto b (sys_lib_dirs.begin ());
- auto m (b + sys_lib_dirs_extra);
- auto e (sys_lib_dirs.end ());
-
- for (auto i (m); i != e; ++i)
- sargs1.push_back ("/LIBPATH:" + i->string ());
-
- if (!getenv ("LIB"))
- {
- for (auto i (b); i != m; ++i)
- sargs1.push_back ("/LIBPATH:" + i->string ());
- }
-
- append_args (sargs1);
- }
- else
- {
- append_option_values (
- args,
- "-L",
- sys_lib_dirs.begin () + sys_lib_dirs_extra, sys_lib_dirs.end (),
- [] (const dir_path& d) {return d.string ().c_str ();});
- }
-
// Handle soname/rpath.
//
if (tclass == "windows")
@@ -2446,6 +2413,41 @@ namespace build2
if (ldc)
append_options (args, cmode);
+
+ // Extra system library dirs (last).
+ //
+ assert (sys_lib_dirs_extra <= sys_lib_dirs.size ());
+
+ if (tsys == "win32-msvc")
+ {
+ // If we have no LIB environment variable set, then we add all of
+ // them. But we want extras to come first.
+ //
+ // Note that the mode options are added as part of cmode.
+ //
+ auto b (sys_lib_dirs.begin () + sys_lib_dirs_mode);
+ auto m (sys_lib_dirs.begin () + sys_lib_dirs_extra);
+ auto e (sys_lib_dirs.end ());
+
+ for (auto i (m); i != e; ++i)
+ sargs1.push_back ("/LIBPATH:" + i->string ());
+
+ if (!getenv ("LIB"))
+ {
+ for (auto i (b); i != m; ++i)
+ sargs1.push_back ("/LIBPATH:" + i->string ());
+ }
+
+ append_args (sargs1);
+ }
+ else
+ {
+ append_option_values (
+ args,
+ "-L",
+ sys_lib_dirs.begin () + sys_lib_dirs_extra, sys_lib_dirs.end (),
+ [] (const dir_path& d) {return d.string ().c_str ();});
+ }
}
// All the options should now be in. Hash them and compare with the db.