superlu-dist: do not discard cflags from Spack (#37260)

Make sure to append additional flags needed for specific compilers
in the flag_handler instead of adding them as separate cmake define
lines that override the main spack cflags.
This commit is contained in:
Victor Brunini 2023-04-28 06:37:58 -07:00 committed by GitHub
parent c85877566f
commit 4363b1c2dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -101,16 +101,6 @@ def append_from_variant(*args):
[spec["parmetis"].prefix.include, spec["metis"].prefix.include],
)
if (spec.satisfies("%xl") or spec.satisfies("%xl_r")) and spec.satisfies("@:6.1.1"):
append_define("CMAKE_C_FLAGS", "-DNoChange")
if spec.satisfies("%oneapi") or spec.satisfies("%arm@23.04:"):
#
# 2022 and later Intel OneAPI compilers and Arm compilers version 23.04 and later
# throw errors compiling some of the non ISO C99 compliant code in this package
# see https://reviews.llvm.org/D122983
#
append_define("CMAKE_C_FLAGS", "-Wno-error=implicit-function-declaration")
append_define("XSDK_INDEX_SIZE", "64" if "+int64" in spec else "32")
append_from_variant("enable_openmp", "openmp")
@ -142,7 +132,20 @@ def flag_handler(self, name, flags):
flags.append(self.compiler.cxx11_flag)
if name == "cflags" and "%pgi" not in self.spec:
flags.append("-std=c99")
if name == "cflags" and self.spec.satisfies("%oneapi"):
if (
name == "cflags"
and (self.spec.satisfies("%xl") or self.spec.satisfies("%xl_r"))
and self.spec.satisfies("@:6.1.1")
):
flags.append("-DNoChange")
if name == "cflags" and (
self.spec.satisfies("%oneapi") or self.spec.satisfies("%arm@23.04:")
):
#
# 2022 and later Intel OneAPI compilers and Arm compilers version 23.04 and later
# throw errors compiling some of the non ISO C99 compliant code in this package
# see https://reviews.llvm.org/D122983
#
flags.append("-Wno-error=implicit-function-declaration")
return (None, None, flags)