forked from platformio/platformio-core
Fixed handling of `-include
` flag // Resolve #4683
This commit is contained in:
@ -201,13 +201,13 @@ def ParseFlagsExtended(env, flags): # pylint: disable=too-many-branches
|
||||
for k in ("CPPPATH", "LIBPATH"):
|
||||
for i, p in enumerate(result.get(k, [])):
|
||||
p = env.subst(p)
|
||||
result[k][i] = p if os.path.isabs(p) else env.Dir(f"#{p}")
|
||||
if os.path.isdir(p):
|
||||
result[k][i] = os.path.abspath(p)
|
||||
|
||||
# fix relative path for "-include"
|
||||
for i, f in enumerate(result.get("CCFLAGS", [])):
|
||||
if isinstance(f, tuple) and f[0] == "-include":
|
||||
p = env.subst(f[1].get_path())
|
||||
result["CCFLAGS"][i] = (f[0], p if os.path.isabs(p) else env.File(f"#{p}"))
|
||||
result["CCFLAGS"][i] = (f[0], env.subst(f[1].get_path()))
|
||||
|
||||
return result
|
||||
|
||||
|
@ -25,7 +25,7 @@ def test_generic_build(clirunner, validate_cliresult, tmpdir):
|
||||
("-Iinclude", "-Iinclude"),
|
||||
("-include cpppath-include.h", "cpppath-include.h"),
|
||||
("-Iextra_inc", "-Iextra_inc"),
|
||||
("-Inon-existing-dir", "-Inon-existing-dir"),
|
||||
("-Inon-existing-dir", "non-existing-dir"),
|
||||
(
|
||||
"-include $PROJECT_DIR/lib/component/component-forced-include.h",
|
||||
"component-forced-include.h",
|
||||
|
Reference in New Issue
Block a user