Using ExternalProject_Add with catkin
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?
Hi there! I've found myself in a similar situation. Have you found a solution/workaround yet?