From 71e8a7962c4ce032d61b417e6421730335c63a62 Mon Sep 17 00:00:00 2001 From: Dean Moldovan Date: Sat, 17 Dec 2016 21:38:57 +0100 Subject: [PATCH] Rename target from pybind11::pybind11 to pybind11::module Makes room for an eventual pybind11::embedded target. --- CMakeLists.txt | 18 +++++++++--------- docs/compiling.rst | 4 ++-- .../installed_target/CMakeLists.txt | 2 +- .../subdirectory_target/CMakeLists.txt | 2 +- tools/pybind11Config.cmake.in | 16 ++++++++-------- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4fd68edf0..a2198baed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,18 +89,18 @@ message(STATUS "pybind11 v${${PROJECT_NAME}_VERSION}") 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 $ - $ - $) + add_library(module INTERFACE) + target_include_directories(module INTERFACE $ + $ + $) if(WIN32 OR CYGWIN) - target_link_libraries(pybind11 INTERFACE $) + target_link_libraries(module INTERFACE $) elseif(APPLE) - target_link_libraries(pybind11 INTERFACE "-undefined dynamic_lookup") + target_link_libraries(module INTERFACE "-undefined dynamic_lookup") endif() - target_compile_options(pybind11 INTERFACE $) + target_compile_options(module INTERFACE $) - 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 @@ if (PYBIND11_INSTALL) 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 ccb198b30..143d4a348 100644 --- a/docs/compiling.rst +++ b/docs/compiling.rst @@ -142,7 +142,7 @@ Advanced: interface library target ---------------------------------- 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 @@ to an independently constructed (through ``add_library``, not 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 e09a2fa83..dd206592f 100644 --- a/tests/test_cmake_build/installed_target/CMakeLists.txt +++ b/tests/test_cmake_build/installed_target/CMakeLists.txt @@ -8,7 +8,7 @@ message(STATUS "Found pybind11 v${pybind11_VERSION}: ${pybind11_INCLUDE_DIRS}") 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 ee3f48944..6b142d62a 100644 --- a/tests/test_cmake_build/subdirectory_target/CMakeLists.txt +++ b/tests/test_cmake_build/subdirectory_target/CMakeLists.txt @@ -5,7 +5,7 @@ add_subdirectory(${PYBIND11_PROJECT_DIR} pybind11) 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 23588c300..a4206c166 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 @@ if(NOT TARGET ${PN}::pybind11) 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()