Merge pull request #1487 from borglab/fix-system-pybind11-first

Allow using system pybind11 if it exists.
release/4.3a0
Frank Dellaert 2023-03-07 13:00:09 -08:00 committed by GitHub
commit 2e9db2a5e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 1 deletions

View File

@ -21,7 +21,19 @@ include(PybindWrap)
## Load the necessary files to compile the wrapper
# Load the pybind11 code
# This is required to avoid an error in modern pybind11 cmake scripts:
if(POLICY CMP0057)
cmake_policy(SET CMP0057 NEW)
endif()
# Prefer system pybind11 first, if not found, rely on bundled version:
find_package(pybind11 CONFIG QUIET)
if (NOT pybind11_FOUND)
add_subdirectory(${PROJECT_SOURCE_DIR}/wrap/pybind11 pybind11)
endif()
# Set the wrapping script variable
set(PYBIND_WRAP_SCRIPT "${PROJECT_SOURCE_DIR}/wrap/scripts/pybind_wrap.py")
############################################################