Skip to content
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

No absolute paths for dependants #3

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

No absolute paths for dependants #3

wants to merge 13 commits into from

Conversation

ahoereth
Copy link
Member

@ahoereth ahoereth commented Jun 8, 2023

By no means sure this is the correct approach.. Cmake documentation on this is rather confusing because there appear to be many different ways of achieving the same thing.

Result in deps/lib/cmake/SickLMS5xx/SickLMS5xxTargets.cmake:

# Create imported target SickLMS5xx::SickLMS5xx
add_library(SickLMS5xx::SickLMS5xx SHARED IMPORTED)

set_target_properties(SickLMS5xx::SickLMS5xx PROPERTIES
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include/"
  INTERFACE_LINK_DIRECTORIES "${_IMPORT_PREFIX}/lib/"
  INTERFACE_LINK_LIBRARIES "Eigen3::Eigen;Threads::Threads;pcl_common;pcl_octree;pcl_io;Boost::system;Boost::filesystem;Boost::iostreams;Boost::serializ
ation;VTK::ChartsCore;VTK::CommonColor;VTK::CommonComputationalGeometry;VTK::CommonCore;VTK::CommonDataModel;VTK::CommonExecutionModel;VTK::CommonMath;V
TK::CommonMisc;VTK::CommonTransforms;VTK::FiltersCore;VTK::FiltersExtraction;VTK::FiltersGeneral;VTK::FiltersGeometry;VTK::FiltersModeling;VTK::FiltersS
ources;VTK::ImagingCore;VTK::ImagingSources;VTK::InteractionImage;VTK::InteractionStyle;VTK::InteractionWidgets;VTK::IOCore;VTK::IOGeometry;VTK::IOImage
;VTK::IOLegacy;VTK::IOPLY;VTK::RenderingAnnotation;VTK::RenderingCore;VTK::RenderingContext2D;VTK::RenderingLOD;VTK::RenderingFreeType;VTK::ViewsCore;VT
K::ViewsContext2D;VTK::RenderingOpenGL2;VTK::RenderingContextOpenGL2;VTK::GUISupportQt"
  INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "include/"
)

dislike that all the vtk thingies are listed there instead of only the top-level dependencies. That appears to be a result of this line in the CMakeLists.txt:

target_link_libraries(${PROJECT_NAME} PUBLIC ${LIBS})

@@ -72,9 +72,9 @@ target_include_directories(${PROJECT_NAME}
${EIGEN3_INCLUDE_DIRS}
)
if (WITH_PCL)
target_include_directories(${PROJECT_NAME} PUBLIC ${PCL_INCLUDE_DIRS})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but this would be wrong. client projects need to include pcl include dirs if they want to make use of pcl.hpp shipped with this project.
same with libs

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the description of the PR, looks like it still produces the correct includes. Thing is we just cannot use absolute paths to where the includes "were" during install if it should be relocatable.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where do you see the correct pcl dirs being included? did you try with pcl being in a different prefix than this library?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea its not in there, but if it contains a path which does not exist anymore, it errors.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes no doubt, but I'm not sure what the fix is.

@themightyoarfish
Copy link

shifting the inclusion and linking of transitive dependencies onto all client projects can't be the way to go.
what is the before-state of this PR?

Comment on lines -23 to -29
# Have to come last as they modify some variable used above.
include(CMakeFindDependencyMacro)
find_dependency(Eigen3 3.3.4 REQUIRED)
find_dependency(PCL 1.11 REQUIRED COMPONENTS common io)
# link the deps so that client projects get them also
target_link_libraries(SickLMS5xx::SickLMS5xx INTERFACE Eigen3::Eigen pcl_common pcl_io)
target_include_directories(SickLMS5xx::SickLMS5xx INTERFACE $<INSTALL_INTERFACE:include>)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it make sense to make the PCL links private as you did above, but the generated SickLMS5xxConfig.cmake should still have the find_dependency() calls to resolve this stuff at configure time, does including them here lead to any hardcoded paths???

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i had thought that gets executed when you call find_package(Sick), so there should not be any install paths in there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants