hdf5: fix compiler detection in flag_handler (#24451)
The original implementation of `flag_handler` searched the `self.compiler.cc` string for `clang` or `gcc` in order to add a flag for those compilers. This approach fails when using a spack-installed compiler that was itself built with gcc or clang, as those strings will appear in the fully-qualified compiler executable paths. This commit switches to searching for `%gcc` or `%clang` in `self.spec`. Co-authored-by: Paul Henning <phenning@lanl.gov>
This commit is contained in:
parent
5e48d2c16f
commit
3039237a0e
@ -185,7 +185,7 @@ def flag_handler(self, name, flags):
|
||||
|
||||
# Quiet warnings/errors about implicit declaration of functions in C99
|
||||
if name == "cflags":
|
||||
if "clang" in self.compiler.cc or "gcc" in self.compiler.cc:
|
||||
if "%clang" in self.spec or "%gcc" in self.spec:
|
||||
flags.append("-Wno-implicit-function-declaration")
|
||||
|
||||
return (None, None, flags)
|
||||
|
Loading…
Reference in New Issue
Block a user