From 55eae72bb0a2c58cd15fc43d8ca23e90cd84cdfe Mon Sep 17 00:00:00 2001 From: "Daryl W. Grunau" Date: Thu, 25 Feb 2021 18:06:02 -0700 Subject: pegtl: manage options to build examples and tests when run_tests (#21866) Co-authored-by: Daryl W. Grunau --- var/spack/repos/builtin/packages/pegtl/package.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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) -- cgit v1.2.3-70-g09d2