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

Clean up finding external dependencies and use imported targets where available #196

Merged
merged 9 commits into from
Jan 31, 2017
Merged

Conversation

jamiesnape
Copy link
Contributor

  • Uses the output of pkg-config as input to find_library() and find_path() calls so that CMake is always provided with the absolute paths to libraries, as is recommended. Also avoids the need to use the ambiguous and frowned upon link_directories().
  • Uses IMPORTED targets for external libraries where available. Recent versions of Eigen, libccd, and OctoMap all provide these. If IMPORTED targets are not available *_INCLUDE_DIRS and *_LIBRARIES variables are used, as previously.
  • Populates INTERFACE_INCLUDE_DIRECTORIES for fcl with the locations of all necessary external headers via either target_link_libraries() for IMPORTED targets or target_include_directories() otherwise. The locations of the headers for libccd and OctoMap were missing before. Also removes redundant calls to include_directories().
  • Adds eigen3, libccd, and octomap, if necessary, to the Requires field of fcl.pc. All were missing before. Also adds the missing Description.
  • Removes the -g from the compiler flags always passed to GCC. The Debug and RelWithDebInfo CMake build types exist for this purpose.

@jamiesnape
Copy link
Contributor Author

Note that master is currently broken: https://travis-ci.org/flexible-collision-library/fcl/builds/188952125.

@jslee02 jslee02 added this to the FCL 0.6.0 milestone Jan 24, 2017
Copy link
Member

@jslee02 jslee02 left a comment

Choose a reason for hiding this comment

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

Looks good to me. I just have some questions and a suggestion.

if(NOT Eigen3_FOUND)
find_package(Eigen3 3.0.5 QUIET MODULE)
set(Eigen3_FOUND ON)
endif()
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to find packages in config mode and module mode explicitly? I though find_package() is for it. Is this for searching the config file first? If so, why is that necessary?

Copy link
Contributor Author

@jamiesnape jamiesnape Jan 31, 2017

Choose a reason for hiding this comment

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

Because CMake find_package uses MODULE mode first and falls back to CONFIG mode, which unfortunately is the opposite to what we would want.

Copy link
Member

Choose a reason for hiding this comment

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

Why do we want to search in that order then?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The config file is maintained by Eigen will adapt to any changes that they make. Also it defines imported targets. The reason that find_package defaults to the other direction so as to not unknowingly break existing projects.

set(CCD_LIBRARIES "${CCD_LIBRARY}" "${M_LIBRARY}")
set(ccd_FOUND ON)

mark_as_advanced(CCD_INCLUDE_DIR CCD_LIBRARY)
endif()
endif()
Copy link
Member

Choose a reason for hiding this comment

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

I would like to suggest encapsulating this logic (and for other dependencies as well) as a separate custom module like FindCCD.cmake. That would make this main CMakeLists.txt cleaner.

Copy link
Member

Choose a reason for hiding this comment

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

We could do this later if needed. I'm merging this PR now.

@jslee02 jslee02 merged commit aae59c4 into flexible-collision-library:master Jan 31, 2017
@jamiesnape jamiesnape deleted the imported-targets branch February 2, 2017 14:00
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