Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMakeLists.txt: don't include CERES_INCLUDE_DIRS if it's empty or not set #1808

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shr-project
Copy link

@shr-project shr-project commented Feb 19, 2021

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

Want to contribute? Great! Make sure you've read and understood
CONTRIBUTING.md.

… set

* possibly partial fix for:
  cartographer-project#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>
@shr-project shr-project changed the title CMakeLists.txt: don't add PROJECT_SOURCE_DIR to PUBLIC include headers CMakeLists.txt: don't include CERES_INCLUDE_DIRS if it's empty or not set Feb 21, 2021
@shr-project shr-project marked this pull request as ready for review February 21, 2021 15:59
@shr-project
Copy link
Author

Alternative solution is to remove quotes around CERES_INCLUDE_DIRS (and possibly other variables later used in target_include_directories calls).

Relevant discussion and a bug in CMake:
https://discourse.cmake.org/t/target-include-directories-behavior-with-empty-value/2867
https://gitlab.kitware.com/cmake/cmake/-/issues/21879

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant