diff options
author | Adam Gross <grossag@vmware.com> | 2019-07-18 19:20:08 (GMT) |
---|---|---|
committer | Adam Gross <grossag@vmware.com> | 2019-07-18 20:35:54 (GMT) |
commit | b3dcc756c51b86220685acf88d4f5dea49af307f (patch) | |
tree | a03eb62e354eb286ca57b753145ccef02a3133ab /src/engine | |
parent | a50f82ba0673e6922504e74dad3bb259e9edc0d3 (diff) | |
download | SCons-b3dcc756c51b86220685acf88d4f5dea49af307f.zip SCons-b3dcc756c51b86220685acf88d4f5dea49af307f.tar.gz SCons-b3dcc756c51b86220685acf88d4f5dea49af307f.tar.bz2 |
Fix msvs tests
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/SCons/Tool/msvs.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/engine/SCons/Tool/msvs.py b/src/engine/SCons/Tool/msvs.py index 7dd1dc7..d27294b 100644 --- a/src/engine/SCons/Tool/msvs.py +++ b/src/engine/SCons/Tool/msvs.py @@ -477,6 +477,13 @@ class _DSPGenerator(object): self.sconscript = env['MSVSSCONSCRIPT'] def GetKeyFromEnv(env, key, variants): + """ + Retrieves a specific key from the environment. If the key is + present, it is expected to either be a string or a list with length + equal to the number of variants. The function returns a list of + the desired value (e.g. cpp include paths) guaranteed to be of + length equal to the length of the variants list. + """ if key not in env or env[key] is None: return [''] * len(variants) elif SCons.Util.is_String(env[key]): @@ -491,8 +498,19 @@ class _DSPGenerator(object): (key, type(env[key]))) cmdargs = GetKeyFromEnv(env, 'cmdargs', variants) - cppdefines = GetKeyFromEnv(env, 'cppdefines', variants) - cpppaths = GetKeyFromEnv(env, 'cpppaths', variants) + + # The caller is allowed to put 'cppdefines' and/or 'cpppaths' in the + # environment, which is useful if they want to provide per-variant + # values for these. Otherwise, we fall back to using the global + # 'CPPDEFINES' and 'CPPPATH' functions. + if 'cppdefines' in env: + cppdefines = GetKeyFromEnv(env, 'cppdefines', variants) + else: + cppdefines = [env.get('CPPDEFINES', [])] * len(variants) + if 'cpppaths' in env: + cpppaths = GetKeyFromEnv(env, 'cpppaths', variants) + else: + cpppaths = [env.get('CPPPATH', [])] * len(variants) self.env = env |