From 1702d75cb90c3a9f630cb884ccf158dd5a7eecf8 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 8 Dec 2017 10:29:57 +0200 Subject: Link libcmt.lib when building with Clang for win32-msvc target --- build2/cc/link.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'build2/cc/link.cxx') 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 -- cgit v1.1