diff options
author | Steven Knight <knight@baldmt.com> | 2010-01-06 21:54:12 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2010-01-06 21:54:12 (GMT) |
commit | 425d8d6da99d9b701d6fe2fb7dae01ada7d57a35 (patch) | |
tree | ed95cf349f5e7170125fe2622b4c2479d9fbf900 /src/engine | |
parent | cdd525e880dc93d0c0c898a14815a5590bca6ae6 (diff) | |
download | SCons-425d8d6da99d9b701d6fe2fb7dae01ada7d57a35.zip SCons-425d8d6da99d9b701d6fe2fb7dae01ada7d57a35.tar.gz SCons-425d8d6da99d9b701d6fe2fb7dae01ada7d57a35.tar.bz2 |
Issue 2505: fix use of pre-compiled headers when the source .cpp
file is listed in both the env.PCH() and env.Program() calls.
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/SCons/Tool/msvc.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/engine/SCons/Tool/msvc.py b/src/engine/SCons/Tool/msvc.py index 507e740..920ac7c 100644 --- a/src/engine/SCons/Tool/msvc.py +++ b/src/engine/SCons/Tool/msvc.py @@ -89,8 +89,20 @@ def object_emitter(target, source, env, parent_emitter): parent_emitter(target, source, env) - if env.has_key('PCH') and env['PCH']: - env.Depends(target, env['PCH']) + # Add a dependency, but only if the target (e.g. 'Source1.obj') + # doesn't correspond to the pre-compiled header ('Source1.pch'). + # If the basenames match, then this was most likely caused by + # someone adding the source file to both the env.PCH() and the + # env.Program() calls, and adding the explicit dependency would + # cause a cycle on the .pch file itself. + # + # See issue #2505 for a discussion of what to do if it turns + # out this assumption causes trouble in the wild: + # http://scons.tigris.org/issues/show_bug.cgi?id=2505 + if env.has_key('PCH'): + pch = env['PCH'] + if str(target[0]) != SCons.Util.splitext(str(pch))[0] + '.obj': + env.Depends(target, pch) return (target, source) |