When including pybind11 directly via add_subdirectory, the selected python interpreter would be useful to be queried, e.g. for install paths.
With find_package(pybind11) the variables PYTHON_VERSION_MAJOR and ..._MINOR leak into the caller's scope and can be queried, but add_subdirectory does proper encapsulation.
Can we maybe add PYTHON_VERSION_MAJOR and PYTHON_VERSION_MINOR as CMake target properties to the pybind11::pybind11 target? With that we could query it from a calling project (or maybe you have an alternative idea as well).
When including pybind11 directly via
add_subdirectory
, the selected python interpreter would be useful to be queried, e.g. for install paths.With
find_package(pybind11)
the variablesPYTHON_VERSION_MAJOR
and..._MINOR
leak into the caller's scope and can be queried, butadd_subdirectory
does proper encapsulation.Can we maybe add
PYTHON_VERSION_MAJOR
andPYTHON_VERSION_MINOR
as CMake target properties to thepybind11::pybind11
target? With that we could query it from a calling project (or maybe you have an alternative idea as well).