Difference between revisions of "Configure your build for installing data files"

From Wiki for iCub and Friends
Jump to navigation Jump to search
Line 1: Line 1:
These simple instructions show how to configure your build to install data files (xml and config files for applications and modules).
These simple instructions show how to configure your build to install data files (xml and config files for applications and modules).
This step is only needed if you want to install these files within


First make sure you find YARP and extend CMAKE_MODULE_PATH to make cmake scripts in YARP visible.
First make sure you find YARP and extend CMAKE_MODULE_PATH to make cmake scripts in YARP visible.

Revision as of 21:01, 17 December 2013

These simple instructions show how to configure your build to install data files (xml and config files for applications and modules). This step is only needed if you want to install these files within

First make sure you find YARP and extend CMAKE_MODULE_PATH to make cmake scripts in YARP visible.

find_package(YARP REQUIRED)
# Pick up our scripts - they are all in the conf subdirectory
list(APPEND CMAKE_MODULE_PATH ${YARP_MODULE_PATH})

Then call:

include(YarpInstallationHelpers)
yarp_configure_external_installation(BUILD)

Where BUILD is the name of your build/project. The first call brings in a set of YARP macros. The second line modifies YARP installation so that it can locate the data files you will install in your build.

Now you can install additional data files by using the macro yarp_install, e.g.:

file(GLOB conf ${CMAKE_CURRENT_SOURCE_DIR}/conf/*.ini)
file(GLOB templates ${CMAKE_CURRENT_SOURCE_DIR}/scripts/*.template)
file(GLOB scripts ${CMAKE_CURRENT_SOURCE_DIR}/scripts/*.xml)
yarp_install(FILES ${conf} DESTINATION ${BUILD_CONTEXTS_INSTALL_DIR}/${appname})
yarp_install(FILES ${templates} DESTINATION ${BUILD_APPLICATIONS_TEMPLATES_INSTALL_DIR})
yarp_install(FILES ${scripts} DESTINATION ${BUILD_APPLICATIONS_INSTALL_DIR})