From 655b137ee20eeafcf082079cc25822e40dc13715 Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Wed, 2 Oct 2019 09:30:06 -0400 Subject: [PATCH] Bindings: Pick up include dirs from targets --- src/bindings/python/CMakeLists.txt | 9 ++++++++- src/bindings/ruby/CMakeLists.txt | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/bindings/python/CMakeLists.txt b/src/bindings/python/CMakeLists.txt index 9afabd41..90053270 100644 --- a/src/bindings/python/CMakeLists.txt +++ b/src/bindings/python/CMakeLists.txt @@ -56,6 +56,13 @@ if (PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND) separate_arguments(sw_flags UNIX_COMMAND ${SWIG_CXX_FLAGS}) set_property(SOURCE openshot.i PROPERTY GENERATED_COMPILE_OPTIONS ${sw_flags}) + ### Take include dirs from target, automatically if possible + if (CMAKE_VERSION VERSION_GREATER 3.13) + set_property(SOURCE openshot.i PROPERTY USE_TARGET_INCLUDE_DIRECTORIES True) + else () + set_property(SOURCE openshot.i PROPERTY INCLUDE_DIRECTORIES $) + endif () + ### Add the SWIG interface file (which defines all the SWIG methods) if (CMAKE_VERSION VERSION_LESS 3.8.0) swig_add_module(pyopenshot python openshot.i) @@ -69,7 +76,7 @@ if (PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND) ### Link the new python wrapper library with libopenshot target_link_libraries(${SWIG_MODULE_pyopenshot_REAL_NAME} - ${PYTHON_LIBRARIES} openshot) + PUBLIC ${PYTHON_LIBRARIES} openshot) ### Check if the following Debian-friendly python module path exists SET(PYTHON_MODULE_PATH "${CMAKE_INSTALL_PREFIX}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages") diff --git a/src/bindings/ruby/CMakeLists.txt b/src/bindings/ruby/CMakeLists.txt index 4b962e73..5208abc1 100644 --- a/src/bindings/ruby/CMakeLists.txt +++ b/src/bindings/ruby/CMakeLists.txt @@ -57,6 +57,13 @@ IF (RUBY_FOUND) separate_arguments(sw_flags UNIX_COMMAND ${SWIG_CXX_FLAGS}) set_property(SOURCE openshot.i PROPERTY GENERATED_COMPILE_OPTIONS ${sw_flags}) + ### Take include dirs from target, automatically if possible + if (CMAKE_VERSION VERSION_GREATER 3.13) + set_property(SOURCE openshot.i PROPERTY USE_TARGET_INCLUDE_DIRECTORIES True) + else () + set_property(SOURCE openshot.i PROPERTY INCLUDE_DIRECTORIES $) + endif () + ### Add the SWIG interface file (which defines all the SWIG methods) if (CMAKE_VERSION VERSION_LESS 3.8.0) swig_add_module(rbopenshot ruby openshot.i)