Skip to content

Commit 0922a01

Browse files
committed
Mark the pybind11 include directory SYSTEM
`pybind11/eval.h` calls `_Py_fopen_obj`, which Python 3.14 deprecates. The plain `include_directories()` applied the core warning flags to that header, so `-Werror` turned it into a build failure. `pybind11` marks its own headers `SYSTEM` only when consumed through `add_subdirectory()`, leaving a `find_package()` consumer such as this one to do it itself. `SYSTEM` silences the third-party header while keeping `-Werror` on our own deprecated uses, which `-Wno-error=deprecated-declarations` would have demoted to a warning. `numpy` a few lines below already gets the same treatment for the same reason.
1 parent 778186e commit 0922a01

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,9 @@ endif()
278278
option(pybind11_path "pybind11 path")
279279
find_package(pybind11 2.12.0 REQUIRED PATHS ${pybind11_path})
280280
message(STATUS "pybind11_INCLUDE_DIRS: ${pybind11_INCLUDE_DIRS}")
281-
include_directories(${pybind11_INCLUDE_DIRS})
281+
# SYSTEM keeps the core's warning flags off pybind11's own headers, the same
282+
# reason numpy gets it below.
283+
include_directories(SYSTEM ${pybind11_INCLUDE_DIRS})
282284

283285
set(NUMPY_INCLUDE_DIR "${Python_NumPy_INCLUDE_DIRS}")
284286
message(STATUS "NUMPY_INCLUDE_DIR: ${NUMPY_INCLUDE_DIR}")

0 commit comments

Comments
 (0)