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

From Wiki for iCub and Friends
Jump to navigation Jump to search
(Created page with "These simple instructions show how to configure your build to install data files (xml and config files for applications and modules). First make sure you find YARP and extend...")
 
Line 14: Line 14:
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.
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. this creates an example app:
Now you can install additional data files by using the macro ''yarp_install'', e.g.:
 
set(appname Example)


  file(GLOB conf ${CMAKE_CURRENT_SOURCE_DIR}/conf/*.ini)
  file(GLOB conf ${CMAKE_CURRENT_SOURCE_DIR}/conf/*.ini)

Revision as of 00:39, 28 November 2013

These simple instructions show how to configure your build to install data files (xml and config files for applications and modules).

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})