From 0c467ad654224a648ab85697ed1f87078e25607c Mon Sep 17 00:00:00 2001 From: Josh Polansky Date: Sun, 29 Sep 2024 03:41:48 -0700 Subject: [PATCH] Check if pybind already exists (#208) --- CMakeLists.txt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ea2ff7..b45fa9e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -105,11 +105,15 @@ endif() if(BUILD_PYTHON_MODULE) - # Check if pybind11 exists as a subdirectory - if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/pybind11) - add_subdirectory(pybind11) - else() - find_package(pybind11 2.6 REQUIRED) + + # check if pybind11 is already available + if(NOT TARGET pybind11::module) + # Check if pybind11 exists as a subdirectory + if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/pybind11) + add_subdirectory(pybind11) + else() + find_package(pybind11 2.6 REQUIRED) + endif() endif() pybind11_add_module(python_ruckig src/ruckig/python.cpp)