diff --git a/bindings/matlab/CMakeLists.txt b/bindings/matlab/CMakeLists.txt index f6f7a2b499..5c2f11bf25 100644 --- a/bindings/matlab/CMakeLists.txt +++ b/bindings/matlab/CMakeLists.txt @@ -76,7 +76,11 @@ macro(GET_LIBRARY_FROM_SWIG_WRAPPER i_main_file i_other_files target_name genera PROPERTY SWIG_DEPENDS ${i_other_files}) else() if(${target_name} STREQUAL "iDynTreeMEX") - matlab_add_mex(NAME ${target_name} NO_IMPLICIT_LINK_TO_MATLAB_LIBRARIES SRC ${swig_generated_sources}) + if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24") + matlab_add_mex(NAME ${target_name} NO_IMPLICIT_LINK_TO_MATLAB_LIBRARIES SRC ${swig_generated_sources}) + else() + matlab_add_mex(NAME ${target_name} SRC ${swig_generated_sources}) + endif() else() add_library(${target_name} MODULE ${swig_generated_sources}) endif()