Skip to content

Commit 2043690

Browse files
committed
Ensure transitive dependencies for headers and libraries are always available
1 parent a33270f commit 2043690

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

easybuild/tools/toolchain/toolchain.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,6 +1191,22 @@ def _add_dependency_variables(self, names=None, cpp=None, ld=None):
11911191
else:
11921192
dep_roots.extend(self.get_software_root(dep['name']))
11931193

1194+
# Exactly how the include headers or link libraries are going to be referenced is configuration dependent,
1195+
# gather all the options and add them as fallback options for the chosen method
1196+
# (allows for transitive dependencies)
1197+
paths_options = {'cpp_headers': [], 'linker': []}
1198+
for search_path_var, paths_list in paths_options.items:
1199+
for env_var in [y for x in SEARCH_PATH[search_path_var].values() for y in x if y.endswith('PATH')]:
1200+
paths = os.getenv(env_var)
1201+
if paths:
1202+
self.log.debug(f"Determining fallback directories to retain from ${env_var}: {paths}")
1203+
paths_list = unique_ordered_extend(paths_list, paths.split(':'))
1204+
# Now that we have the value, we make sure that EasyBuild will reset the environment variable later
1205+
# (and only use the configured option)
1206+
self.variables.append(env_var, '')
1207+
for var in SEARCH_PATH[search_path_var][self.search_path[search_path_var]]:
1208+
self.variables.append_subdirs(var, paths_list)
1209+
11941210
for dep_root in dep_roots:
11951211
self._add_dependency_cpp_headers(dep_root, extra_dirs=cpp)
11961212
self._add_dependency_linker_paths(dep_root, extra_dirs=ld)

0 commit comments

Comments
 (0)