cmake_minimum_required(VERSION 3.12)
project(cgal_pycad)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Find CGAL
find_package(CGAL REQUIRED)

# Find pybind11
# If building via scikit-build, pybind11 should be found via pyproject.toml requirements
find_package(pybind11 CONFIG REQUIRED)

pybind11_add_module(_cgal_pycad src/cgal_pycad.cpp)

# Link against CGAL and GMP/MPFR (usually handled by CGAL::CGAL target)
target_link_libraries(_cgal_pycad PRIVATE CGAL::CGAL)

# Print status
message(STATUS "CGAL found: ${CGAL_DIR}")
message(STATUS "pybind11 found: ${pybind11_DIR}")

# Install target (Required for scikit-build)
install(TARGETS _cgal_pycad DESTINATION .)
