# Copyright 2026, Raffi Enficiaud.
#
# An extension consuming a conan-provided dependency: cmake-pip runs
# `conan install` as the first build step and injects the generated
# conan_toolchain.cmake into this configuration -- which is what makes the
# find_package below resolve (the toolchain puts the CMakeDeps output on the
# prefix path).

cmake_minimum_required(VERSION 3.21)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)

project(TestCMakePIPConanDependency)

find_package(Python3 COMPONENTS Interpreter Development.Module REQUIRED)

# the conan-provided dependency, exported into the CONAN_HOME by cmake-pip from
# the recipe vendored in the fixture
find_package(tinything REQUIRED)

python3_add_library(conan_test MODULE WITH_SOABI
    src/python_header.hpp
    src/python_conan_ext.cpp)
target_link_libraries(conan_test PRIVATE tinything::tinything)

install(TARGETS conan_test
        DESTINATION ext_with_conan_dependency
        COMPONENT python_module)
