summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorAlec Scott <hi@alecbcs.com>2024-11-13 07:20:56 -0800
committerGitHub <noreply@github.com>2024-11-13 08:20:56 -0700
commit93bf0634f35d832b4e77de9893c16a9d564f4365 (patch)
tree209d499f7834febf51a66170e8e94f8ef04c6abe /var
parentbadb3cedcd83a4f3f38bb3ec5612f1e1f8a222cf (diff)
downloadspack-93bf0634f35d832b4e77de9893c16a9d564f4365.tar.gz
spack-93bf0634f35d832b4e77de9893c16a9d564f4365.tar.bz2
spack-93bf0634f35d832b4e77de9893c16a9d564f4365.tar.xz
spack-93bf0634f35d832b4e77de9893c16a9d564f4365.zip
nlopt: reformat for best practices (#47340)
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/nlopt/package.py29
1 files changed, 8 insertions, 21 deletions
diff --git a/var/spack/repos/builtin/packages/nlopt/package.py b/var/spack/repos/builtin/packages/nlopt/package.py
index 132fff424c..f2967c46f7 100644
--- a/var/spack/repos/builtin/packages/nlopt/package.py
+++ b/var/spack/repos/builtin/packages/nlopt/package.py
@@ -21,7 +21,6 @@ class Nlopt(CMakePackage):
license("LGPL-2.1-or-later")
version("master", branch="master")
-
version("2.8.0", sha256="e02a4956a69d323775d79fdaec7ba7a23ed912c7d45e439bc933d991ea3193fd")
version("2.7.1", sha256="db88232fa5cef0ff6e39943fc63ab6074208831dc0031cf1545f6ecd31ae2a1a")
version("2.7.0", sha256="b881cc2a5face5139f1c5a30caf26b7d3cb43d69d5e423c9d78392f99844499f")
@@ -53,26 +52,14 @@ class Nlopt(CMakePackage):
extends("python", when="+python")
def cmake_args(self):
- # Add arguments other than
- # CMAKE_INSTALL_PREFIX and CMAKE_BUILD_TYPE
spec = self.spec
- args = []
-
- # Specify on command line to alter defaults:
- # eg: spack install nlopt@master +guile -octave +cxx
-
- # On is default
- if "~shared" in spec:
- args.append("-DBUILD_SHARED_LIBS:Bool=OFF")
-
- # On is default
- if "~octave" in spec:
- args.append("-DNLOPT_OCTAVE:Bool=OFF")
-
- if "+cxx" in spec:
- args.append("-DNLOPT_CXX:BOOL=ON")
-
- if "+matlab" in spec:
- args.append("-DMatlab_ROOT_DIR=%s" % spec["matlab"].command.path)
+ args = [
+ self.define_from_variant("BUILD_SHARED_LIBS", "shared"),
+ self.define_from_variant("NLOPT_OCTAVE", "octave"),
+ self.define_from_variant("NLOPT_CXX", "cxx"),
+ ]
+
+ if spec.satisfies("+matlab"):
+ args.append(self.define("Matlab_ROOT_DIR", spec["matlab"].command.path))
return args