diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-07-22 16:00:50 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-07-22 16:00:50 +0200 |
commit | 77c763542d2effdd6e76a23893c10dbaadfe70ae (patch) | |
tree | e965db89a3f4e3d0589c563acf03b2cfbc1c6299 | |
parent | 4c3e451a852b537c04f5b73af23639902117b94f (diff) |
Link shell32.lib and user32.lib to default for VC builds
-rw-r--r-- | build2/cxx/link.cxx | 19 |
1 files changed, 19 insertions, 0 deletions
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 ()) |