summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Morgan <drbenmorgan@users.noreply.github.com>2019-02-12 08:40:59 +0000
committerMassimiliano Culpo <massimiliano.culpo@gmail.com>2019-02-12 09:40:59 +0100
commit8fd4e9a9fada055df604813b38f92c975f071414 (patch)
treeb2be27f56947c39bb0adbc24348d3d0cb7f52ccf
parentdc12ca5c769f56aca4e7fdf768d3c8454fdc51f7 (diff)
downloadspack-8fd4e9a9fada055df604813b38f92c975f071414.tar.gz
spack-8fd4e9a9fada055df604813b38f92c975f071414.tar.bz2
spack-8fd4e9a9fada055df604813b38f92c975f071414.tar.xz
spack-8fd4e9a9fada055df604813b38f92c975f071414.zip
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.
-rw-r--r--var/spack/repos/builtin/packages/xerces-c/package.py15
1 files changed, 15 insertions, 0 deletions
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)