Commit 621f3c8c authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

[CMake] use CMake Exports

parent dd9e39be
#
# Copyright 2010, 2018, 2019 CNRS
# Copyright 2010, 2018-2020 CNRS
# Authors: Florent Lamiraux, Guilhem Saurel
#
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
SET(PROJECT_NAMESPACE stack-of-tasks)
SET(PROJECT_NAME dynamic-graph-tutorial)
......@@ -20,15 +20,15 @@ OPTION (BUILD_PYTHON_INTERFACE "Build the python binding" ON)
OPTION (INSTALL_PYTHON_INTERFACE_ONLY "Install *ONLY* the python binding" OFF)
SET (CUSTOM_HEADER_DIR "dynamic-graph/tutorial")
CMAKE_POLICY(SET CMP0048 OLD)
PROJECT(${PROJECT_NAME} CXX)
COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX)
PROJECT(${PROJECT_NAME} ${PROJECT_ARGS})
ADD_REQUIRED_DEPENDENCY("dynamic-graph")
ADD_PROJECT_DEPENDENCY(dynamic-graph REQUIRED PKG_CONFIG_REQUIRES dynamic-graph)
SET(BOOST_COMPONENTS unit_test_framework)
IF(BUILD_PYTHON_INTERFACE)
ADD_REQUIRED_DEPENDENCY("dynamic-graph-python")
ADD_PROJECT_DEPENDENCY(dynamic-graph-python REQUIRED PKG_CONFIG_REQUIRES dynamic-graph-python)
FINDPYTHON()
STRING(REGEX REPLACE "-" "_" PY_NAME ${PROJECT_NAME})
SET(BOOST_COMPONENTS ${BOOST_COMPONENTS} python)
......
Subproject commit 63efaecd7c1fa3f9c190b5365561c38ea33f3236
Subproject commit 4514454f5f9462047b5c29f61b6c3e0db731c416
......@@ -12,10 +12,13 @@ SET(${PY_NAME}_PYTHON
)
ADD_LIBRARY(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_SOURCES})
PKG_CONFIG_USE_DEPENDENCY(${PROJECT_NAME} dynamic-graph)
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PUBLIC dynamic-graph::dynamic-graph)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} dynamic-graph::dynamic-graph)
IF(BUILD_PYTHON_INTERFACE)
PKG_CONFIG_USE_DEPENDENCY(${PROJECT_NAME} dynamic-graph-python)
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PUBLIC dynamic-graph-python::dynamic-graph-python)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} dynamic-graph-python::dynamic-graph-python)
DYNAMIC_GRAPH_PYTHON_MODULE("tutorial" ${PROJECT_NAME} wrap)
INSTALL(FILES ${${PY_NAME}_PYTHON} DESTINATION "${PYTHON_SITELIB}/dynamic_graph/tutorial/")
ENDIF(BUILD_PYTHON_INTERFACE)
......
ADD_DEFINITIONS(-DBOOST_TEST_DYN_LINK -DBOOST_TEST_MAIN)
ADD_UNIT_TEST(pendulum pendulum)
TARGET_LINK_LIBRARIES(pendulum ${PROJECT_NAME} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
PKG_CONFIG_USE_DEPENDENCY(pendulum dynamic-graph)
TARGET_LINK_LIBRARIES(pendulum ${PROJECT_NAME} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} dynamic-graph::dynamic-graph)
TARGET_INCLUDE_DIRECTORIES(pendulum PUBLIC dynamic-graph::dynamic-graph)
ADD_UNIT_TEST(controller controller)
TARGET_LINK_LIBRARIES(controller ${PROJECT_NAME} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
PKG_CONFIG_USE_DEPENDENCY(controller dynamic-graph)
TARGET_LINK_LIBRARIES(controller ${PROJECT_NAME} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} dynamic-graph::dynamic-graph)
TARGET_INCLUDE_DIRECTORIES(controller PUBLIC dynamic-graph::dynamic-graph)
Supports Markdown
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