From 4c3005673e526aa6f8da25ee74a8ea229facd3a3 Mon Sep 17 00:00:00 2001 From: Nic McDonald Date: Fri, 9 Jul 2021 02:54:14 -0600 Subject: [PATCH] abseil-cpp: add cxxstd variant (#24577) --- .../repos/builtin/packages/abseil-cpp/package.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/var/spack/repos/builtin/packages/abseil-cpp/package.py b/var/spack/repos/builtin/packages/abseil-cpp/package.py index 0bf28861a7..f58e6af372 100644 --- a/var/spack/repos/builtin/packages/abseil-cpp/package.py +++ b/var/spack/repos/builtin/packages/abseil-cpp/package.py @@ -31,8 +31,14 @@ class AbseilCpp(CMakePackage): conflicts('+shared', when='@:20190808') + variant('cxxstd', values=('11', '14', '17', '20'), default='11', + description="C++ standard used during compilation") + def cmake_args(self): - args = ["-DBUILD_TESTING=OFF", "-DCMAKE_CXX_STANDARD=11"] - args.append('-DBUILD_SHARED_LIBS:Bool={0}'.format( - 'ON' if '+shared' in self.spec else 'OFF')) - return args + shared = 'ON' if '+shared' in self.spec else 'OFF' + cxxstd = self.spec.variants['cxxstd'].value + return [ + self.define('BUILD_TESTING', 'OFF'), + self.define('BUILD_SHARED_LIBS:Bool', shared), + self.define('CMAKE_CXX_STANDARD', cxxstd) + ]