dependencies/openmp: Simplify error case

Instead of making the variable optional, just return if we hit the error
case, since that's all that's going to happen anyway
pull/13356/head
Dylan Baker 7 months ago committed by Eli Schwartz
parent d6bddafa26
commit ef83d943d9
  1. 35
      mesonbuild/dependencies/misc.py

@ -118,25 +118,24 @@ class OpenMPDependency(SystemDependency):
except mesonlib.EnvironmentException as e:
mlog.debug('OpenMP support not available in the compiler')
mlog.debug(e)
openmp_date = None
if openmp_date:
try:
self.version = self.VERSIONS[openmp_date]
except KeyError:
mlog.debug(f'Could not find an OpenMP version matching {openmp_date}')
if openmp_date == '_OPENMP':
mlog.debug('This can be caused by flags such as gcc\'s `-fdirectives-only`, which affect preprocessor behavior.')
return
return
# Flang has omp_lib.h
header_names = ('omp.h', 'omp_lib.h')
for name in header_names:
if self.clib_compiler.has_header(name, '', self.env, dependencies=[self], disable_cache=True)[0]:
self.is_found = True
break
else:
mlog.warning('OpenMP found but omp.h missing.', fatal=False)
try:
self.version = self.VERSIONS[openmp_date]
except KeyError:
mlog.debug(f'Could not find an OpenMP version matching {openmp_date}')
if openmp_date == '_OPENMP':
mlog.debug('This can be caused by flags such as gcc\'s `-fdirectives-only`, which affect preprocessor behavior.')
return
# Flang has omp_lib.h
header_names = ('omp.h', 'omp_lib.h')
for name in header_names:
if self.clib_compiler.has_header(name, '', self.env, dependencies=[self], disable_cache=True)[0]:
self.is_found = True
break
else:
mlog.warning('OpenMP found but omp.h missing.', fatal=False)
packages['openmp'] = OpenMPDependency

Loading…
Cancel
Save