cmake: Move cxx11 flags for fujitsu into the flag_handler method (#12056)

* cmake: Move cxx11 flags for fujitsu into the flag_handler method

* cmake: sanitization and error checking in flag_handler

* cmake: Fix fujitsu flag check from 'fc' to 'fj'
This commit is contained in:
Chuck Atkins 2019-07-22 18:33:40 -04:00 committed by Greg Becker
parent 8cef81363c
commit 69c302f455

View File

@ -111,11 +111,16 @@ class Cmake(Package):
phases = ['bootstrap', 'build', 'install']
def setup_environment(self, spack_env, run_env):
if self.compiler.name == 'fj' \
and self.compiler.cxx11_flag \
not in self.spec.compiler_flags['cxxflags']:
spack_env.append_flags('CXXFLAGS', self.compiler.cxx11_flag)
def flag_handler(self, name, flags):
if name == 'cxxflags' and self.compiler.name == 'fj':
cxx11plus_flags = (self.compiler.cxx11_flag,
self.compiler.cxx14_flag)
cxxpre11_flags = (self.cxx98_flags)
if any(f in flags for f in cxxpre11_flags):
raise ValueError('cannot build cmake pre-c++11 standard')
elif not any(f in flags for f in cxx11plus_flags):
flags.append(self.compiler.cxx11_flag)
return (flags, None, None)
def bootstrap_args(self):
spec = self.spec