Ask Your Question
1

Using ExternalProject_Add with catkin

asked 2013-05-22 09:03:25 -0600

derekjchow gravatar image

updated 2014-01-28 17:16:36 -0600

ngrennan gravatar image

I've been trying to add an external project to catkin using the ExternalProject_Add feature in CMake. My CMakeLists.txt files looks something like follows:

cmake_minimum_required(VERSION 2.8.3)

include(ExternalProject)

ExternalProject_Add( foreignproject
  PREFIX foreignprojectlib
  GIT_REPOSITORY foreignproject.git
  BUILD_IN_SOURCE
  BUILD_COMMAND cmake --build .
  INSTALL_COMMAND ""
)

project(rosproject)

catkin_package(
  INCLUDE_DIRS include ${DIRECTORY_TO_FOREIGN_PROJECT_HEADERS}
  LIBRARIES rosproject foreignproject
  CATKIN_DEPENDS opencv2 roscpp tf
  DEPENDS system_lib
)

include_directories(include
  ${catkin_INCLUDE_DIRS}
)

add_executable(rosnode src/rosnode.cpp)

The problem I am coming across is that the header file from the external project is not being found. In fact, I'm finding that catkin_make (-j1) tries to build rosnode before it builds the external library. Could someone explain the proper way of using ExternalProject_Add or post an example of a CMakeLists.txt file that successfully uses ExternalProject_Add?

edit retag flag offensive close merge delete

Comments

Hi there! I've found myself in a similar situation. Have you found a solution/workaround yet?

Murilo F. M. gravatar imageMurilo F. M. ( 2013-07-18 12:49:37 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
2

answered 2013-07-18 15:33:02 -0600

ahendrix gravatar image

I believe catkin_package sets the include directories for downstream projects, but does not set the include directories for the current project.

You probably also need to do:

include_directories(
    include
    ${catkin_INCLUDE_DIRS}
    ${DIRECTORY_TO_FOREIGN_PROJECT_HEADERS}
)

Also, what @William said.

edit flag offensive delete link more
1

answered 2013-07-18 13:55:32 -0600

William gravatar image

You probably need to add a dependency on the external project target, so that the node is built later:

add_dependencies(rosnode foreignproject)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-05-22 09:03:25 -0600

Seen: 3,087 times

Last updated: Jul 18 '13