Skip to content

Commit 90707b4

Browse files
authored
fix(build): support conan's multiple includes of all files (#3420)
1 parent e7e2c79 commit 90707b4

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

tools/pybind11Common.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Adds the following functions::
2020
#]======================================================]
2121

2222
# CMake 3.10 has an include_guard command, but we can't use that yet
23+
# include_guard(global) (pre-CMake 3.10)
2324
if(TARGET pybind11::lto)
2425
return()
2526
endif()

tools/pybind11NewTools.cmake

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
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+
if(CMAKE_VERSION VERSION_LESS 3.12)
9+
message(FATAL_ERROR "You cannot use the new FindPython module with CMake < 3.12")
10+
endif()
11+
12+
include_guard(GLOBAL)
13+
814
get_property(
915
is_config
1016
TARGET pybind11::headers
@@ -16,10 +22,6 @@ else()
1622
set(_pybind11_quiet "")
1723
endif()
1824

19-
if(CMAKE_VERSION VERSION_LESS 3.12)
20-
message(FATAL_ERROR "You cannot use the new FindPython module with CMake < 3.12")
21-
endif()
22-
2325
if(NOT Python_FOUND
2426
AND NOT Python3_FOUND
2527
AND NOT Python2_FOUND)

tools/pybind11Tools.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
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) (pre-CMake 3.10)
9+
if(TARGET pybind11::python_headers)
10+
return()
11+
endif()
12+
813
# Built-in in CMake 3.5+
914
include(CMakeParseArguments)
1015

0 commit comments

Comments
 (0)