Commit a7e4cab5 authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

[CMake] fix qpOASES detection

parent 16b2f000
......@@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 2.6)
INCLUDE(cmake/base.cmake)
INCLUDE(cmake/test.cmake)
INCLUDE(cmake/python.cmake)
INCLUDE(cmake2/FindqpOASES.cmake)
SET(PROJECT_ORG stonneau)
SET(PROJECT_NAME hpp-centroidal-dynamics)
......@@ -51,7 +50,12 @@ else()
endif()
#SEARCH_FOR_QPOASES()
ADD_REQUIRED_DEPENDENCY("qpOASES")
#ADD_REQUIRED_DEPENDENCY("qpOASES")
SET(QPOASES_PREFIX ${CMAKE_PREFIX_PATH} CACHE PATH "Set the prefix where qpOASES is installed")
FIND_LIBRARY(QPOASES_LIBRARY "qpOASES" PATHS ${QPOASES_PREFIX} PATH_SUFFIXES lib)
FIND_PATH(QPOASES_INCLUDE_DIRS NAMES "qpOASES.hpp" PATHS ${QPOASES_PREFIX} PATH_SUFFIXES include)
INCLUDE_DIRECTORIES(${QPOASES_INCLUDE_DIRS})
ADD_SUBDIRECTORY (include/${CUSTOM_HEADER_DIR})
add_subdirectory (src)
......
#.rst:
# FindqpOASES
# -----------
#
# Try to find the qpOASES library.
# Once done this will define the following variables::
#
# qpOASES_FOUND - System has qpOASES
# qpOASES_INCLUDE_DIR - qpOASES include directory
# qpOASES_LIBRARY - qpOASES libraries
#
# qpOASES does not have an "install" step, and the includes are in the source
# tree, while the libraries are in the build tree.
# Therefore the environment and cmake variables `qpOASES_SOURCE_DIR` and
# `qpOASES_BINARY_DIR` will be used to locate the includes and libraries.
#=============================================================================
# Copyright 2014 iCub Facility, Istituto Italiano di Tecnologia
# Authors: Daniele E. Domenichelli <daniele.domenichelli@iit.it>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of YCM, substitute the full
# License text for the above reference.)
MACRO(SEARCH_FOR_QPOASES)
include(FindPackageHandleStandardArgs)
find_path(qpOASES_INCLUDEDIR
NAMES qpOASES.hpp
HINTS "${qpOASES_SOURCE_DIR}"
ENV qpOASES_SOURCE_DIR
PATH_SUFFIXES include)
find_library(qpOASES_LIB
NAMES qpOASES
HINTS "${qpOASES_BINARY_DIR}"
ENV qpOASES_BINARY_DIR
PATH_SUFFIXES lib
libs)
set(qpOASES_INCLUDE_DIR ${qpOASES_INCLUDEDIR})
set(qpOASES_LIBRARY ${qpOASES_LIB})
find_package_handle_standard_args(qpOASES DEFAULT_MSG qpOASES_LIBRARY
qpOASES_INCLUDE_DIR)
set(qpOASES_FOUND ${QPOASES_FOUND})
ENDMACRO(SEARCH_FOR_QPOASES)
......@@ -19,9 +19,8 @@ SET(${LIBRARY_NAME}_SOURCES
ADD_LIBRARY(${LIBRARY_NAME} SHARED ${${LIBRARY_NAME}_SOURCES})
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${CDD_LIBRARIES})
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${CDD_LIBRARIES} ${QPOASES_LIBRARY})
PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} eigen3)
PKG_CONFIG_USE_DEPENDENCY(${LIBRARY_NAME} qpOASES)
if(CLP_FOUND)
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${CLP_LIBRARIES}
......
......@@ -9,6 +9,5 @@ PKG_CONFIG_USE_DEPENDENCY(static-equilibrium eigen3)
TARGET_LINK_LIBRARIES(static-equilibrium ${PROJECT_NAME})
ADD_UNIT_TEST(lp-solvers test_LP_solvers)
PKG_CONFIG_USE_DEPENDENCY(lp-solvers qpOASES)
PKG_CONFIG_USE_DEPENDENCY(lp-solvers eigen3)
TARGET_LINK_LIBRARIES(lp-solvers ${PROJECT_NAME})
TARGET_LINK_LIBRARIES(lp-solvers ${PROJECT_NAME} ${QPOASES_LIBRARY})
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment