mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 05:05:11 +00:00
Fix CMake example code in embedding docs
[skip ci]
This commit is contained in:
parent
acedd6c70c
commit
8f6c129689
@ -21,7 +21,7 @@ information, see :doc:`/compiling`.
|
|||||||
|
|
||||||
find_package(pybind11 REQUIRED) # or `add_subdirectory(pybind11)`
|
find_package(pybind11 REQUIRED) # or `add_subdirectory(pybind11)`
|
||||||
|
|
||||||
add_executable(example MODULE main.cpp)
|
add_executable(example main.cpp)
|
||||||
target_link_libraries(example PRIVATE pybind11::embed)
|
target_link_libraries(example PRIVATE pybind11::embed)
|
||||||
|
|
||||||
The essential structure of the ``main.cpp`` file looks like this:
|
The essential structure of the ``main.cpp`` file looks like this:
|
||||||
@ -45,7 +45,7 @@ shuts down and clears its memory. No Python functions can be called after this.
|
|||||||
Executing Python code
|
Executing Python code
|
||||||
=====================
|
=====================
|
||||||
|
|
||||||
There are few different ways to run Python code. One option is to use `eval`,
|
There are a few different ways to run Python code. One option is to use `eval`,
|
||||||
`exec` or `eval_file`, as explained in :ref:`eval`. Here is a quick example in
|
`exec` or `eval_file`, as explained in :ref:`eval`. Here is a quick example in
|
||||||
the context of an executable with an embedded interpreter:
|
the context of an executable with an embedded interpreter:
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ information about usage in C++, see :doc:`/advanced/embedding`.
|
|||||||
|
|
||||||
find_package(pybind11 REQUIRED) # or add_subdirectory(pybind11)
|
find_package(pybind11 REQUIRED) # or add_subdirectory(pybind11)
|
||||||
|
|
||||||
add_executable(example MODULE main.cpp)
|
add_executable(example main.cpp)
|
||||||
target_link_libraries(example PRIVATE pybind11::embed)
|
target_link_libraries(example PRIVATE pybind11::embed)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user