ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Regarding question 1.:
You should always install all your headers to the destination "include" - everything would be not FHS compliant.
In your source space you could have your headers in (multiple) different locations. It is highly recommended to put them under "include" though.
You have to add them with include_directories()
to make them usable for building targets in your own CMakeLists.txt file.
For other packages in the same workspace you "export" the same directories via catkin_package(INCLUDE_DIRS ...)
.
After being installed catkin expects that if you have listed any folder as INCLUDE_DIRS
that you have installed all files to "include". Any package depending on your package should than use include_directories(${catkin_INCLUDE_DIRS})
or include_directories(${yourpkgname_INCLUDE_DIRS})
to add these include directories.
Generally you should always place your headers into a subfolder named after your package to avoid naming collisions. But the include_directories()
always only point to "include" - not to "include/yourpkgname". That way you always import your code with the namespace prefix: #include <yourpkgname/myheader.h>
.
2 | No.2 Revision |
Regarding question 1.:
You should always install all your headers to the destination "include" - everything else would be not FHS compliant.
In your source space you could have your headers in (multiple) different locations. It is highly recommended to put them under "include" though.
You have to add them with include_directories()
to make them usable for building targets in your own CMakeLists.txt file.
For other packages in the same workspace you "export" the same directories via catkin_package(INCLUDE_DIRS ...)
.
After being installed catkin expects that if you have listed any folder as INCLUDE_DIRS
that you have installed all files to "include". Any package depending on your package should than use include_directories(${catkin_INCLUDE_DIRS})
or include_directories(${yourpkgname_INCLUDE_DIRS})
to add these include directories.
Generally you should always place your headers into a subfolder named after your package to avoid naming collisions. But the include_directories()
always only point to "include" - not to "include/yourpkgname". That way you always import your code with the namespace prefix: #include <yourpkgname/myheader.h>
.
3 | No.3 Revision |
Regarding question 1.:
You should always install all your headers to the destination "include" - everything else would be not FHS compliant.
In your source space you could have your headers in (multiple) different locations. It is highly recommended to put them under "include" though.
You have to add them with include_directories()
to make them usable for building targets in your own CMakeLists.txt file.
For other packages in the same workspace you "export" the same directories via catkin_package(INCLUDE_DIRS ...)
.
After being installed catkin expects that if you have listed any folder as INCLUDE_DIRS
that you have installed all files to "include". Any package depending on your package should than then use include_directories(${catkin_INCLUDE_DIRS})
or include_directories(${yourpkgname_INCLUDE_DIRS})
to add these include directories.
Generally you should always place your headers into a subfolder named after your package to avoid naming collisions. But the include_directories()
always only point to "include" - not to "include/yourpkgname". That way you always import your code with the namespace prefix: #include <yourpkgname/myheader.h>
.