From 77c763542d2effdd6e76a23893c10dbaadfe70ae Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 22 Jul 2016 16:00:50 +0200 Subject: Link shell32.lib and user32.lib to default for VC builds --- build2/cxx/link.cxx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'build2/cxx/link.cxx') diff --git a/build2/cxx/link.cxx b/build2/cxx/link.cxx index ba08119..34495b0 100644 --- a/build2/cxx/link.cxx +++ b/build2/cxx/link.cxx @@ -1529,6 +1529,25 @@ namespace build2 if (!find_option ("/INCREMENTAL", args, true)) args.push_back ("/INCREMENTAL:NO"); + // If you look at the list of libraries Visual Studio links by + // default, it includes everything and a couple of kitchen sinks + // (winspool32.lib, ole32.lib, odbc32.lib, etc) while we want to + // keep our low-level build as pure as possible. However, there + // seem to be fairly essential libraries that are not linked by + // link.exe by default (use /VERBOSE:LIB to see the list). For + // example, MinGW by default links advapi32, shell32, user32, and + // kernel32. And so we follow suit and make sure those are linked. + // advapi32 and kernel32 are already on the default list and we + // only need to add the other two. + // + // The way we are going to do it is via the /DEFAULTLIB option + // rather than specifying the libraries as normal inputs (as VS + // does). This way the user can override our actions with the + // /NODEFAULTLIB option. + // + args.push_back ("/DEFAULTLIB:shell32.lib"); + args.push_back ("/DEFAULTLIB:user32.lib"); + // Take care of the manifest (will be empty for the DLL). // if (!manifest.empty ()) -- cgit v1.1