ascent package: capture spack global flags in host config (#23826)

This commit is contained in:
Cyrus Harrison 2021-05-24 16:50:38 -07:00 committed by GitHub
parent 9426b26c22
commit 231490ce9a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -352,6 +352,23 @@ def create_host_config(self, spec, prefix, py_site_pkgs_dir=None):
else:
cfg.write(cmake_cache_entry("BUILD_SHARED_LIBS", "OFF"))
# use global spack compiler flags
cppflags = ' '.join(spec.compiler_flags['cppflags'])
if cppflags:
# avoid always ending up with ' ' with no flags defined
cppflags += ' '
cflags = cppflags + ' '.join(spec.compiler_flags['cflags'])
if cflags:
cfg.write(cmake_cache_entry("CMAKE_C_FLAGS", cflags))
cxxflags = cppflags + ' '.join(spec.compiler_flags['cxxflags'])
if cxxflags:
cfg.write(cmake_cache_entry("CMAKE_CXX_FLAGS", cxxflags))
fflags = ' '.join(spec.compiler_flags['fflags'])
if self.spec.satisfies('%cce'):
fflags += " -ef"
if fflags:
cfg.write(cmake_cache_entry("CMAKE_Fortran_FLAGS", fflags))
#######################
# Unit Tests
#######################