ros2 / rosidl_python

rosidl support for Python
Apache License 2.0
19 stars 45 forks source link

Add include directories consistently PRIVATE instead of PUBLIC #201

Closed cwecht closed 5 months ago

cwecht commented 6 months ago

This helps in situations in which:

  1. If the numpy include directory is determined by executing python: https://github.com/ros2/rosidl_python/blob/65538f0f6bb74fcfa78c15427ad1fa2457bc15fd/rosidl_generator_py/cmake/rosidl_generator_py_generate_interfaces.cmake#L174 and
  2. If the path to your numpy installation may change.

This can happen e.g. if you want to cross-compile ROS2 and want to do it on some CICD setups.

The issue is that right now, e.g. for std_msgs export_std_msgs__rosidl_generator_pyExport.cmake sets the INTERFACE_INCLUDE_DIRECTORIESproperty of std_msgs::std_msgs__rosidl_generator_py to an absolute path (which causes issues if the folder of your numpy installation changes.

With this patch all include directories are consistently added PRIVATE instead of PUBLIC. There shouldn't be a need to expose them anyways.

clalancette commented 5 months ago

I've now merged in #140, which also contains this fix. So I'll close this one out.