diff options
author | Seth R. Johnson <johnsonsr@ornl.gov> | 2020-03-16 14:41:19 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-16 11:41:19 -0700 |
commit | a8706cc89b49fadadc644cdbb7077743fcc58b4b (patch) | |
tree | 674d4644408b5cd38422ee207c0ea2cb7b200411 /NOTICE | |
parent | 55d5adfecfdaa097724ca75bdcb4b92251697e97 (diff) | |
download | spack-a8706cc89b49fadadc644cdbb7077743fcc58b4b.tar.gz spack-a8706cc89b49fadadc644cdbb7077743fcc58b4b.tar.bz2 spack-a8706cc89b49fadadc644cdbb7077743fcc58b4b.tar.xz spack-a8706cc89b49fadadc644cdbb7077743fcc58b4b.zip |
CMakePackage: convert variants to CMake arguments (#14376)
Add a 'define_from_variant` helper function to CMake-based Spack
packages to convert package variants into CMake arguments. For
example:
args.append('-DFOO=%s' % ('ON' if '+foo' in self.spec else 'OFF'))
can be replaced with:
args.append(self.define_from_variant('foo'))
The following conversions are handled automatically:
* Flag variants will be converted to CMake booleans
* Multivalued variants will be converted to semicolon-separated strings
* Other variant values are converted to CMake string arguments
This also adds a 'define' helper method to convert any variable to
a CMake argument. It has the same conversion rules as
'define_from_variant' (but operates directly on values rather than
requiring the user to supply the name of a package variant).
Diffstat (limited to 'NOTICE')
0 files changed, 0 insertions, 0 deletions