Skip to content

Commit 71e8a79

Browse files
dean0x7dwjakob
authored andcommitted
Rename target from pybind11::pybind11 to pybind11::module
Makes room for an eventual pybind11::embedded target.
1 parent 0cbec5c commit 71e8a79

File tree

5 files changed

+21
-21
lines changed

5 files changed

+21
-21
lines changed

CMakeLists.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,18 @@ message(STATUS "pybind11 v${${PROJECT_NAME}_VERSION}")
8989

9090
if(NOT (CMAKE_VERSION VERSION_LESS 3.0)) # CMake >= 3.0
9191
# Build an interface library target:
92-
add_library(pybind11 INTERFACE)
93-
target_include_directories(pybind11 INTERFACE $<BUILD_INTERFACE:${PYBIND11_INCLUDE_DIR}>
94-
$<BUILD_INTERFACE:${PYTHON_INCLUDE_DIRS}>
95-
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
92+
add_library(module INTERFACE)
93+
target_include_directories(module INTERFACE $<BUILD_INTERFACE:${PYBIND11_INCLUDE_DIR}>
94+
$<BUILD_INTERFACE:${PYTHON_INCLUDE_DIRS}>
95+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
9696
if(WIN32 OR CYGWIN)
97-
target_link_libraries(pybind11 INTERFACE $<BUILD_INTERFACE:${PYTHON_LIBRARIES}>)
97+
target_link_libraries(module INTERFACE $<BUILD_INTERFACE:${PYTHON_LIBRARIES}>)
9898
elseif(APPLE)
99-
target_link_libraries(pybind11 INTERFACE "-undefined dynamic_lookup")
99+
target_link_libraries(module INTERFACE "-undefined dynamic_lookup")
100100
endif()
101-
target_compile_options(pybind11 INTERFACE $<BUILD_INTERFACE:${PYBIND11_CPP_STANDARD}>)
101+
target_compile_options(module INTERFACE $<BUILD_INTERFACE:${PYBIND11_CPP_STANDARD}>)
102102

103-
add_library(pybind11::pybind11 ALIAS pybind11) # to match exported target
103+
add_library(pybind11::module ALIAS module) # to match exported target
104104
endif()
105105

106106
if (PYBIND11_INSTALL)
@@ -122,7 +122,7 @@ if (PYBIND11_INSTALL)
122122
DESTINATION ${PYBIND11_CMAKECONFIG_INSTALL_DIR})
123123

124124
if(NOT (CMAKE_VERSION VERSION_LESS 3.0))
125-
install(TARGETS pybind11
125+
install(TARGETS module
126126
EXPORT "${PROJECT_NAME}Targets")
127127
install(EXPORT "${PROJECT_NAME}Targets"
128128
NAMESPACE "${PROJECT_NAME}::"

docs/compiling.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ Advanced: interface library target
142142
----------------------------------
143143

144144
When using a version of CMake greater than 3.0, pybind11 can additionally
145-
be used as a special *interface library* . The target ``pybind11::pybind11``
145+
be used as a special *interface library* . The target ``pybind11::module``
146146
is available with pybind11 headers, Python headers and libraries as needed,
147147
and C++ compile definitions attached. This target is suitable for linking
148148
to an independently constructed (through ``add_library``, not
@@ -156,7 +156,7 @@ to an independently constructed (through ``add_library``, not
156156
find_package(pybind11 REQUIRED) # or add_subdirectory(pybind11)
157157
158158
add_library(example MODULE main.cpp)
159-
target_link_libraries(example PRIVATE pybind11::pybind11)
159+
target_link_libraries(example PRIVATE pybind11::module)
160160
set_target_properties(example PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}"
161161
SUFFIX "${PYTHON_MODULE_EXTENSION}")
162162

tests/test_cmake_build/installed_target/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ message(STATUS "Found pybind11 v${pybind11_VERSION}: ${pybind11_INCLUDE_DIRS}")
88

99
add_library(test_cmake_build MODULE ../main.cpp)
1010

11-
target_link_libraries(test_cmake_build PRIVATE pybind11::pybind11)
11+
target_link_libraries(test_cmake_build PRIVATE pybind11::module)
1212

1313
# make sure result is, for example, test_installed_target.so, not libtest_installed_target.dylib
1414
set_target_properties(test_cmake_build PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}"

tests/test_cmake_build/subdirectory_target/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ add_subdirectory(${PYBIND11_PROJECT_DIR} pybind11)
55

66
add_library(test_cmake_build MODULE ../main.cpp)
77

8-
target_link_libraries(test_cmake_build PRIVATE pybind11::pybind11)
8+
target_link_libraries(test_cmake_build PRIVATE pybind11::module)
99

1010
# make sure result is, for example, test_installed_target.so, not libtest_installed_target.dylib
1111
set_target_properties(test_cmake_build PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}"

tools/pybind11Config.cmake.in

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626
# python detection and PYBIND11_CPP_STANDARD (-std=c++11 or -std=c++14) to
2727
# influence standard setting. ::
2828
#
29-
# pybind11::pybind11 - the main pybind11 interface library (i.e., headers)
29+
# pybind11::module - the main pybind11 interface library for extension modules (i.e., headers)
3030
#
3131
# find_package(pybind11 CONFIG REQUIRED)
3232
# message(STATUS "Found pybind11: ${pybind11_INCLUDE_DIR} (found version ${pybind11_VERSION} & Py${PYTHON_VERSION_STRING})")
3333
# add_library(mylib MODULE main.cpp)
34-
# target_link_libraries(mylib pybind11::pybind11)
34+
# target_link_libraries(mylib pybind11::module)
3535
#
3636
# Suggested usage::
3737
#
@@ -75,17 +75,17 @@ if(NOT TARGET ${PN}::pybind11)
7575
include("${CMAKE_CURRENT_LIST_DIR}/${PN}Targets.cmake")
7676

7777
find_package(PythonLibsNew ${PYBIND11_PYTHON_VERSION} MODULE REQUIRED)
78-
set_property(TARGET ${PN}::pybind11 APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PYTHON_INCLUDE_DIRS})
78+
set_property(TARGET ${PN}::module APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PYTHON_INCLUDE_DIRS})
7979
if(WIN32 OR CYGWIN)
80-
set_property(TARGET ${PN}::pybind11 APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${PYTHON_LIBRARIES})
80+
set_property(TARGET ${PN}::module APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${PYTHON_LIBRARIES})
8181
endif()
8282

8383
select_cxx_standard()
84-
set_property(TARGET ${PN}::pybind11 APPEND PROPERTY INTERFACE_COMPILE_OPTIONS "${PYBIND11_CPP_STANDARD}")
84+
set_property(TARGET ${PN}::module APPEND PROPERTY INTERFACE_COMPILE_OPTIONS "${PYBIND11_CPP_STANDARD}")
8585

86-
get_property(_iid TARGET ${PN}::pybind11 PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
87-
get_property(_ill TARGET ${PN}::pybind11 PROPERTY INTERFACE_LINK_LIBRARIES)
88-
get_property(_ico TARGET ${PN}::pybind11 PROPERTY INTERFACE_COMPILE_OPTIONS)
86+
get_property(_iid TARGET ${PN}::module PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
87+
get_property(_ill TARGET ${PN}::module PROPERTY INTERFACE_LINK_LIBRARIES)
88+
get_property(_ico TARGET ${PN}::module PROPERTY INTERFACE_COMPILE_OPTIONS)
8989
set(${PN}_INCLUDE_DIRS ${_iid})
9090
set(${PN}_LIBRARIES ${_ico} ${_ill})
9191
endif()

0 commit comments

Comments
 (0)