fix: reduce target collision in add_submodule mode (#2423)
* fix: reduce target collision in add_submodule mode
Closes #2420
* fix: update CMakeLists.txt
diff --git a/tools/pybind11Config.cmake.in b/tools/pybind11Config.cmake.in
index 4f0500a..3f11172 100644
--- a/tools/pybind11Config.cmake.in
+++ b/tools/pybind11Config.cmake.in
@@ -130,6 +130,11 @@
include("${CMAKE_CURRENT_LIST_DIR}/pybind11Targets.cmake")
+# Easier to use / remember
+add_library(pybind11::headers IMPORTED INTERFACE)
+set_target_properties(pybind11::headers PROPERTIES INTERFACE_LINK_LIBRARIES
+ pybind11::pybind11_headers)
+
include("${CMAKE_CURRENT_LIST_DIR}/pybind11Common.cmake")
if(NOT pybind11_FIND_QUIETLY)