Skip to content

Commit 6e7f77a

Browse files
committed
Fix issue where vsproj=yes vsproj_gen_only=no sometimes fails to build
Assigning `env["CCFLAGS"]` directly to a variable causes any changes to that variable to also be done to the original env object. This means CCFLAGS would be modified during generation of the VS project with additional flags and other options set by platforms. This would normally not be noticed when just generating the project, but when generating and building at the same time with a compiler that doesn't support VS-style flags, this flag leakage can cause unexpected build failures.
1 parent c374ce2 commit 6e7f77a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

methods.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,7 +1274,7 @@ def get_dependencies(file, env, exts, headers, sources, others):
12741274

12751275
props_template = props_template.replace("%%OUTPUT%%", output)
12761276

1277-
proplist = [format_key_value(v) for v in list(env["CPPDEFINES"])]
1277+
proplist = [format_key_value(j) for j in list(env["CPPDEFINES"])]
12781278
proplist += [format_key_value(j) for j in env.get("VSHINT_DEFINES", [])]
12791279
props_template = props_template.replace("%%DEFINES%%", ";".join(proplist))
12801280

@@ -1283,9 +1283,9 @@ def get_dependencies(file, env, exts, headers, sources, others):
12831283
proplist += [str(j) for j in get_default_include_paths(env)]
12841284
props_template = props_template.replace("%%INCLUDES%%", ";".join(proplist))
12851285

1286-
proplist = env["CCFLAGS"]
1287-
proplist += [x for x in env["CXXFLAGS"] if not x.startswith("$")]
1288-
proplist += [str(j) for j in env.get("VSHINT_OPTIONS", [])]
1286+
proplist = [env.subst("$CCFLAGS")]
1287+
proplist += [env.subst("$CXXFLAGS")]
1288+
proplist += [env.subst("$VSHINT_OPTIONS")]
12891289
props_template = props_template.replace("%%OPTIONS%%", " ".join(proplist))
12901290

12911291
# Windows allows us to have spaces in paths, so we need

0 commit comments

Comments
 (0)