-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use modern interface targets if available, otherwise classic variables #235
Conversation
…s, support interface keyword Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com>
6f92178
to
81498e3
Compare
Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com>
bea0936
to
0ba4a95
Compare
The CI builds without the |
@dirk-thomas I know this isn't the best time or place for questions like this, but this PR seems to have broken a call to/use of I assume that |
@christophebedard Almost all of the patch of https://gitlab.com/micro-ROS/ros_tracing/ros2_tracing/-/merge_requests/162 seems unnecessary:
The only necessary from the patch is:
The one thing missing from the exported interface/target is:
|
This fixes a build issue with stereo_image_proc after a change to ament_target_dependencies exposed an issue in the CMake code: ament/ament_cmake#235 Specifically, since interfaces are being exported by image_proc, ament_target_dependencies detects this and does not set image_proc_INCLUDE_DIRS as stereo_image_proc was expecting. Signed-off-by: Jacob Perron <jacob@openrobotics.org>
This fixes a build issue with stereo_image_proc after a change to ament_target_dependencies exposed an issue in the CMake code: ament/ament_cmake#235 Specifically, since interfaces are being exported by image_proc, ament_target_dependencies detects this and does not set image_proc_INCLUDE_DIRS as stereo_image_proc was expecting. Signed-off-by: Jacob Perron <jacob@openrobotics.org>
This fixes a build issue with stereo_image_proc after a change to ament_target_dependencies exposed an issue in the CMake code: ament/ament_cmake#235 Specifically, since interfaces are being exported by image_proc, ament_target_dependencies detects this and does not set image_proc_INCLUDE_DIRS as stereo_image_proc was expecting. Signed-off-by: Jacob Perron <jacob@openrobotics.org>
@dirk-thomas yeah, most of that was just me trying stuff. However,
I've tried that: diff --git a/tracetools/CMakeLists.txt b/tracetools/CMakeLists.txt
index 3de8d4d..1405ddb 100644
--- a/tracetools/CMakeLists.txt
+++ b/tracetools/CMakeLists.txt
@@ -68,11 +68,6 @@ foreach(_header ${HEADERS})
)
endforeach()
-# Only use output/binary include directory
-include_directories(
- ${PROJECT_BINARY_DIR}/include
-)
-
add_library(${PROJECT_NAME} ${SOURCES})
if(TRACETOOLS_LTTNG_ENABLED)
target_link_libraries(${PROJECT_NAME} ${LTTNG_LIBRARIES})
@@ -83,6 +78,10 @@ if(WIN32)
target_compile_definitions(${PROJECT_NAME} PRIVATE "TRACETOOLS_BUILDING_DLL")
endif()
+# Only use output/binary include directory
+target_include_directories(${PROJECT_NAME} PUBLIC
+ "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>"
+ "$<INSTALL_INTERFACE:include>")
ament_export_interfaces(${PROJECT_NAME}_export HAS_LIBRARY_TARGET)
# Status checking tool and it also doesn't work, see: https://gitlab.com/micro-ROS/ros_tracing/ros2_tracing/-/jobs/504379922#L1638 Either there's something missing in the above CMake config, or this PR did break something.
That does work, and I can switch to that, but then why do we have |
The exported targets use modern CMake where all the other export functions use classic CMake style. If you export a modern target (which will be available as an interface target to downstream packages) that target must contain all the necessary information. In your case your exported interface / target was incomplete. Until now that only worked because both information was used together which isn't the case anymore. If targets are exported only those are now being used so that the classic CMake style can at some point be deprecated / removed. |
This fixes a build issue with stereo_image_proc after a change to ament_target_dependencies exposed an issue in the CMake code: ament/ament_cmake#235 Specifically, since interfaces are being exported by image_proc, ament_target_dependencies detects this and does not set image_proc_INCLUDE_DIRS as stereo_image_proc was expecting. Signed-off-by: Jacob Perron <jacob@openrobotics.org>
I see. The fact that it used to work but does not anymore is unfortunate, but, like you said, my CMake config wasn't actually complete/valid. Thank you for the explanation and tips. |
Related to ros2/ros2#904. |
#235) * use modern interface targets if available, otherwise classic variables, support interface keyword Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com> * remove INTERFACE keyword for now Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com> Signed-off-by: Jose Luis Rivero <jrivero@osrfoundation.org>
Follow up of #230
Use modern interface targets when available for a dependency, otherwise fall back to the classic variables. This will allow a bottom-up approach to update packages without breaking downstream packages.