fix(cmake): regression in include gaurd (#5691)

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
This commit is contained in:
Henry Schreiner
2025-05-26 12:26:08 -04:00
committed by GitHub
parent 03b4a9e56f
commit 6e3e8515e7
2 changed files with 6 additions and 3 deletions

View File

@@ -18,8 +18,6 @@ Adds the following functions::
#]======================================================]
include_guard(GLOBAL)
# If we are in subdirectory mode, all IMPORTED targets must be GLOBAL. If we
# are in CONFIG mode, they should be "normal" targets instead.
# In CMake 3.11+ you can promote a target to global after you create it,
@@ -28,8 +26,13 @@ get_property(
is_config
TARGET pybind11::headers
PROPERTY IMPORTED)
if(NOT is_config)
include_guard(GLOBAL)
set(optional_global GLOBAL)
else()
include_guard(DIRECTORY)
set(optional_global "")
endif()
# If not run in Python mode, we still would like this to at least