summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaryl W. Grunau <DarylGrunau@gmail.com>2021-02-25 18:06:02 -0700
committerGitHub <noreply@github.com>2021-02-25 17:06:02 -0800
commit55eae72bb0a2c58cd15fc43d8ca23e90cd84cdfe (patch)
tree17dbad97ed504607aa7964e02259cf5a6ea5d727
parent44530588628d4a7b12e76b332d03b5b5cab60378 (diff)
downloadspack-55eae72bb0a2c58cd15fc43d8ca23e90cd84cdfe.tar.gz
spack-55eae72bb0a2c58cd15fc43d8ca23e90cd84cdfe.tar.bz2
spack-55eae72bb0a2c58cd15fc43d8ca23e90cd84cdfe.tar.xz
spack-55eae72bb0a2c58cd15fc43d8ca23e90cd84cdfe.zip
pegtl: manage options to build examples and tests when run_tests (#21866)
Co-authored-by: Daryl W. Grunau <dwg@lanl.gov>
-rw-r--r--var/spack/repos/builtin/packages/pegtl/package.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/pegtl/package.py b/var/spack/repos/builtin/packages/pegtl/package.py
index 96cad29eec..148d972667 100644
--- a/var/spack/repos/builtin/packages/pegtl/package.py
+++ b/var/spack/repos/builtin/packages/pegtl/package.py
@@ -25,3 +25,25 @@ class Pegtl(CMakePackage):
# Ref: https://github.com/taocpp/PEGTL/blob/master/src/example/pegtl/json_classes.hpp
patch('change_to_virtual_destructor.patch', when='@:2.4')
+
+ def cmake_args(self):
+
+ args = []
+ if self.run_tests:
+ args.extend([
+ '-DPEGTL_BUILD_EXAMPLES=ON',
+ '-DPEGTL_BUILD_TESTS=ON'
+ ])
+ else:
+ args.extend([
+ '-DPEGTL_BUILD_EXAMPLES=OFF',
+ '-DPEGTL_BUILD_TESTS=OFF'
+ ])
+
+ return args
+
+ @run_after('build')
+ @on_package_attributes(run_tests=True)
+ def check(self):
+ with working_dir(self.build_directory):
+ make('test', parallel=False)