trilinos: Fix cxxstd effects for Trilinos versions <13 (#28663)

This commit is contained in:
Paul Kuberry 2022-01-31 00:41:21 -07:00 committed by GitHub
parent 1679274ac2
commit fff9a29401
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -260,7 +260,7 @@ class Trilinos(CMakePackage, CudaPackage, ROCmPackage):
msg='Cannot build Trilinos with STK as a shared library on Darwin.'
)
conflicts('+adios2', when='@:12.14.1')
conflicts('cxxstd=11', when='@master:')
conflicts('cxxstd=11', when='@13.2:')
conflicts('cxxstd=17', when='@:12')
conflicts('cxxstd=11', when='+wrapper ^cuda@6.5.14')
conflicts('cxxstd=14', when='+wrapper ^cuda@6.5.14:8.0.61')
@ -456,7 +456,6 @@ def define_enable(suffix, value=None):
options.extend([
define('Trilinos_VERBOSE_CONFIGURE', False),
define_from_variant('BUILD_SHARED_LIBS', 'shared'),
define_from_variant('CMAKE_CXX_STANDARD', 'cxxstd'),
define_trilinos_enable('ALL_OPTIONAL_PACKAGES', False),
define_trilinos_enable('ALL_PACKAGES', False),
define_trilinos_enable('CXX11', True),
@ -470,6 +469,18 @@ def define_enable(suffix, value=None):
'explicit_template_instantiation')
])
if spec.version >= Version('13'):
options.append(define_from_variant('CMAKE_CXX_STANDARD', 'cxxstd'))
else:
# Prior to version 13, Trilinos would erroneously inject
# '-std=c++11' regardless of CMAKE_CXX_STANDARD value
options.append(define(
'Trilinos_CXX11_FLAGS',
self.compiler.cxx14_flag
if spec.variants['cxxstd'].value == '14'
else self.compiler.cxx11_flag
))
# ################## Trilinos Packages #####################
options.extend([
@ -524,10 +535,6 @@ def define_enable(suffix, value=None):
define_from_variant('Amesos2_ENABLE_LAPACK', 'amesos2'),
])
if spec.version < Version('13'):
# Suppress TriBITS flags in favor of CMake's built-in flags
options.append(define('Trilinos_CXX11_FLAGS', ' '))
if '+dtk' in spec:
options.extend([
define('Trilinos_EXTRA_REPOSITORIES', 'DataTransferKit'),