Catch2: make install (#7668)

Add a proper install variant for Catch(2).

This allows to use Catch2 downstram with `pkg-config` and
CMake's `find_package` commands via standard environment hints.
This commit is contained in:
Axel Huebl 2018-04-07 10:36:10 +02:00 committed by Massimiliano Culpo
parent 3bf863bb06
commit 5c98b8bde5

View File

@ -25,12 +25,20 @@
from spack import *
class Catch(Package):
class Catch(CMakePackage):
"""Catch tests"""
homepage = "https://github.com/catchorg/Catch2"
url = "https://github.com/catchorg/Catch2/archive/v1.3.0.tar.gz"
variant('single_header', default=True,
description='Install a single header only.')
# - "make install" was added in 1.7.0
# - pkg-config package was added in 2.0.1
# - CMake config package was added in 2.1.2
conflicts('~single_header', when='@:1.6.1')
version('2.2.1', '54e56803c84890636bd7fe6c3856b104')
version('2.1.0', '70b44068976d46d48f3cd8796f675691d3bc726b')
version('2.0.1', '5c191a031edebd0525640ed2f38cbf64bacb1803')
@ -60,6 +68,15 @@ class Catch(Package):
version('1.3.5', '2cfd78bce21368355c7d3880df88716084df2186')
version('1.3.0', '24cd4e6518273fea20becd47a2e1edbee7ec209a')
@when('+single_header')
def cmake(self, spec, prefix):
pass
@when('+single_header')
def build(self, spec, prefix):
pass
@when('+single_header')
def install(self, spec, prefix):
mkdirp(prefix.include)
install(join_path('single_include', 'catch.hpp'), prefix.include)