-
Notifications
You must be signed in to change notification settings - Fork 23
Use CMake #23
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Could you be more specific? From my perspective, the way you phrased it its not clear whether you want cmake to find |
If you're asking asking how to use CMake to pass all of the find_package(Python REQUIRED COMPONENTS Interpreter Development.Module)
find_package(pybind11 CONFIG REQUIRED)
add_custom_command(
OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/auto-generated/docstrings.h"
COMMAND Python::Interpreter
ARGS
-m pybind11_mkdoc
--output auto-generated/docstrings.h
# TODO: there's a better way of doing this in CMake 3.27
# see https://cmake.org/cmake/help/v3.27/manual/cmake-generator-expressions.7.html#whitespace-and-quoting
"-I;$<JOIN:$<TARGET_PROPERTY:my_module,INCLUDE_DIRECTORIES>,;-I;>"
"${CMAKE_CURRENT_SOURCE_DIR}/src/my_module_headers.hpp"
COMMAND_EXPAND_LISTS
VERBATIM
)
python_add_library(my_module MODULE
src/my_module.cpp auto-generated/docstrings.h
)
target_link_libraries(my_module PRIVATE pybind11::headers) The key-bit is that we can use This is pretty great if you're using |
I have a library that depends on a number of different libraries. I use CMake to find them, and I would like
pybind11_mkdoc
to do the same. How do I do that?The text was updated successfully, but these errors were encountered: