diff --git a/CMakeLists.txt b/CMakeLists.txt index f5559e33f94c56ac9122b267e2238b9fdcebe152..ff2e6fb2ce3c4970dc791eda3879e346ae950dd1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,10 +87,11 @@ if (PYBIND) # Handles Python + pybind11 headers dependencies target_link_libraries(${module_name} PRIVATE - Python::Module + Python::Python PUBLIC pybind11::pybind11 ) + target_link_libraries(${project} PUBLIC ${module_name}) endif() target_link_libraries(${module_name} PUBLIC Threads::Threads fmt::fmt) diff --git a/cmake/PybindModuleCreation.cmake b/cmake/PybindModuleCreation.cmake index 9ed3fcec4b27712ac441ef48cab130bb3364d75c..dea2ba2b5f6da1b7ee523b19ce5b1746f8857abf 100644 --- a/cmake/PybindModuleCreation.cmake +++ b/cmake/PybindModuleCreation.cmake @@ -4,7 +4,7 @@ macro(generate_python_binding ) # Use the New FindPython mode, recommanded. Requires CMake 3.15+ find_package(Python 3.7.0 - COMPONENTS Interpreter Development.Module + COMPONENTS Interpreter Development.Module Development.Embed REQUIRED) set(PYBIND11_FINDPYTHON ON) set(PYBIND_VERSION v2.10.4) @@ -21,7 +21,6 @@ macro(generate_python_binding ) pybind11_add_module(${project} MODULE ${pybind_src_files} "NO_EXTRAS") # NO EXTRA required for pip install target_include_directories(${project} PUBLIC "python_binding" ${pybind11_INCLUDE_DIRECTORIES}) - target_link_libraries(${project} PUBLIC ${module_name}) endmacro()