Merge user provided CPPFLAGS with build system CPPFLAGS (#1261)

This commit is contained in:
Michael Allwright 2024-08-14 18:18:09 +02:00 committed by GitHub
parent 4d2cb3e78d
commit d9367d28ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 1 deletions

View File

@ -26,7 +26,10 @@ def get_make_env_vars(
# -I flags should be put into preprocessor flags, CPPFLAGS
# https://www.gnu.org/software/autoconf/manual/autoconf-2.63/html_node/Preset-Output-Variables.html
vars["CPPFLAGS"] = deps_flags.flags
if "CPPFLAGS" in vars.keys():
vars["CPPFLAGS"] = vars["CPPFLAGS"] + deps_flags.flags
else:
vars["CPPFLAGS"] = deps_flags.flags
return " ".join(["{}=\"{}\""
.format(key, _join_flags_list(workspace_name, vars[key])) for key in vars])
@ -108,6 +111,11 @@ def _get_make_variables(workspace_name, tools, flags, user_env_vars, make_comman
if toolchain_flags or user_flags:
vars[flag] = toolchain_flags + user_flags
# Add user defined CPPFLAGS
user_cpp_flags = [flag for flag in user_env_vars.get("CPPFLAGS", "").split(" ") if flag]
if user_cpp_flags:
vars["CPPFLAGS"] = user_cpp_flags
tools_dict = {}
for tool in _MAKE_TOOLS:
tool_value = getattr(tools, _MAKE_TOOLS[tool])