ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

catkin/cmake include upstream path before debian path?

asked 2020-01-30 21:53:12 -0600

updated 2020-01-31 16:27:50 -0600

I have a problem where I want to depend on a newer interface than what is in the debain install. To do this I am building the library I'm depending on (moveit) from source in an upstream workspace. However for some reason catkin/cmake is creating an include list that is always including the debian based includes first. This is from the compile step:

-isystem /home/tyler/workspace/ws_upstream/install/include -I/opt/ros/melodic/include

Here is the documentation from the man page of g++ (-isystem is always searched after -I):

       The lookup order is as follows:
   1.  For the quote form of the include directive, the directory of the current file is searched first.
   2.  For the quote form of the include directive, the directories specified by -iquote options are searched in left-to-right
       order, as they appear on the command line.
   3.  Directories specified with -I options are scanned in left-to-right order.
   4.  Directories specified with -isystem options are scanned in left-to-right order.
   5.  Standard system directories are scanned.
   6.  Directories specified with -idirafter options are scanned in left-to-right order.

How can I instruct catkin/cmake to include my upstream include path first (by changing the -isystem to -I or something similar)?

Here are the relevant parts of my CMakeLists.txt:

find_package(catkin REQUIRED COMPONENTS
  moveit_core
  moveit_ros_planning
  moveit_ros_planning_interface
  roscpp
)

catkin_package(
  CATKIN_DEPENDS
    moveit_core
    moveit_ros_planning
    moveit_ros_planning_interface
    roscpp
  INCLUDE_DIRS
    include
  LIBRARIES
    ${PROJECT_NAME}
  DEPENDS
    Boost
    EIGEN3
)

include_directories(
  include/
  ${catkin_INCLUDE_DIRS}
  ${Boost_INCLUDE_DIR}
  ${EIGEN3_INCLUDE_DIRS})

add_library(${PROJECT_NAME} src/main.cpp)

target_link_libraries(${PROJECT_NAME}
  ${catkin_LIBRARIES}
  ${Boost_LIBRARIES}
)

add_dependencies(${PROJECT_NAME} ${catkin_EXPORTED_TARGETS})
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-01-31 16:27:26 -0600

updated 2020-01-31 16:28:30 -0600

In case anyone else has this problem the solution to this is the word SYSTEM in the include_directories command:

include_directories(
  include
  SYSTEM
    ${catkin_INCLUDE_DIRS}
    ${Boost_INCLUDE_DIR}
    ${EIGEN3_INCLUDE_DIRS}
)
edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2020-01-30 21:53:12 -0600

Seen: 143 times

Last updated: Jan 31 '20