dongjing3309 / minisam

A general and flexible factor graph non-linear least square optimization framework
https://minisam.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
483 stars 92 forks source link

get_target_property() called with non-existent target "Sophus::Sophus" #4

Open kintzhao opened 4 years ago

kintzhao commented 4 years ago

CMake Error at CMakeLists.txt:101 (get_target_property): get_target_property() called with non-existent target "Sophus::Sophus".
https://github.com/dongjing3309/minisam/issues/1

I have the same question, which version of sophus is necessary ? my sophus is a621ff2e56c56c839a6c40418d42c .

  1. when i do with readme, cmake with:

    -- Search Dependency: Sophus CMake Error at CMakeLists.txt:101 (get_target_property): get_target_property() called with non-existent target "Sophus::Sophus".

  2. when i ignore the line of 101 in CMakeLists.txt.. camke with error

    [ 43%] Building CXX object minisam/CMakeFiles/minisam.dir/geometry/projection.cpp.o In file included from /home/yhzhao/test_git/minisam/minisam/geometry/projection.cpp:9:0: /home/yhzhao/test_git/minisam/minisam/geometry/projection.h:13:26: fatal error: sophus/se3.hpp: No such file or directory compilation terminated.

log00544 commented 4 years ago

According to my installation experience of minisam, Sophus is not optional, however necessary. And Sophus needs 'eigen3' dependency of version 3.3.0+. On ubuntu, eigen3 must be installed with source code manually, which means not even with cmake or something, but just move it to /usr/include. Sophus git version 0c84aed is fine btw.

rancheng commented 4 years ago

@kintzhao you probability built your Sophus library with an older version.

simply modify your code to #include <sophus/se3.h> rather than #include <sophus/se3.hpp> similar to se2.hpp and other modules in Sophus.

make sure your CMakeList.txt commented out this line:

# get_target_property(Sophus_INCLUDE_DIR Sophus::Sophus INTERFACE_INCLUDE_DIRECTORIES)

Then, in projection.h

// #include <sophus/se3.hpp>
#include <sophus/se3.h>

find all other modules that included the .hpp and change them all.

rancheng commented 4 years ago

After tried to refactor this whole project, I found it's impossible to migrate into older Sophus version, simply build a newer Sophus and don't waste your time.

rancheng commented 4 years ago

@log00544 is right, and please note that if you want to build Sophus against Eigen 3.3, remember to build ceres against eigen3.3 first.