Fix scanning of Fortran sources created during configuration
@@ -1693,12 +1693,13 @@ rule FORTRAN_DEP_HACK
modre = re.compile(r"\s*module\s+(\w+)", re.IGNORECASE)
module_files = {}
for s in target.get_sources():
- # FIXME, does not work for generated Fortran sources,
- # but those are really rare. I hope.
+ # FIXME, does not work for Fortran sources generated by
+ # custom_target() and generator() as those are run after
+ # the configuration (configure_file() is OK)
if not compiler.can_compile(s):
continue
- filename = os.path.join(self.environment.get_source_dir(),
- s.subdir, s.fname)
+ filename = s.absolute_path(self.environment.get_source_dir(),
+ self.environment.get_build_dir())
with open(filename) as f:
for line in f:
modmatch = modre.match(line)
