Skip to content

fix(build): support conan's multiple includes of all files #3420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tools/pybind11Common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Adds the following functions::
#]======================================================]

# CMake 3.10 has an include_guard command, but we can't use that yet
# include_guard(global) (pre-CMake 3.10)
if(TARGET pybind11::lto)
return()
endif()
Expand Down
10 changes: 6 additions & 4 deletions tools/pybind11NewTools.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
# All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.

if(CMAKE_VERSION VERSION_LESS 3.12)
message(FATAL_ERROR "You cannot use the new FindPython module with CMake < 3.12")
endif()

include_guard(GLOBAL)

get_property(
is_config
TARGET pybind11::headers
Expand All @@ -16,10 +22,6 @@ else()
set(_pybind11_quiet "")
endif()

if(CMAKE_VERSION VERSION_LESS 3.12)
message(FATAL_ERROR "You cannot use the new FindPython module with CMake < 3.12")
endif()

if(NOT Python_FOUND
AND NOT Python3_FOUND
AND NOT Python2_FOUND)
Expand Down
5 changes: 5 additions & 0 deletions tools/pybind11Tools.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
# All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.

# include_guard(global) (pre-CMake 3.10)
if(TARGET pybind11::python_headers)
return()
endif()

# Built-in in CMake 3.5+
include(CMakeParseArguments)

Expand Down