wjakob / nanobind

nanobind: tiny and efficient C++/Python bindings
BSD 3-Clause "New" or "Revised" License
2.15k stars 165 forks source link

[cmake] include nanobind-config.cmake instead of calling find_package() #627

Open KerstinKeller opened 4 days ago

KerstinKeller commented 4 days ago

find_package() is an abstraction to be used to localize a package. When building this project, the same can be achieved by just including the cmake/nanobind-config.cmake file directly.

Especially the current implementation breaks in cases of using CMake dependency providers, where the dependency provider executes an add_subdirectory call. In this specific case the find_package leads to an infinite recursion of find_package(nanobind) calls.