mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-28 16:11:59 +00:00
b0f3885c95
Add a BUILD_INTERFACE and a pybind11::pybind11 alias for the interface library to match the installed target. Add new cmake tests for add_subdirectory and consolidates the .cpp and .py files needed for the cmake build tests: Before: tests |-- test_installed_module | |-- CMakeLists.txt | |-- main.cpp | \-- test.py \-- test_installed_target |-- CMakeLists.txt |-- main.cpp \-- test.py After: tests \-- test_cmake_build |-- installed_module/CMakeLists.txt |-- installed_target/CMakeLists.txt |-- subdirectory_module/CMakeLists.txt |-- subdirectory_target/CMakeLists.txt |-- main.cpp \-- test.py
11 lines
209 B
C++
11 lines
209 B
C++
#include <pybind11/pybind11.h>
|
|
namespace py = pybind11;
|
|
|
|
PYBIND11_PLUGIN(test_cmake_build) {
|
|
py::module m("test_cmake_build");
|
|
|
|
m.def("add", [](int i, int j) { return i + j; });
|
|
|
|
return m.ptr();
|
|
}
|