%define debug_package %{nil}
%define major 3

# The naming scheme in non-Mandriva-based distros
%if 0%{!?mklibname:1}
%define mklibname(ds)  lib%{1}%{?2:%{2}}%{-s:-static}%{-d:-devel}
%endif

%define libname   %mklibname %{name}_%{major}
%define devel %mklibname %{name} -d

Name: catch2
Version: 3.7.1
Release: 1%{?dist}
Summary: Modern, C++-native, header-only, framework for unit-tests, TDD and BDD
URL: https://github.com/catchorg/Catch2/
Source0: https://github.com/catchorg/Catch2/archive/refs/tags/v%{version}/Catch2-%{version}.tar.gz
License: BSL-1.0
Group: System/Libraries

BuildRequires: cmake
BuildRequires: gcc-c++

%description
Catch stands for C++ Automated Test Cases in Headers and is a
multi-paradigm automated test framework for C++ and Objective-C (and,
maybe, C). It is implemented entirely in a set of header files, but
is packaged up as a single header for extra convenience.

%package        -n %{devel}
Summary:        Development files for %{name}
Provides:       %{name}-static = %{version}-%{release}
Requires:	%{libname} = %{version}-%{release}
 
%description    -n %{devel}
Catch stands for C++ Automated Test Cases in Headers and is a
multi-paradigm automated test framework for C++ and Objective-C (and,
maybe, C). It is implemented entirely in a set of header files, but
is packaged up as a single header for extra convenience

%package	-n %{libname}
Summary:	Library files for %{name}

%description	-n %{libname}
Catch stands for C++ Automated Test Cases in Headers and is a
multi-paradigm automated test framework for C++ and Objective-C (and,
maybe, C). It is implemented entirely in a set of header files, but
is packaged up as a single header for extra convenience

%prep
%autosetup -p 1 -n Catch2-%{version}

%build
%cmake \
    -DCATCH_BUILD_EXTRA_TESTS=ON \
    -DCATCH_ENABLE_WERROR=OFF \
    -DCATCH_INSTALL_DOCS=OFF \
    -DBUILD_SHARED_LIBS=ON
%cmake_build
	
%install
%cmake_install
 
%check
%ctest

%files -n %{libname}
%{_libdir}/*Catch2*.so{,.*}

%files -n %{devel}
%doc README.md CODE_OF_CONDUCT.md docs
%license LICENSE.txt
%{_includedir}/catch2/
%{_datadir}/Catch2/
%{_datadir}/pkgconfig/catch2*.pc
%{_libdir}/cmake/Catch2/
%{_libdir}/*Catch2*.so