cmake: convert_to_cmake: Fix possible whitespace issues

As reported on forum:
https://esp32.com/viewtopic.php?f=2&t=13565&p=53476#p53453

split() with no arg will match any whitespace sequence not just
a single space, so takes care of case where two spaces are
inserted in the variable value.
This commit is contained in:
Angus Gratton 2019-12-20 10:19:54 +11:00 committed by Angus Gratton
parent 0f4cd40b0c
commit ee8557f69d

View file

@ -78,14 +78,14 @@ def get_component_variables(project_path, component_path):
return None return None
srcs = [] srcs = []
for obj in make_vars["COMPONENT_OBJS"].split(" "): for obj in make_vars["COMPONENT_OBJS"].split():
src = find_src(obj) src = find_src(obj)
if src is not None: if src is not None:
srcs.append(src) srcs.append(src)
make_vars["COMPONENT_SRCS"] = " ".join(srcs) make_vars["COMPONENT_SRCS"] = " ".join(srcs)
else: else:
component_srcs = list() component_srcs = list()
for component_srcdir in make_vars.get("COMPONENT_SRCDIRS", ".").split(" "): for component_srcdir in make_vars.get("COMPONENT_SRCDIRS", ".").split():
component_srcdir_path = os.path.abspath(os.path.join(component_path, component_srcdir)) component_srcdir_path = os.path.abspath(os.path.join(component_path, component_srcdir))
srcs = list() srcs = list()
@ -114,7 +114,7 @@ def convert_project(project_path):
if "PROJECT_NAME" not in project_vars: if "PROJECT_NAME" not in project_vars:
raise RuntimeError("PROJECT_NAME does not appear to be defined in IDF project Makefile at %s" % project_path) raise RuntimeError("PROJECT_NAME does not appear to be defined in IDF project Makefile at %s" % project_path)
component_paths = project_vars["COMPONENT_PATHS"].split(" ") component_paths = project_vars["COMPONENT_PATHS"].split()
# Convert components as needed # Convert components as needed
for p in component_paths: for p in component_paths: