@@ -154,8 +154,10 @@ set(PYBIND11_INCLUDE_DIR
154
154
# This section builds targets, but does *not* touch Python
155
155
156
156
# Build the headers-only target (no Python included):
157
- add_library (headers INTERFACE )
158
- add_library (pybind11::headers ALIAS headers) # to match exported target
157
+ # (long name used here to keep this from clashing in subdirectory mode)
158
+ add_library (pybind11_headers INTERFACE )
159
+ add_library (pybind11::pybind11_headers ALIAS pybind11_headers) # to match exported target
160
+ add_library (pybind11::headers ALIAS pybind11_headers) # easier to use/remember
159
161
160
162
include ("${CMAKE_CURRENT_SOURCE_DIR} /tools/pybind11Common.cmake" )
161
163
@@ -172,11 +174,11 @@ endif()
172
174
173
175
# Fill in headers target
174
176
target_include_directories (
175
- headers ${pybind11_system} INTERFACE $<BUILD_INTERFACE:${PYBIND11_INCLUDE_DIR} >
176
- $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR} >)
177
+ pybind11_headers ${pybind11_system} INTERFACE $<BUILD_INTERFACE:${PYBIND11_INCLUDE_DIR} >
178
+ $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR} >)
177
179
178
- target_compile_features (headers INTERFACE cxx_inheriting_constructors cxx_user_literals
179
- cxx_right_angle_brackets)
180
+ target_compile_features (pybind11_headers INTERFACE cxx_inheriting_constructors cxx_user_literals
181
+ cxx_right_angle_brackets)
180
182
181
183
if (PYBIND11_INSTALL)
182
184
install (DIRECTORY ${PYBIND11_INCLUDE_DIR} /pybind11 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} )
@@ -222,7 +224,7 @@ if(PYBIND11_INSTALL)
222
224
set (PYBIND11_EXPORT_NAME "${PROJECT_NAME} Targets" )
223
225
endif ()
224
226
225
- install (TARGETS headers EXPORT "${PYBIND11_EXPORT_NAME} " )
227
+ install (TARGETS pybind11_headers EXPORT "${PYBIND11_EXPORT_NAME} " )
226
228
227
229
install (
228
230
EXPORT "${PYBIND11_EXPORT_NAME} "
0 commit comments