diff --git a/.distro/plans/import.fmf b/.distro/plans/import.fmf new file mode 100644 index 0000000..e23e798 --- /dev/null +++ b/.distro/plans/import.fmf @@ -0,0 +1,12 @@ +summary: + Basic importing tests +prepare+: + - name: Include minimum fetching packages + how: install + package: + - git +discover+: + how: fmf + filter: "tag: import" +execute: + how: tmt diff --git a/.distro/tests/import/FetchContent/CMakeLists.txt b/.distro/tests/import/FetchContent/CMakeLists.txt new file mode 100644 index 0000000..1d8bf95 --- /dev/null +++ b/.distro/tests/import/FetchContent/CMakeLists.txt @@ -0,0 +1,15 @@ +# This is a simple project that tests using cmake to load the installed libraries +cmake_minimum_required(VERSION 3.14) + +project(test_fetch_content LANGUAGES CXX) + + +FetchContent_Declare(nlohmann_json_schema_validator + GIT_REPOSITORY https://github.com/pboettch/json-schema-validator + GIT_TAG main + ) +FetchContent_MakeAvailable(nlohmann_json_schema_validator) + +if (NOT TARGET nlohmann_json_schema_validator::validator) + message(FATAL_ERROR "Missing target nlohmann_json_schema_validator::validator") +endif () diff --git a/.distro/tests/import/find_package/CMakeLists.txt b/.distro/tests/import/find_package/CMakeLists.txt new file mode 100644 index 0000000..b7f7b19 --- /dev/null +++ b/.distro/tests/import/find_package/CMakeLists.txt @@ -0,0 +1,11 @@ +# This is a simple project that tests using cmake to load the installed libraries +cmake_minimum_required(VERSION 3.14) + +project(test_find_package LANGUAGES CXX) + +set(CMAKE_FIND_DEBUG_MODE ON) +find_package(nlohmann_json_schema_validator REQUIRED) + +if (NOT TARGET nlohmann_json_schema_validator::validator) + message(FATAL_ERROR "Missing target nlohmann_json_schema_validator::validator") +endif () diff --git a/.distro/tests/import/main.fmf b/.distro/tests/import/main.fmf new file mode 100644 index 0000000..f4a88d2 --- /dev/null +++ b/.distro/tests/import/main.fmf @@ -0,0 +1,11 @@ +# Common test variables +tag: + - import +tier: 0 +path: /tests/import + +# Define tests +/find_package: + test: ./test_find_package.sh +/FetchContent: + test: ./test_FetchContent.sh diff --git a/.distro/tests/import/test_FetchContent.sh b/.distro/tests/import/test_FetchContent.sh new file mode 100644 index 0000000..c39c9ac --- /dev/null +++ b/.distro/tests/import/test_FetchContent.sh @@ -0,0 +1,4 @@ +#!/bin/bash -eux + +tmp_dir=$(mktemp -d) +cmake -S ./FetchContent -B ${tmp_dir} diff --git a/.distro/tests/import/test_find_package.sh b/.distro/tests/import/test_find_package.sh new file mode 100644 index 0000000..f717857 --- /dev/null +++ b/.distro/tests/import/test_find_package.sh @@ -0,0 +1,4 @@ +#!/bin/bash -eux + +tmp_dir=$(mktemp -d) +cmake -S ./find_package -B ${tmp_dir}