robotology / idyntree

Multibody Dynamics Library designed for Free Floating Robots
BSD 3-Clause "New" or "Revised" License
155 stars 65 forks source link

Remove vendored FindMatlab.cmake #1147

Closed traversaro closed 5 months ago

traversaro commented 5 months ago

As all the required custom logic was merged in CMake 3.24, see https://github.com/robotology/robotology-superbuild/issues/1044#issuecomment-1893278003 .

traversaro commented 5 months ago

Build fails on Ubuntu with apt dependencies with error:

CMake Error at /usr/share/cmake-3.16/Modules/FindMatlab.cmake:1021 (add_library):
  Cannot find source file:

    NO_IMPLICIT_LINK_TO_MATLAB_LIBRARIES

  Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
  .hpp .hxx .in .txx

That make sense, as older CMake do not know what to do with this option, and think it is a source file instead.

traversaro commented 5 months ago

Build fails on Ubuntu with apt dependencies with error:

CMake Error at /usr/share/cmake-3.16/Modules/FindMatlab.cmake:1021 (add_library):
  Cannot find source file:

    NO_IMPLICIT_LINK_TO_MATLAB_LIBRARIES

  Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
  .hpp .hxx .in .txx

That make sense, as older CMake do not know what to do with this option, and think it is a source file instead.

In https://github.com/robotology/idyntree/pull/1147/commits/5b14811aaa0913d2a4a8393fc1733b8eb49dae3f tried to just put the option before the SRC list, but this does not work as even unparsed arguments are passed to matlab_add_mex. So the only thing to do is to add an if based on the CMake version.

traversaro commented 5 months ago

Build fails on Ubuntu with apt dependencies with error:

CMake Error at /usr/share/cmake-3.16/Modules/FindMatlab.cmake:1021 (add_library):
  Cannot find source file:

    NO_IMPLICIT_LINK_TO_MATLAB_LIBRARIES

  Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
  .hpp .hxx .in .txx

That make sense, as older CMake do not know what to do with this option, and think it is a source file instead.

In 5b14811 tried to just put the option before the SRC list, but this does not work as even unparsed arguments are passed to matlab_add_mex. So the only thing to do is to add an if based on the CMake version.

This worked fine, let's merge.