-
Notifications
You must be signed in to change notification settings - Fork 131
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
find_package(ament_cmake_core) call defines uninstall target in non-ament CMake packages #427
Comments
Possible FixA possible fix is to move the code in https://github.com/ament/ament_cmake/blob/1.5.3/ament_cmake_core/ament_cmake_uninstall_target-extras.cmake#L17 to a function, and then call that function in
Possible MitigationA possible mitigation that instead is fully back-compatible is to make sure that the ament_cmake/ament_cmake_core/cmake/uninstall_target/ament_cmake_uninstall_target.cmake.in Line 32 in 3f305a3
CMAKE_BINARY_DIR is exactly the same of CMAKE_CURRENT_BINARY_DIR , while if the code is called not in the root source dir, CMAKE_BINARY_DIR is the correct one to use in this context, as the install_manifest.txt is always only created in the root binary dir.
|
I believe we can move the function call to a new ament extension, which will have the effect of calling it in IMO, we don't need to tick/tock this change or undergo a deprecation cycle - it seems like an oversight to me. |
It seems that any call to
find_package(ament_cmake_core)
, even if a non-ament project, defines auninstall
target, that may interfere with existing targets. In general, it is probably not expected by users that just afind_package
call can define targets. This is even more confusing ifament_cmake_core
is not included directly, but as a dependency when a find_package for a different project is called, for examplefind_package(rclcpp)
.Minimal Reproducible Example
I prepared a MRE in https://github.com/traversaro/mre-rclcpp-uninstall .
In it, there is a minimal project that only installs an empty file, and defines the
uninstall
target according to CMake guidelines (https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#can-i-do-make-uninstall-with-cmake). In a subdirectory then,find_package(ament_cmake_core)
is called. Due to the call tofind_package(ament_cmake_core)
,make uninstall
fails:We can see that if
find_package(ament_cmake_core)
is not called (via-DUSES_RCLCPP:BOOL=OFF
), everything works as expected:The text was updated successfully, but these errors were encountered: