cmakeroscatkin

Could not find a package configuration file for "qpOASES"


I'm getting an error when compiling my code in dependency with qpOASES using catkin:

$ catkin build:

The Package qpOASES is already cloned inside the same catkin workspace

CMake Error at /opt/ros/noetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
  Could not find a package configuration file provided by "qpOASES" with any
  of the following names:

    qpOASESConfig.cmake
    qpoases-config.cmake

  Add the installation prefix of "qpOASES" to CMAKE_PREFIX_PATH or set
  "qpOASES_DIR" to a directory containing one of the above files.  If
  "qpOASES" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  CMakeLists.txt:25 (find_package)

CMakeLists.txt

cmake_minimum_required(VERSION 3.1)

#################
# CMake project
#################
project(ros_wrap_safe_motion)

## Compile as C++11, supported in ROS Kinetic and newer
add_compile_options(-std=c++14)

set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
SET(CMAKE_CXX_FLAGS "-std=c++14")
########################################################################################################################

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages

find_package(OpenCV REQUIRED)
find_package(PCL REQUIRED)

find_package(catkin REQUIRED COMPONENTS
  roscpp
  rospy
  std_msgs
  sensor_msgs
  kdl_parser
  gazebo_ros
  cv_bridge
  trac_ik_lib
  image_transport
  qpOASES
  rviz_visual_tools
  eigen_conversions
  pcl_conversions
  pcl_ros
  )

find_package(gazebo REQUIRED)

# find_package(OpenCV REQUIRED)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ")
find_package(OpenCV 3.0 QUIET)

# find_package(PCL 1.11 REQUIRED)
# set(${PCL_INCLUDE_DIRS} /usr/local/include/pcl-1.11)

include_directories(
  include
  ${catkin_INCLUDE_DIRS}
  ${OpenCV_INCLUDE_DIRS}
  ${PCL_INCLUDE_DIRS}
)

link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
#Searching CUDA
find_package(CUDA)

#Include the FindCUDA script
include(FindCUDA)

if(NOT OpenCV_FOUND)
    find_package(OpenCV 2.4.3 QUIET)
    if(NOT OpenCV_FOUND)
        message(FATAL_ERROR "OpenCV > 2.4.3 not found.")
    endif()
endif()

include_directories(${INC_DIR} ${EIGEN3_INCLUDE_DIR} ${OpenCV_INCLUDE_DIRS})
link_directories(${LINK_DIR} ${OpenCV_LIBS})

catkin_package(
    INCLUDE_DIRS 
     include
    LIBRARIES 
      ros_wrap_safe_motion_library
    )

set_property(GLOBAL PROPERTY USE_FOLDERS ON)
include_directories("${PROJECT_BINARY_DIR}")
include_directories(
    include
    ${catkin_INCLUDE_DIRS}
    ${SDFormat_INCLUDE_DIRS}
    ${Boost_INCLUDE_DIRS}
    ${qpAOSES_INCLUDE_DIRS}
    ${rviz_visual_tools_INCLUDE_DIRS}
#    ${lpsolve_catkin_INCLUDE_DIRS}

    )
include_directories(${GAZEBO_INCLUDE_DIRS})
link_directories( ${GAZEBO_LIBRARY_DIRS} ${qpOASES_LIBRARY_DIRS} ${rviz_visual_tools_LIBRARY_DIRS})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GAZEBO_CXX_FLAGS}")

###########
## Build ##
###########

## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
# include
  ${catkin_INCLUDE_DIRS}
)

The problem is that the qpOASES dependency is not compiled before the ros_wrap_safe_motion, hence it can't find it.

How can I solve that?


Solution

  • Adding the dependency to the package.xml file:

    <build_depend>qpOASES</build_depend>
    

    Has solved the problem in my case