From 7e8b8d61a14f9b62a7024eed198d869b3f9f93c7 Mon Sep 17 00:00:00 2001 From: Ben Morgan Date: Thu, 14 Feb 2019 05:05:39 +0000 Subject: icu4c: Add cxxstd variant (#10552) * icu4c: Add cxxstd variant For versions supported in Spack, ICU4C defaults to the C++11. Provide a variant to default to this, plus options for C++14 and 17 if dependees require for ABI compatibility. * icu4c: cxxstd variant cannot be multi --- var/spack/repos/builtin/packages/icu4c/package.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/var/spack/repos/builtin/packages/icu4c/package.py b/var/spack/repos/builtin/packages/icu4c/package.py index 29661177f4..4b9474e2a1 100644 --- a/var/spack/repos/builtin/packages/icu4c/package.py +++ b/var/spack/repos/builtin/packages/icu4c/package.py @@ -20,12 +20,27 @@ class Icu4c(AutotoolsPackage): version('58.2', 'fac212b32b7ec7ab007a12dff1f3aea1') version('57.1', '976734806026a4ef8bdd17937c8898b9') + variant('cxxstd', + default='11', + values=('11', '14', '17'), + multi=False, + description='Use the specified C++ standard when building') + configure_directory = 'source' def url_for_version(self, version): url = "http://download.icu-project.org/files/icu4c/{0}/icu4c-{1}-src.tgz" return url.format(version.dotted, version.underscored) + def flag_handler(self, name, flags): + if name == 'cxxflags': + # Control of the C++ Standard is via adding the required "-std" + # flag to CXXFLAGS in env + flags.append(getattr(self.compiler, + 'cxx{0}_flag'.format( + self.spec.variants['cxxstd'].value))) + return (None, flags, None) + def configure_args(self): args = [] -- cgit v1.2.3-70-g09d2