# Revision history [back]

So catkin makes the assumption that you install all of your headers into the root of the include folder and that they are name spaced by your package name, i.e. <prefix>/include/pkg_name, when generating your CMake config file and pkg-config files. So your resulting pkg_name_INCLUDE_DIRS will by default be <prefix>/include. In this instance you want to have that also include <prefix>/include/pkg_name.

There are two ways to accomplish this. The first is simple, but will break if you relocate the installed package.

Simply pass this to your catkin_package(...) call:

catkin_package(
INCLUDE_DIRS include include/tinyxml ${CMAKE_INSTALL_PREFIX}/include/tinyxml ... )  The second way uses the pkg_name_DIR variable which allows you to make a relocatable addition to your _INCLUDE_DIRS. The problem is that this variable is not available in your CMakeLists.txt, but is available when your package is find_package'ed, so you have to use a CMake extras file (which gets evaluated at find_package time) in order to do this correctly. Reference: http://docs.ros.org/api/catkin/html/dev_guide/generated_cmake_api.html#catkin_package (CFG_EXTRAS) In order to do this, what you will want to do is to is create a file in your project cmake/<pkg_name>-extras.cmake.in where you replace <pkg_name> with your package name. In that file you should do something like this: list(APPEND @PROJECT_NAME@_INCLUDE_DIRS${@PROJECT_NAME@_DIR}/../../../@CATKIN_GLOBAL_INCLUDE_DESTINATION@/tinyxml)


The elements inside of @..@ will get templated at build time of your package. You will need to tell catkin to do this templating for you:

catkin_package(
...
CFG_EXTRAS <pkg_name>-extras.cmake
)


Note that you do not include the .in extension here.

So catkin makes the assumption that you install all of your headers into the root of the include folder and that they are name spaced by your package name, i.e. <prefix>/include/pkg_name, when generating your CMake config file and pkg-config files. So your resulting pkg_name_INCLUDE_DIRS will by default be <prefix>/include. In this instance you want to have that also include <prefix>/include/pkg_name.

There are two ways to accomplish this. The first is simple, but will break if you relocate the installed package.

Simply pass this to your catkin_package(...) call:

catkin_package(
INCLUDE_DIRS include include/tinyxml ${CMAKE_INSTALL_PREFIX}/include/tinyxml ... )  The second way uses the pkg_name_DIR variable which allows you to make a relocatable addition to your _INCLUDE_DIRS. The problem is that this variable is not available in your CMakeLists.txt, but is available when your package is find_package'ed, so you have to use a CMake extras file (which gets evaluated at find_package time) in order to do this correctly. Reference: http://docs.ros.org/api/catkin/html/dev_guide/generated_cmake_api.html#catkin_package (CFG_EXTRAS) In order to do this, what you will want to do is to is create a file in your project cmake/<pkg_name>-extras.cmake.in where you replace <pkg_name> with your package name. In that file you should do something like this: list(APPEND @PROJECT_NAME@_INCLUDE_DIRS${@PROJECT_NAME@_DIR}/../../../@CATKIN_GLOBAL_INCLUDE_DESTINATION@/tinyxml)


The elements inside of @..@ will get templated at build time of your package. You will need to tell catkin to do this templating for you:

catkin_package(
...
CFG_EXTRAS <pkg_name>-extras.cmake
)


Note that you do not include the .in extension here.

So catkin makes the assumption that you install all of your headers into the root of the include folder and that they are name spaced by your package name, folder, i.e. <prefix>/include/pkg_name<prefix>/include, when generating your CMake config file and pkg-config files. So your resulting pkg_name_INCLUDE_DIRS will by default be <prefix>/include. In this instance you want to have that also include <prefix>/include/pkg_name. as well.

There are two ways to accomplish this. The first is simple, but will break if you relocate the installed package.

Simply pass this to your catkin_package(...) call:

catkin_package(
INCLUDE_DIRS include include/tinyxml ${CMAKE_INSTALL_PREFIX}/include/tinyxml ... )  The second way uses the pkg_name_DIR variable which allows you to make a relocatable addition to your _INCLUDE_DIRS. The problem is that this variable is not available in your CMakeLists.txt, but is available when your package is find_package'ed, so you have to use a CMake extras file (which gets evaluated at find_package time) in order to do this correctly. Reference: http://docs.ros.org/api/catkin/html/dev_guide/generated_cmake_api.html#catkin_package (CFG_EXTRAS) In order to do this, what you will want to do is to is create a file in your project cmake/<pkg_name>-extras.cmake.in where you replace <pkg_name> with your package name. In that file you should do something like this: list(APPEND @PROJECT_NAME@_INCLUDE_DIRS${@PROJECT_NAME@_DIR}/../../../@CATKIN_GLOBAL_INCLUDE_DESTINATION@/tinyxml)


The elements inside of @..@ will get templated at build time of your package. You will need to tell catkin to do this templating for you:

catkin_package(
...
CFG_EXTRAS <pkg_name>-extras.cmake
)


Note that you do not include the .in extension here.

 4 No.4 Revision gvdhoorn 58512 ●133 ●461 ●707 http://cor.tudelft.nl/

So catkin makes the assumption that you install all of your headers into the root of the include folder, i.e. <prefix>/include, when generating your CMake config file and pkg-config files. So your resulting pkg_name_INCLUDE_DIRS will by default be <prefix>/include. In this instance you want to have that also include <prefix>/include/pkg_name as well.

There are two ways to accomplish this. The first is simple, but will break if you relocate the installed package.

Simply pass this to your catkin_package(...) call:

catkin_package(
INCLUDE_DIRS include include/tinyxml ${CMAKE_INSTALL_PREFIX}/include/tinyxml ... )  The second way uses the pkg_name_DIR variable which allows you to make a relocatable addition to your _INCLUDE_DIRS. The problem is that this variable is not available in your CMakeLists.txt, but is available when your package is find_package'ed, so you have to use a CMake extras file (which gets evaluated at find_package time) in order to do this correctly. Reference: http://docs.ros.org/api/catkin/html/dev_guide/generated_cmake_api.html#catkin_package (CFG_EXTRAS) In order to do this, what you will want to do is to is create a file in your project cmake/<pkg_name>-extras.cmake.in where you replace <pkg_name> with your package name. In that file you should do something like this: list(APPEND @PROJECT_NAME@_INCLUDE_DIRS${@PROJECT_NAME@_DIR}/../../../@CATKIN_GLOBAL_INCLUDE_DESTINATION@/tinyxml)
"\${@PROJECT_NAME@_DIR}/../../../@CATKIN_GLOBAL_INCLUDE_DESTINATION@/tinyxml")


The elements inside of @..@ will get templated at build time of your package. You will need to tell catkin to do this templating for you:

catkin_package(
...
CFG_EXTRAS <pkg_name>-extras.cmake
)


Note that you do not include the .in extension here.