summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Feblot <devnull@localhost>2015-04-25 14:23:26 +0200
committerAlexandre Feblot <devnull@localhost>2015-04-25 14:23:26 +0200
commitc8b444f353868c8c0d6c54b5312b6102bd2d9d93 (patch)
treed461ae000ea9f5dc6bf650e6f987c92371f55bf8
parent8861bdeda319b19eb7890603c32e66ca86069266 (diff)
downloadscons-c8b444f353868c8c0d6c54b5312b6102bd2d9d93.tar.gz
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.
-rw-r--r--src/engine/SCons/Tool/mslink.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/engine/SCons/Tool/mslink.py b/src/engine/SCons/Tool/mslink.py
index 37af34e7..827161eb 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.