Allow `required : false` for OpenMP dependency

* Currently `required : true` is implicitly assumed, making
  optional use of OpenMP not possible.
0.46
David Seifert 7 years ago committed by Nirbheek Chauhan
parent 73adac113e
commit 72e56d6395
  1. 8
      mesonbuild/dependencies/misc.py

@ -253,7 +253,13 @@ class OpenMPDependency(ExternalDependency):
language = kwargs.get('language') language = kwargs.get('language')
super().__init__('openmp', environment, language, kwargs) super().__init__('openmp', environment, language, kwargs)
self.is_found = False self.is_found = False
openmp_date = self.compiler.get_define('_OPENMP', '', self.env, [], [self]) try:
openmp_date = self.compiler.get_define('_OPENMP', '', self.env, [], [self])
except mesonlib.EnvironmentException as e:
mlog.debug('OpenMP support not available in the compiler')
mlog.debug(e)
openmp_date = False
if openmp_date: if openmp_date:
self.version = self.VERSIONS[openmp_date] self.version = self.VERSIONS[openmp_date]
if self.compiler.has_header('omp.h', '', self.env, dependencies=[self]): if self.compiler.has_header('omp.h', '', self.env, dependencies=[self]):

Loading…
Cancel
Save