aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-12-08 10:29:57 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-12-08 10:29:57 +0200
commit1702d75cb90c3a9f630cb884ccf158dd5a7eecf8 (patch)
tree11efaa7b8cc769e3a3fc4c4bbfde33ef3d3cb216
parenta89f1e4f4efd291beedea03c65c8185b7d0df20e (diff)
Link libcmt.lib when building with Clang for win32-msvc target
-rw-r--r--build2/cc/link.cxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/build2/cc/link.cxx b/build2/cc/link.cxx
index dd16164..c51ccd2 100644
--- a/build2/cc/link.cxx
+++ b/build2/cc/link.cxx
@@ -1694,6 +1694,17 @@ namespace build2
if (!find_option ("/INCREMENTAL", args, true))
args.push_back ("/INCREMENTAL:NO");
+ if (cid == compiler_id::clang)
+ {
+ // According to Clang's MSVC.cpp, we shall link libcmt.lib (static
+ // multi-threaded runtime) unless -nostdlib or -nostartfiles is
+ // specified.
+ //
+ if (!find_option ("-nostdlib", args) &&
+ !find_option ("-nostartfiles", args))
+ args.push_back ("/DEFAULTLIB:libcmt.lib");
+ }
+
// 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