diff --git a/docs/Debug.md b/docs/Debug.md index 43e638d..6592990 100644 --- a/docs/Debug.md +++ b/docs/Debug.md @@ -32,8 +32,7 @@ In your CMakeLists.txt script, add a macro that defines the `MODULE_NAME` as the base name of the extension module (which includes the `_d` suffix): ```cmake -Python3_add_library(_add_module MODULE "src/add_module.cpp") -target_link_libraries(_add_module PRIVATE pybind11::pybind11) +pybind11_add_module(_add_module MODULE "src/add_module.cpp") target_compile_definitions(_add_module PRIVATE MODULE_NAME=$) ``` diff --git a/docs/FAQ.md b/docs/FAQ.md index a8f1790..43715a4 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -15,7 +15,7 @@ etc. Even when using Setuptools, it's best to avoid `setup.py` if you can, and to use declarative configuration files like `setup.cfg` and `pyproject.toml` instead. -From the [setuptools quickstart guide](https://setuptools.pypa.io/en/latest/userguide/quickstart.html): +From the [Setuptools quickstart guide](https://setuptools.pypa.io/en/latest/userguide/quickstart.html): > The landscape of Python packaging is shifting and `Setuptools` has evolved to > only provide backend support, no longer being the de-facto packaging tool in @@ -45,7 +45,7 @@ You can enable py-build-cmake's verbose mode to make it print information about the configuration, the exact subprocesses it invokes, the configure and build environments, and so on. -When using a tool like PyPA `build`, you can use the `-C` option to pass the +When using a tool like PyPA `build`, you can use the `-C` flag to pass the `verbose` option: ```sh python -m build . -C verbose @@ -56,14 +56,14 @@ can set the environment variable `PY_BUILD_CMAKE_VERBOSE`: ```sh PY_BUILD_CMAKE_VERBOSE=1 pip install . -v # Linux/macOS ``` -```ps1 +```sh $Env:PY_BUILD_CMAKE_VERBOSE=1 # Windows pip install . -v Remove-Item Env:PY_BUILD_CMAKE_VERBOSE ``` Also note the `-v` flag to get pip to print the build output. -When inspecting the output, beware that output of subprocesses is often much +When inspecting the output, be aware that output of subprocesses is often much higher up than the final error message or backtrace. For example, if you get an error saying that the invocation of CMake failed, you'll have to scroll up to see the actual CMake output. diff --git a/examples/pybind11-project/cmake/QueryPythonForPybind11.cmake b/examples/pybind11-project/cmake/QueryPythonForPybind11.cmake index c1df038..28b995e 100644 --- a/examples/pybind11-project/cmake/QueryPythonForPybind11.cmake +++ b/examples/pybind11-project/cmake/QueryPythonForPybind11.cmake @@ -1,11 +1,10 @@ # First tries to find Python 3, then tries to import the pybind11 module to # query the CMake config location, and finally imports pybind11 using -# find_package(pybind11). +# find_package(pybind11 REQUIRED CONFIG). function(find_pybind11_python_first) # Query Python to see if it knows where the headers are - find_package(Python3 REQUIRED COMPONENTS Interpreter) - find_package(Python3 COMPONENTS Development) + find_package(Python3 REQUIRED COMPONENTS Interpreter Development) if (NOT pybind11_ROOT OR NOT EXISTS ${pybind11_ROOT}) execute_process(COMMAND ${Python3_EXECUTABLE} -m pybind11 --cmakedir