Skip to content

chore(cmake): carry option-driven defines on pybind11_headers INTERFACE - #6130

Open
henryiii wants to merge 1 commit into
masterfrom
chore/headers-interface-defines
Open

chore(cmake): carry option-driven defines on pybind11_headers INTERFACE#6130
henryiii wants to merge 1 commit into
masterfrom
chore/headers-interface-defines

Conversation

@henryiii

@henryiii henryiii commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

This is a general fix anyway, can stand on its own.

🤖 AI text below 🤖

Description

PYBIND11_DISABLE_HANDLE_TYPE_NAME_DEFAULT_IMPLEMENTATION and PYBIND11_SIMPLE_GIL_MANAGEMENT were applied with a directory-scoped add_compile_definitions, so they only took effect in the master-project (test) build. Move them onto the pybind11_headers INTERFACE, the same pattern as PYBIND11_INTERNALS_VERSION. The options now also work in add_subdirectory mode and ride the exported/installed targets.

This is step 0 of the optional pre-compilation work: must-match configuration macros have to propagate through pybind11::headers so a future precompiled static library and consumer modules always agree.

Suggested changelog entry:

  • The CMake options PYBIND11_DISABLE_HANDLE_TYPE_NAME_DEFAULT_IMPLEMENTATION and PYBIND11_SIMPLE_GIL_MANAGEMENT now apply in add_subdirectory mode and to installed/exported targets, not only when pybind11 is the top-level project.

PYBIND11_DISABLE_HANDLE_TYPE_NAME_DEFAULT_IMPLEMENTATION and
PYBIND11_SIMPLE_GIL_MANAGEMENT were directory-scoped
add_compile_definitions, which only reached the master-project test
build. On the pybind11_headers INTERFACE (like
PYBIND11_INTERNALS_VERSION) they also apply in add_subdirectory mode
and in the exported/installed targets.

Assisted-by: ClaudeCode:claude-fable-5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant