Skip to content

Commit

Permalink
CMakeLists.txt: don't include CERES_INCLUDE_DIRS if it's empty or not…
Browse files Browse the repository at this point in the history
… set

* possibly partial fix for:
  #1688

* ceres documentation says:
  http://ceres-solver.org/installation.html#using-ceres-with-cmake
  Note
  You do not need to call include_directories(${CERES_INCLUDE_DIRS})
  as the exported Ceres CMake target already contains the definitions
  of its public include directories which will be automatically
  included by CMake when compiling a target that links against Ceres.
  In fact, since v2.0 CERES_INCLUDE_DIRS is not even set.

* see ceres-solver change:
  https://ceres-solver.googlesource.com/ceres-solver/+/2166bad133d279ec28008f1df8b4d90a7023f531

* otherwise its source directory ends in INTERFACE_INCLUDE_DIRECTORIES/INTERFACE_SYSTEM_INCLUDE_DIRECTORIES
  variables like this:

set_target_properties(cartographer PROPERTIES
  INTERFACE_INCLUDE_DIRECTORIES "FIXMESTAGINGDIRTARGET/usr/include/eigen3;/jenkins/mjansa/build/ros/ros1-melodic-hardknott/tmp-glibc/work/core2-64-oe-linux/cartographer/1.0.0-r0/git/;FIXMESTAGINGDIRTARGET/usr/include;FIXMESTAGINGDIRTARGET/usr/include;FIXMESTAGINGDIRTARGET/usr/include/cairo;FIXMESTAGINGDIRTARGET/usr/include/glib-2.0;FIXMESTAGINGDIRTARGET/usr/lib/glib-2.0/include;FIXMESTAGINGDIRTARGET/usr/include/pixman-1;FIXMESTAGINGDIRTARGET/usr/include/uuid;FIXMESTAGINGDIRTARGET/usr/include/freetype2;FIXMESTAGINGDIRTARGET/usr/include/libpng16;FIXMESTAGINGDIRTARGET/usr/include;${_IMPORT_PREFIX}/include"
  INTERFACE_LINK_LIBRARIES "Ceres::ceres;FIXMESTAGINGDIRTARGET/usr/lib/liblua.a;FIXMESTAGINGDIRTARGET/usr/lib/libm.so;Boost::iostreams;glog;gflags;cairo;FIXMESTAGINGDIRTARGET/usr/lib/libprotobuf.so;pthread"
  INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "FIXMESTAGINGDIRTARGET/usr/include/eigen3;/jenkins/mjansa/build/ros/ros1-melodic-hardknott/tmp-glibc/work/core2-64-oe-linux/cartographer/1.0.0-r0/git/;FIXMESTAGINGDIRTARGET/usr/include;FIXMESTAGINGDIRTARGET/usr/include;FIXMESTAGINGDIRTARGET/usr/include/cairo;FIXMESTAGINGDIRTARGET/usr/include/glib-2.0;FIXMESTAGINGDIRTARGET/usr/lib/glib-2.0/include;FIXMESTAGINGDIRTARGET/usr/include/pixman-1;FIXMESTAGINGDIRTARGET/usr/include/uuid;FIXMESTAGINGDIRTARGET/usr/include/freetype2;FIXMESTAGINGDIRTARGET/usr/include/libpng16;FIXMESTAGINGDIRTARGET/usr/include"
)

* otherwise the paths to cartographer WORKDIR end in CartographerTargets.cmake
  INTERFACE_INCLUDE_DIRECTORIES, INTERFACE_SYSTEM_INCLUDE_DIRECTORIES variables
  and cartographer-ros fails to configure if cartographer WORKDIR was already
  removed (e.g. when cartographer used from sstate or cleaned with rm_work)

  ./recipe-sysroot/usr/share/cartographer/cmake/CartographerTargets.cmake:  INTERFACE_INCLUDE_DIRECTORIES "/jenkins/mjansa/build/ros/ros2-rolling-hardknott/tmp-glibc/work/core2-64-oe-linux/cartographer-ros/1.0.0-1-r0/recipe-sysroot/usr/include/eigen3;/jenkins/mjansa/build/ros/ros2-rolling-hardknott/tmp-glibc/work/core2-64-oe-linux/cartographer/1.0.0-r0/git/;/jenkins/mjansa/build/ros/ros2-rolling-hardknott/tmp-glibc/work/core2-64-oe-linux/cartographer-ros/1.0.0-1-r0/recipe-sysroot/usr/include;/jenkins/mjansa/build/ros/ros2-rolling-hardknott/tmp-glibc/work/core2-64-oe-linux/cartographer-ros/1.0.0-1-r0/recipe-sysroot/usr/include;/jenkins/mjansa/build/ros/ros2-rolling-hardknott/tmp-glibc/work/core2-64-oe-linux/cartographer-ros/1.0.0-1-r0/recipe-sysroot/usr/include/cairo;/jenkins/mjansa/build/ros/ros2-rolling-hardknott/tmp-glibc/work/core2-64-oe-linux/cartographer-ros/1.0.0-1-r0/recipe-sysroot/usr/include/glib-2.0;/jenkins/mjansa/build/ros/ros2-rolling-hardknott/tmp-glibc/work/core2-64-oe-linux/cartographer-ros/1.0.0-1-r0/recipe-sysroot/usr/lib/glib-2.0/include;/jenkins/mjansa/build/ros/ros2-rolling-hardknott/tmp-glibc/work/core2-64-oe-linux/cartographer-ros/1.0.0-1-r0/recipe-sysroot/usr/include/pixman-1;/jenkins/mjansa/build/ros/ros2-rolling-hardknott/tmp-glibc/work/core2-64-oe-linux/cartographer-ros/1.0.0-1-r0/recipe-sysroot/usr/include/uuid;/jenkins/mjansa/build/ros/ros2-rolling-hardknott/tmp-glibc/work/core2-64-oe-linux/cartographer-ros/1.0.0-1-r0/recipe-sysroot/usr/include/freetype2;/jenkins/mjansa/build/ros/ros2-rolling-hardknott/tmp-glibc/work/core2-64-oe-linux/cartographer-ros/1.0.0-1-r0/recipe-sysroot/usr/include/libpng16;/jenkins/mjansa/build/ros/ros2-rolling-hardknott/tmp-glibc/work/core2-64-oe-linux/cartographer-ros/1.0.0-1-r0/recipe-sysroot/usr/include;${_IMPORT_PREFIX}/include"

  ./recipe-sysroot/usr/share/cartographer/cmake/CartographerTargets.cmake:  INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "/jenkins/mjansa/build/ros/ros2-rolling-hardknott/tmp-glibc/work/core2-64-oe-linux/cartographer-ros/1.0.0-1-r0/recipe-sysroot/usr/include/eigen3;/jenkins/mjansa/build/ros/ros2-rolling-hardknott/tmp-glibc/work/core2-64-oe-linux/cartographer/1.0.0-r0/git/;/jenkins/mjansa/build/ros/ros2-rolling-hardknott/tmp-glibc/work/core2-64-oe-linux/cartographer-ros/1.0.0-1-r0/recipe-sysroot/usr/include;/jenkins/mjansa/build/ros/ros2-rolling-hardknott/tmp-glibc/work/core2-64-oe-linux/cartographer-ros/1.0.0-1-r0/recipe-sysroot/usr/include;/jenkins/mjansa/build/ros/ros2-rolling-hardknott/tmp-glibc/work/core2-64-oe-linux/cartographer-ros/1.0.0-1-r0/recipe-sysroot/usr/include/cairo;/jenkins/mjansa/build/ros/ros2-rolling-hardknott/tmp-glibc/work/core2-64-oe-linux/cartographer-ros/1.0.0-1-r0/recipe-sysroot/usr/include/glib-2.0;/jenkins/mjansa/build/ros/ros2-rolling-hardknott/tmp-glibc/work/core2-64-oe-linux/cartographer-ros/1.0.0-1-r0/recipe-sysroot/usr/lib/glib-2.0/include;/jenkins/mjansa/build/ros/ros2-rolling-hardknott/tmp-glibc/work/core2-64-oe-linux/cartographer-ros/1.0.0-1-r0/recipe-sysroot/usr/include/pixman-1;/jenkins/mjansa/build/ros/ros2-rolling-hardknott/tmp-glibc/work/core2-64-oe-linux/cartographer-ros/1.0.0-1-r0/recipe-sysroot/usr/include/uuid;/jenkins/mjansa/build/ros/ros2-rolling-hardknott/tmp-glibc/work/core2-64-oe-linux/cartographer-ros/1.0.0-1-r0/recipe-sysroot/usr/include/freetype2;/jenkins/mjansa/build/ros/ros2-rolling-hardknott/tmp-glibc/work/core2-64-oe-linux/cartographer-ros/1.0.0-1-r0/recipe-sysroot/usr/include/libpng16;/jenkins/mjansa/build/ros/ros2-rolling-hardknott/tmp-glibc/work/core2-64-oe-linux/cartographer-ros/1.0.0-1-r0/recipe-sysroot/usr/include"

* fixes cartographer-ros do_configure error:
-- Configuring done
CMake Error in CMakeLists.txt:
  Imported target "cartographer" includes non-existent path

    "/jenkins/mjansa/build/ros/ros2-rolling-hardknott/tmp-glibc/work/core2-64-oe-linux/cartographer/1.0.0-r0/git/"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and references files it does not
  provide.

Signed-off-by: Martin Jansa <martin.jansa@lge.com>
  • Loading branch information
shr-project committed Feb 21, 2021
1 parent 3abea34 commit 21c6fdf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,12 @@ target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC
"${EIGEN3_INCLUDE_DIR}")
target_link_libraries(${PROJECT_NAME} PUBLIC ${EIGEN3_LIBRARIES})

target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC
"${CERES_INCLUDE_DIRS}")
if (CERES_INCLUDE_DIRS AND NOT "${CERES_INCLUDE_DIRS}" STREQUAL "")
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC
"${CERES_INCLUDE_DIRS}")
else()
message(STATUS "Not including CERES_INCLUDE_DIRS, because it's not set or empty, see http://ceres-solver.org/installation.html#using-ceres-with-cmake Ceres: CERES_INCLUDE_DIRS: '${CERES_INCLUDE_DIRS}' CERES_INCLUDE_DIR '${CERES_INCLUDE_DIR}'")
endif()
target_link_libraries(${PROJECT_NAME} PUBLIC ${CERES_LIBRARIES})

target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC
Expand Down

0 comments on commit 21c6fdf

Please sign in to comment.