From 8fd4e9a9fada055df604813b38f92c975f071414 Mon Sep 17 00:00:00 2001 From: Ben Morgan Date: Tue, 12 Feb 2019 08:40:59 +0000 Subject: xerces-c: Add cxxstd variant (#10561) Add variant to support compiling against main C++ standards if needed for ABI compatibility. Use 'default' value as Xerces-C autoconf system does not enforce a minimum, or set a default, C++ standard. --- var/spack/repos/builtin/packages/xerces-c/package.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/var/spack/repos/builtin/packages/xerces-c/package.py b/var/spack/repos/builtin/packages/xerces-c/package.py index 698bf12da2..1e2d6f3858 100644 --- a/var/spack/repos/builtin/packages/xerces-c/package.py +++ b/var/spack/repos/builtin/packages/xerces-c/package.py @@ -21,6 +21,15 @@ class XercesC(AutotoolsPackage): version('3.2.1', '8f98a81a3589bbc2dad9837452f7d319') version('3.1.4', 'd04ae9d8b2dee2157c6db95fa908abfd') + # Whilst still using Autotools, can use full cxxstd with 'default' + # If build is moved to CMake, then will also need a patch to Xerces-C's + # CMakeLists.txt as a specific standard cannot be forced + variant('cxxstd', + default='default', + values=('default', '98', '11', '14', '17'), + multi=False, + description='Use the specified C++ standard when building') + # It's best to be explicit about the transcoder or else xerces may # choose another value. if sys.platform == 'darwin': @@ -43,6 +52,12 @@ class XercesC(AutotoolsPackage): def flag_handler(self, name, flags): spec = self.spec + # Need to pass -std flag explicitly + if name == 'cxxflags' and spec.variants['cxxstd'].value != 'default': + flags.append(getattr(self.compiler, + 'cxx{0}_flag'.format( + spec.variants['cxxstd'].value))) + # There is no --with-pkg for gnuiconv. if name == 'ldflags' and 'transcoder=gnuiconv' in spec: flags.append(spec['libiconv'].libs.ld_flags) -- cgit v1.2.3-60-g2f50