Rename target from pybind11::pybind11 to pybind11::module
Makes room for an eventual pybind11::embedded target.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4fd68ed..a2198ba 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -89,18 +89,18 @@
if(NOT (CMAKE_VERSION VERSION_LESS 3.0)) # CMake >= 3.0
# Build an interface library target:
- add_library(pybind11 INTERFACE)
- target_include_directories(pybind11 INTERFACE $<BUILD_INTERFACE:${PYBIND11_INCLUDE_DIR}>
- $<BUILD_INTERFACE:${PYTHON_INCLUDE_DIRS}>
- $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
+ add_library(module INTERFACE)
+ target_include_directories(module INTERFACE $<BUILD_INTERFACE:${PYBIND11_INCLUDE_DIR}>
+ $<BUILD_INTERFACE:${PYTHON_INCLUDE_DIRS}>
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
if(WIN32 OR CYGWIN)
- target_link_libraries(pybind11 INTERFACE $<BUILD_INTERFACE:${PYTHON_LIBRARIES}>)
+ target_link_libraries(module INTERFACE $<BUILD_INTERFACE:${PYTHON_LIBRARIES}>)
elseif(APPLE)
- target_link_libraries(pybind11 INTERFACE "-undefined dynamic_lookup")
+ target_link_libraries(module INTERFACE "-undefined dynamic_lookup")
endif()
- target_compile_options(pybind11 INTERFACE $<BUILD_INTERFACE:${PYBIND11_CPP_STANDARD}>)
+ target_compile_options(module INTERFACE $<BUILD_INTERFACE:${PYBIND11_CPP_STANDARD}>)
- add_library(pybind11::pybind11 ALIAS pybind11) # to match exported target
+ add_library(pybind11::module ALIAS module) # to match exported target
endif()
if (PYBIND11_INSTALL)
@@ -122,7 +122,7 @@
DESTINATION ${PYBIND11_CMAKECONFIG_INSTALL_DIR})
if(NOT (CMAKE_VERSION VERSION_LESS 3.0))
- install(TARGETS pybind11
+ install(TARGETS module
EXPORT "${PROJECT_NAME}Targets")
install(EXPORT "${PROJECT_NAME}Targets"
NAMESPACE "${PROJECT_NAME}::"
diff --git a/docs/compiling.rst b/docs/compiling.rst
index ccb198b..143d4a3 100644
--- a/docs/compiling.rst
+++ b/docs/compiling.rst
@@ -142,7 +142,7 @@
----------------------------------
When using a version of CMake greater than 3.0, pybind11 can additionally
-be used as a special *interface library* . The target ``pybind11::pybind11``
+be used as a special *interface library* . The target ``pybind11::module``
is available with pybind11 headers, Python headers and libraries as needed,
and C++ compile definitions attached. This target is suitable for linking
to an independently constructed (through ``add_library``, not
@@ -156,7 +156,7 @@
find_package(pybind11 REQUIRED) # or add_subdirectory(pybind11)
add_library(example MODULE main.cpp)
- target_link_libraries(example PRIVATE pybind11::pybind11)
+ target_link_libraries(example PRIVATE pybind11::module)
set_target_properties(example PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}"
SUFFIX "${PYTHON_MODULE_EXTENSION}")
diff --git a/tests/test_cmake_build/installed_target/CMakeLists.txt b/tests/test_cmake_build/installed_target/CMakeLists.txt
index e09a2fa..dd20659 100644
--- a/tests/test_cmake_build/installed_target/CMakeLists.txt
+++ b/tests/test_cmake_build/installed_target/CMakeLists.txt
@@ -8,7 +8,7 @@
add_library(test_cmake_build MODULE ../main.cpp)
-target_link_libraries(test_cmake_build PRIVATE pybind11::pybind11)
+target_link_libraries(test_cmake_build PRIVATE pybind11::module)
# make sure result is, for example, test_installed_target.so, not libtest_installed_target.dylib
set_target_properties(test_cmake_build PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}"
diff --git a/tests/test_cmake_build/subdirectory_target/CMakeLists.txt b/tests/test_cmake_build/subdirectory_target/CMakeLists.txt
index ee3f489..6b142d6 100644
--- a/tests/test_cmake_build/subdirectory_target/CMakeLists.txt
+++ b/tests/test_cmake_build/subdirectory_target/CMakeLists.txt
@@ -5,7 +5,7 @@
add_library(test_cmake_build MODULE ../main.cpp)
-target_link_libraries(test_cmake_build PRIVATE pybind11::pybind11)
+target_link_libraries(test_cmake_build PRIVATE pybind11::module)
# make sure result is, for example, test_installed_target.so, not libtest_installed_target.dylib
set_target_properties(test_cmake_build PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}"
diff --git a/tools/pybind11Config.cmake.in b/tools/pybind11Config.cmake.in
index 23588c3..a4206c1 100644
--- a/tools/pybind11Config.cmake.in
+++ b/tools/pybind11Config.cmake.in
@@ -26,12 +26,12 @@
# python detection and PYBIND11_CPP_STANDARD (-std=c++11 or -std=c++14) to
# influence standard setting. ::
#
-# pybind11::pybind11 - the main pybind11 interface library (i.e., headers)
+# pybind11::module - the main pybind11 interface library for extension modules (i.e., headers)
#
# find_package(pybind11 CONFIG REQUIRED)
# message(STATUS "Found pybind11: ${pybind11_INCLUDE_DIR} (found version ${pybind11_VERSION} & Py${PYTHON_VERSION_STRING})")
# add_library(mylib MODULE main.cpp)
-# target_link_libraries(mylib pybind11::pybind11)
+# target_link_libraries(mylib pybind11::module)
#
# Suggested usage::
#
@@ -75,17 +75,17 @@
include("${CMAKE_CURRENT_LIST_DIR}/${PN}Targets.cmake")
find_package(PythonLibsNew ${PYBIND11_PYTHON_VERSION} MODULE REQUIRED)
- set_property(TARGET ${PN}::pybind11 APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PYTHON_INCLUDE_DIRS})
+ set_property(TARGET ${PN}::module APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PYTHON_INCLUDE_DIRS})
if(WIN32 OR CYGWIN)
- set_property(TARGET ${PN}::pybind11 APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${PYTHON_LIBRARIES})
+ set_property(TARGET ${PN}::module APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${PYTHON_LIBRARIES})
endif()
select_cxx_standard()
- set_property(TARGET ${PN}::pybind11 APPEND PROPERTY INTERFACE_COMPILE_OPTIONS "${PYBIND11_CPP_STANDARD}")
+ set_property(TARGET ${PN}::module APPEND PROPERTY INTERFACE_COMPILE_OPTIONS "${PYBIND11_CPP_STANDARD}")
- get_property(_iid TARGET ${PN}::pybind11 PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
- get_property(_ill TARGET ${PN}::pybind11 PROPERTY INTERFACE_LINK_LIBRARIES)
- get_property(_ico TARGET ${PN}::pybind11 PROPERTY INTERFACE_COMPILE_OPTIONS)
+ get_property(_iid TARGET ${PN}::module PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
+ get_property(_ill TARGET ${PN}::module PROPERTY INTERFACE_LINK_LIBRARIES)
+ get_property(_ico TARGET ${PN}::module PROPERTY INTERFACE_COMPILE_OPTIONS)
set(${PN}_INCLUDE_DIRS ${_iid})
set(${PN}_LIBRARIES ${_ico} ${_ill})
endif()