diff mbox series

[meta-python] python3-pybind11-json: fix Targets.cmake trying to reference host

Message ID 20260212175408.146005-1-tafil@tafhub.de
State New
Headers show
Series [meta-python] python3-pybind11-json: fix Targets.cmake trying to reference host | expand

Commit Message

Tafil Avdyli Feb. 12, 2026, 5:54 p.m. UTC
The resulting pybind11_jsonTargets.cmake in the dev-package adds an
absolute path to python include directories in the target properties:

  set_target_properties(pybind11_json PROPERTIES
    INTERFACE_INCLUDE_DIRECTORIES "/usr/include/python3.13;${_IMPORT_PREFIX}/include"
  )

The patch removes ${PYTHON_INCLUDE_DIRS} which is set by pybind11 from
set_target_properties to remove the poisonous host path.

Signed-off-by: Tafil Avdyli <tafil@tafhub.de>
---
 ...p-PYTHON_INCLUDE_DIRS-from-interface.patch | 34 +++++++++++++++++++
 .../python/python3-pybind11-json_0.2.15.bb    |  3 +-
 2 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100644 meta-python/recipes-devtools/python/python3-pybind11-json/0001-CMakeLists-drop-PYTHON_INCLUDE_DIRS-from-interface.patch
diff mbox series

Patch

diff --git a/meta-python/recipes-devtools/python/python3-pybind11-json/0001-CMakeLists-drop-PYTHON_INCLUDE_DIRS-from-interface.patch b/meta-python/recipes-devtools/python/python3-pybind11-json/0001-CMakeLists-drop-PYTHON_INCLUDE_DIRS-from-interface.patch
new file mode 100644
index 0000000000..e1bf82e506
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-pybind11-json/0001-CMakeLists-drop-PYTHON_INCLUDE_DIRS-from-interface.patch
@@ -0,0 +1,34 @@ 
+From 6d4af27d1b43860d8deb3d1d2b2a910e82618ac1 Mon Sep 17 00:00:00 2001
+From: Tafil Avdyli <tafil@tafhub.de>
+Date: Sat, 24 Jan 2026 09:14:03 +0100
+Subject: [PATCH] CMakeLists: drop PYTHON_INCLUDE_DIRS from interface
+
+Including PYTHON_INCLUDE_DIRS in the INTERFACE list caused a hard-coded
+Python include directory (e.g. /usr/include/python3.13) to appear in the
+generated Targets.cmake file. This resulted in a CMake configuration
+error when the path did not exist:
+
+    Imported target "pybind11_json" includes non-existent path
+      "/usr/include/python3.13"
+
+pybind11_json is header-only and does not use Python headers, so the
+include path should not be exported.
+
+Upstream-Status: Submitted [https://github.com/pybind/pybind11_json/pull/77]
+Signed-off-by: Tafil Avdyli <tafil@tafhub.de>
+---
+ CMakeLists.txt | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 0be4838..4b305e4 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -45,7 +45,6 @@ add_library(${PROJECT_NAME} INTERFACE)
+ 
+ target_include_directories(${PROJECT_NAME}
+                            INTERFACE
+-                           ${PYTHON_INCLUDE_DIRS}
+                            $<BUILD_INTERFACE:${PYBIND11_JSON_INCLUDE_DIR}>
+                            $<INSTALL_INTERFACE:include>)
+ 
diff --git a/meta-python/recipes-devtools/python/python3-pybind11-json_0.2.15.bb b/meta-python/recipes-devtools/python/python3-pybind11-json_0.2.15.bb
index 8ad7dba76a..2a030af988 100644
--- a/meta-python/recipes-devtools/python/python3-pybind11-json_0.2.15.bb
+++ b/meta-python/recipes-devtools/python/python3-pybind11-json_0.2.15.bb
@@ -4,7 +4,8 @@  LIC_FILES_CHKSUM = "file://LICENSE;md5=0e25ff0ec476d06d366439e1120cce98"
 
 SRCREV = "32043f433ed987b2c2ce99d689ec337bcbd4ba95"
 SRC_URI = "git://github.com/pybind/pybind11_json;branch=master;protocol=https \
-           file://d72ad4df929bc9d0882298fc1f85ecf589456ff6.patch"
+           file://d72ad4df929bc9d0882298fc1f85ecf589456ff6.patch \
+           file://0001-CMakeLists-drop-PYTHON_INCLUDE_DIRS-from-interface.patch"
 
 DEPENDS += "nlohmann-json python3-pybind11"