summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarmen Stoppels <harmenstoppels@gmail.com>2021-02-26 09:49:00 +0100
committerGitHub <noreply@github.com>2021-02-26 09:49:00 +0100
commit27ef9f0e078f5abc897d2fd891a1afe9908b6532 (patch)
tree13476ee39e4776ce70d2fcea93988164f2c15ae4
parentb13a5060902c0ac047cdf7230479fe5f70b74bad (diff)
downloadspack-27ef9f0e078f5abc897d2fd891a1afe9908b6532.tar.gz
spack-27ef9f0e078f5abc897d2fd891a1afe9908b6532.tar.bz2
spack-27ef9f0e078f5abc897d2fd891a1afe9908b6532.tar.xz
spack-27ef9f0e078f5abc897d2fd891a1afe9908b6532.zip
CMake: add a "build_type" variant (#21958)
This permits to use MinSizeRel or other build types where they are a better fit.
-rw-r--r--var/spack/repos/builtin/packages/cmake/package.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/var/spack/repos/builtin/packages/cmake/package.py b/var/spack/repos/builtin/packages/cmake/package.py
index d08b8149db..b9e75a87c5 100644
--- a/var/spack/repos/builtin/packages/cmake/package.py
+++ b/var/spack/repos/builtin/packages/cmake/package.py
@@ -103,6 +103,10 @@ class Cmake(Package):
version('3.0.2', sha256='6b4ea61eadbbd9bec0ccb383c29d1f4496eacc121ef7acf37c7a24777805693e')
version('2.8.10.2', sha256='ce524fb39da06ee6d47534bbcec6e0b50422e18b62abc4781a4ba72ea2910eb1')
+ variant('build_type', default='Release',
+ description='CMake build type',
+ values=('Debug', 'Release', 'RelWithDebInfo', 'MinSizeRel'))
+
# Revert the change that introduced a regression when parsing mpi link
# flags, see: https://gitlab.kitware.com/cmake/cmake/issues/19516
patch('cmake-revert-findmpi-link-flag-list.patch', when='@3.15.0')
@@ -240,8 +244,8 @@ class Cmake(Package):
# Now for CMake arguments to pass after the initial bootstrap
args.append('--')
- # Make sure to create an optimized release build
- args.append('-DCMAKE_BUILD_TYPE=Release')
+ args.append('-DCMAKE_BUILD_TYPE={0}'.format(
+ self.spec.variants['build_type'].value))
# Install CMake correctly, even if `spack install` runs
# inside a ctest environment