mirror of
https://github.com/gentoo-mirror/guru.git
synced 2026-07-09 15:13:31 -04:00
dev-cpp/mustache: unbundle test dependency
Make test compilation optional. Signed-off-by: Lucio Sauer <watermanpaint@posteo.net>
This commit is contained in:
@@ -0,0 +1,48 @@
|
|||||||
|
Unbundle test dependency dev-cpp/catch and make test compilation optional.
|
||||||
|
|
||||||
|
Author: Lucio Sauer <watermanpaint@posteo.net>
|
||||||
|
--- a/CMakeLists.txt
|
||||||
|
+++ b/CMakeLists.txt
|
||||||
|
@@ -2,7 +2,12 @@ cmake_minimum_required(VERSION 3.0.2)
|
||||||
|
project(mustache)
|
||||||
|
add_library(mustache INTERFACE)
|
||||||
|
|
||||||
|
+option(TESTS "build tests")
|
||||||
|
+
|
||||||
|
target_compile_features(mustache INTERFACE cxx_std_17)
|
||||||
|
target_sources(mustache INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/mustache.hpp)
|
||||||
|
target_include_directories(mustache INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
-add_subdirectory(tests)
|
||||||
|
\ No newline at end of file
|
||||||
|
+
|
||||||
|
+if (TESTS)
|
||||||
|
+ add_subdirectory(tests)
|
||||||
|
+endif (TESTS)
|
||||||
|
--- a/tests/CMakeLists.txt
|
||||||
|
+++ b/tests/CMakeLists.txt
|
||||||
|
@@ -1,10 +1,12 @@
|
||||||
|
+find_package(Catch2 REQUIRED)
|
||||||
|
+
|
||||||
|
add_executable(mustache-unit-tests
|
||||||
|
../mustache.hpp # to show in IDE
|
||||||
|
- catch.hpp # to show in IDE
|
||||||
|
tests.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
-target_link_libraries(mustache-unit-tests PRIVATE mustache)
|
||||||
|
+
|
||||||
|
+target_link_libraries(mustache-unit-tests PRIVATE mustache Catch2::Catch2)
|
||||||
|
|
||||||
|
if (UNIX)
|
||||||
|
target_compile_options(mustache-unit-tests PRIVATE -Wall -Wextra -Werror -Wconversion)
|
||||||
|
--- a/tests/tests.cpp
|
||||||
|
+++ b/tests/tests.cpp
|
||||||
|
@@ -29,7 +29,7 @@
|
||||||
|
#include "mustache.hpp"
|
||||||
|
|
||||||
|
#define CATCH_CONFIG_MAIN
|
||||||
|
-#include "catch.hpp"
|
||||||
|
+#include <catch2/catch.hpp>
|
||||||
|
|
||||||
|
using namespace kainjow::mustache;
|
||||||
|
|
||||||
@@ -14,6 +14,19 @@ S="${WORKDIR}/Mustache-${COMMIT}"
|
|||||||
LICENSE="Boost-1.0"
|
LICENSE="Boost-1.0"
|
||||||
SLOT="0"
|
SLOT="0"
|
||||||
KEYWORDS="~amd64"
|
KEYWORDS="~amd64"
|
||||||
|
IUSE="test"
|
||||||
|
RESTRICT="!test? ( test )"
|
||||||
|
|
||||||
|
BDEPEND="test? ( <dev-cpp/catch-3 )"
|
||||||
|
|
||||||
|
PATCHES="${FILESDIR}"/${P}-unbundle-catch.patch
|
||||||
|
|
||||||
|
src_configure() {
|
||||||
|
local mycmakeargs=(
|
||||||
|
-DTESTS=$(usex test)
|
||||||
|
)
|
||||||
|
cmake_src_configure
|
||||||
|
}
|
||||||
|
|
||||||
src_test() {
|
src_test() {
|
||||||
"${BUILD_DIR}"/tests/mustache-unit-tests || die "Tests failed!"
|
"${BUILD_DIR}"/tests/mustache-unit-tests || die "Tests failed!"
|
||||||
|
|||||||
Reference in New Issue
Block a user