Skip to content

Commit

Permalink
CMakeLists.txt: don't add PROJECT_SOURCE_DIR to PUBLIC include headers
Browse files Browse the repository at this point in the history
* possibly partial fix for:
  #1688

* 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 <[email protected]>
  • Loading branch information
shr-project committed Feb 19, 2021
1 parent 3abea34 commit cf656fc
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,8 @@ endforeach()

# Add the binary directory first, so that port.h is included after it has
# been generated.
include_directories(${PROJECT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>
)

Expand Down

0 comments on commit cf656fc

Please sign in to comment.