henson: simplify args logic with define_from_variant (#36398)

Co-authored-by: Arnur Nigmetov <nigmetov@tugraz.at>
This commit is contained in:
Arnur Nigmetov 2023-03-24 12:28:20 -07:00 committed by GitHub
parent 693eea499c
commit e4edcf6104
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,15 +26,12 @@ class Henson(CMakePackage):
conflicts("^openmpi", when="+mpi-wrappers")
def cmake_args(self):
args = []
if "+python" in self.spec:
args += ["-Dpython=on"]
else:
args += ["-Dpython=off"]
args = [
self.define_from_variant("python", "python"),
self.define_from_variant("mpi-wrappers", "mpi-wrappers"),
]
if "+mpi-wrappers" in self.spec:
args += ["-Dmpi-wrappers=on"]
else:
args += ["-Dmpi-wrappers=off"]
if self.spec.satisfies("+python"):
args += [self.define("PYTHON_EXECUTABLE", self.spec["python"].command.path)]
return args