mirror of
https://github.com/pybind/pybind11.git
synced 2026-04-24 16:59:14 +00:00
Make sure add_subdirectory and find_package behave identically
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
This commit is contained in:
committed by
Wenzel Jakob
parent
003a9eba59
commit
b0f3885c95
12
tests/test_cmake_build/installed_function/CMakeLists.txt
Normal file
12
tests/test_cmake_build/installed_function/CMakeLists.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
project(test_installed_module CXX)
|
||||
|
||||
set(CMAKE_MODULE_PATH "")
|
||||
|
||||
find_package(pybind11 CONFIG REQUIRED)
|
||||
message(STATUS "Found pybind11 v${pybind11_VERSION}: ${pybind11_INCLUDE_DIRS}")
|
||||
|
||||
pybind11_add_module(test_cmake_build SHARED ../main.cpp)
|
||||
|
||||
add_custom_target(check ${CMAKE_COMMAND} -E env PYTHONPATH=$<TARGET_FILE_DIR:test_cmake_build>
|
||||
${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/../test.py ${PROJECT_NAME})
|
||||
Reference in New Issue
Block a user