summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAdam J. Stewart <ajstewart426@gmail.com>2017-07-25 18:34:43 -0500
committerTodd Gamblin <tgamblin@llnl.gov>2017-07-25 16:34:43 -0700
commit07aec4366fa8926ee896fdb2f0c5a68dad3267b5 (patch)
tree82e46050aa55b182f4b4ae695ebd0b43865f62ef /lib
parent4b996e9f499e801db4ce211be79ce56d2ce75678 (diff)
downloadspack-07aec4366fa8926ee896fdb2f0c5a68dad3267b5.tar.gz
spack-07aec4366fa8926ee896fdb2f0c5a68dad3267b5.tar.bz2
spack-07aec4366fa8926ee896fdb2f0c5a68dad3267b5.tar.xz
spack-07aec4366fa8926ee896fdb2f0c5a68dad3267b5.zip
Add universal build_type variant to CMakePackage (#4797)
* Add universal build_type variant to CMakePackage * Override build_type in some packages with different possible values * Remove reference to no longer existent debug variant * Update CBTF packages with new build_type variant * Keep note on build size of LLVM
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/build_systems/cmake.py23
1 files changed, 8 insertions, 15 deletions
diff --git a/lib/spack/spack/build_systems/cmake.py b/lib/spack/spack/build_systems/cmake.py
index b339858348..db3240e8a5 100644
--- a/lib/spack/spack/build_systems/cmake.py
+++ b/lib/spack/spack/build_systems/cmake.py
@@ -29,7 +29,7 @@ import platform
import spack.build_environment
from llnl.util.filesystem import working_dir, join_path
-from spack.directives import depends_on
+from spack.directives import depends_on, variant
from spack.package import PackageBase, run_after
@@ -49,11 +49,6 @@ class CMakePackage(PackageBase):
+-----------------------------------------------+--------------------+
| **Method** | **Purpose** |
+===============================================+====================+
- | :py:meth:`~.CMakePackage.build_type` | Specify the value |
- | | for the |
- | | CMAKE_BUILD_TYPE |
- | | variable |
- +-----------------------------------------------+--------------------+
| :py:meth:`~.CMakePackage.root_cmakelists_dir` | Location of the |
| | root CMakeLists.txt|
+-----------------------------------------------+--------------------+
@@ -74,14 +69,12 @@ class CMakePackage(PackageBase):
build_time_test_callbacks = ['check']
- depends_on('cmake', type='build')
-
- def build_type(self):
- """Returns the correct value for the ``CMAKE_BUILD_TYPE`` variable
+ # https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html
+ variant('build_type', default='RelWithDebInfo',
+ description='The build type to build',
+ values=('Debug', 'Release', 'RelWithDebInfo', 'MinSizeRel'))
- :return: value for ``CMAKE_BUILD_TYPE``
- """
- return 'RelWithDebInfo'
+ depends_on('cmake', type='build')
@property
def root_cmakelists_dir(self):
@@ -108,8 +101,8 @@ class CMakePackage(PackageBase):
def _std_args(pkg):
"""Computes the standard cmake arguments for a generic package"""
try:
- build_type = pkg.build_type()
- except AttributeError:
+ build_type = pkg.spec.variants['build_type'].value
+ except KeyError:
build_type = 'RelWithDebInfo'
args = ['-DCMAKE_INSTALL_PREFIX:PATH={0}'.format(pkg.prefix),