Skip to content

Commit 6e3e851

Browse files
authored
fix(cmake): regression in include gaurd (#5691)
Signed-off-by: Henry Schreiner <[email protected]>
1 parent 03b4a9e commit 6e3e851

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

tools/pybind11Common.cmake

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ Adds the following functions::
1818
1919
#]======================================================]
2020

21-
include_guard(GLOBAL)
22-
2321
# If we are in subdirectory mode, all IMPORTED targets must be GLOBAL. If we
2422
# are in CONFIG mode, they should be "normal" targets instead.
2523
# In CMake 3.11+ you can promote a target to global after you create it,
@@ -28,8 +26,13 @@ get_property(
2826
is_config
2927
TARGET pybind11::headers
3028
PROPERTY IMPORTED)
29+
3130
if(NOT is_config)
31+
include_guard(GLOBAL)
3232
set(optional_global GLOBAL)
33+
else()
34+
include_guard(DIRECTORY)
35+
set(optional_global "")
3336
endif()
3437

3538
# If not run in Python mode, we still would like this to at least

tools/pybind11Tools.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# All rights reserved. Use of this source code is governed by a
66
# BSD-style license that can be found in the LICENSE file.
77

8-
include_guard(GLOBAL)
8+
include_guard(DIRECTORY)
99

1010
if(pybind11_FIND_QUIETLY)
1111
set(_pybind11_quiet QUIET)

0 commit comments

Comments
 (0)