Verified Commit 0d96ba09 authored by Justin Carpentier's avatar Justin Carpentier
Browse files

cmake: add macro for EXAMPLES

parent 9a2914a5
......@@ -2,6 +2,23 @@
# Copyright (c) 2015-2020 CNRS INRIA
#
FUNCTION(ADD_PINOCCHIO_CPP_EXAMPLE EXAMPLE)
GET_FILENAME_COMPONENT(EXAMPLE_NAME ${EXAMPLE} NAME)
SET(EXAMPLE_NAME "example-cpp-${EXAMPLE_NAME}")
ADD_UNIT_TEST(${EXAMPLE_NAME} ${EXAMPLE})
TARGET_LINK_LIBRARIES(${EXAMPLE_NAME} ${PROJECT_NAME})
PKG_CONFIG_USE_DEPENDENCY(${EXAMPLE_NAME} eigen3)
IF(URDFDOM_FOUND)
PKG_CONFIG_USE_DEPENDENCY(${EXAMPLE_NAME} urdfdom)
ENDIF(URDFDOM_FOUND)
IF(HPP_FCL_FOUND)
PKG_CONFIG_USE_DEPENDENCY(${EXAMPLE_NAME} hpp-fcl)
ENDIF(HPP_FCL_FOUND)
IF(CPPAD_FOUND)
PKG_CONFIG_USE_DEPENDENCY(${EXAMPLE_NAME} "cppad")
ENDIF(CPPAD_FOUND)
ENDFUNCTION()
SET(${PROJECT_NAME}_EXAMPLES
inverse-kinematics
overview-simple
......@@ -26,19 +43,7 @@ ENDIF(HPP_FCL_FOUND)
ADD_DEFINITIONS(-DPINOCCHIO_MODEL_DIR="${PINOCCHIO_MODEL_DIR}")
FOREACH(EXAMPLE ${${PROJECT_NAME}_EXAMPLES})
SET(EXAMPLE_NAME "example-cpp-${EXAMPLE}")
ADD_UNIT_TEST(${EXAMPLE_NAME} ${EXAMPLE})
TARGET_LINK_LIBRARIES(${EXAMPLE_NAME} ${PROJECT_NAME})
PKG_CONFIG_USE_DEPENDENCY(${EXAMPLE_NAME} eigen3)
IF(URDFDOM_FOUND)
PKG_CONFIG_USE_DEPENDENCY(${EXAMPLE_NAME} urdfdom)
ENDIF(URDFDOM_FOUND)
IF(HPP_FCL_FOUND)
PKG_CONFIG_USE_DEPENDENCY(${EXAMPLE_NAME} hpp-fcl)
ENDIF(HPP_FCL_FOUND)
IF(CPPAD_FOUND)
PKG_CONFIG_USE_DEPENDENCY(${EXAMPLE_NAME} "cppad")
ENDIF(CPPAD_FOUND)
ADD_PINOCCHIO_CPP_EXAMPLE(${EXAMPLE})
ENDFOREACH(EXAMPLE ${${PROJECT_NAME}_EXAMPLES})
IF(BUILD_PYTHON_INTERFACE)
......
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