spack/lib/spack
Seth R. Johnson a8706cc89b
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).
2020-03-16 11:41:19 -07:00
..
docs CMakePackage: convert variants to CMake arguments (#14376) 2020-03-16 11:41:19 -07:00
env Fix FCFLAGS handling for Autotools packages (#14788) 2020-03-03 13:13:38 -08:00
external Buildcache: Install into non-default directory layouts (#13797) 2020-03-16 08:42:23 -05:00
llnl Use shutil.copy2 in install_tree (#15058) 2020-02-19 23:09:26 -06:00
spack CMakePackage: convert variants to CMake arguments (#14376) 2020-03-16 11:41:19 -07:00