# Copyright 2026, Raffi Enficiaud.
#
# An extension linking zlib, provided by conan from the conan-center-index
# recipe: cmake-pip clones the recipe repository, exports the recipe, runs
# `conan install --build=missing` (zlib is built from source into the conan
# cache) and injects the generated toolchain -- which is what makes the
# find_package below resolve.

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

project(TestCMakePIPConanZlib)

find_package(Python3 COMPONENTS Interpreter Development.Module REQUIRED)

find_package(ZLIB REQUIRED)

python3_add_library(zlib_test MODULE WITH_SOABI
    src/python_header.hpp
    src/python_zlib_ext.cpp)
target_link_libraries(zlib_test PRIVATE ZLIB::ZLIB)

install(TARGETS zlib_test
        DESTINATION ext_with_conan_zlib
        COMPONENT python_module)
