From 9508091845949b4bbb181a46b11032ecab8178c6 Mon Sep 17 00:00:00 2001 From: Alexandre Feblot Date: Sat, 25 Apr 2015 14:23:26 +0200 Subject: VC11 needs PCH objects added to the link line. Update msvc linker emitter to add the PCH object to shared libraries if not already present. --- src/engine/SCons/Tool/mslink.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/engine/SCons/Tool/mslink.py b/src/engine/SCons/Tool/mslink.py index 37af34e..827161e 100644 --- a/src/engine/SCons/Tool/mslink.py +++ b/src/engine/SCons/Tool/mslink.py @@ -129,6 +129,14 @@ def _dllEmitter(target, source, env, paramtp): extratargets.append(pdb) target[0].attributes.pdb = pdb + if version_num >= 11.0 and env.get('PCH', 0): + # MSVC 11 and above need the PCH object file to be added to the link line, + # otherwise you get link error LNK2011. + pchobj = SCons.Util.splitext(str(env['PCH']))[0] + '.obj' + # print "prog_emitter, version %s, appending pchobj %s"%(version_num, pchobj) + if pchobj not in extrasources: + extrasources.append(pchobj) + if not no_import_lib and \ not env.FindIxes(target, "LIBPREFIX", "LIBSUFFIX"): # Append an import library to the list of targets. -- cgit v0.12