# Copyright 2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit cmake

DESCRIPTION="C++11 port of docopt, for beautiful command-line interfaces"
HOMEPAGE="https://github.com/docopt/docopt.cpp"
SRC_URI="
	https://github.com/docopt/docopt.cpp/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
"
S="${WORKDIR}/docopt.cpp-${PV}"

LICENSE="|| ( MIT Boost-1.0 )"
SLOT="0"
KEYWORDS="~amd64"

BDEPEND="
	test? (
		dev-lang/python:2.7
	)
"

IUSE="examples test"
RESTRICT="!test? ( test )"

src_configure() {
	local mycmakeargs=(
		-DWITH_EXAMPLE=$(usex examples)
		-DWITH_TESTS=$(usex test)
	)
	cmake_src_configure
}

src_test() {
	cd "${BUILD_DIR}"
	# note: tests are quick, but it's not verbose
	#
	# second note: cmake made to hardcode paths (with $WORKDIR in it) into
	# run_tests
	./run_tests
}