Skip to content

Make .pc file relocatable and refactor cmake config#255

Merged
meyerj merged 3 commits intomasterfrom
fix/relocatable-pc-and-refactor-cmake-config
Jun 7, 2020
Merged

Make .pc file relocatable and refactor cmake config#255
meyerj merged 3 commits intomasterfrom
fix/relocatable-pc-and-refactor-cmake-config

Conversation

@meyerj
Copy link
Copy Markdown
Member

@meyerj meyerj commented Jun 6, 2020

Fixes #251:

By avoiding to embed the absolute path of the install prefix in e.g. the .pc file. Similar to ros2/urdfdom#20.

and also addresses #251 (comment):

Using ../../.. in the exposed INCLUDE_DIRS adds the standard include path not specific to KDL at least twice to the compiler command-line, because it is not recognized as a duplicate, and causes problems with include directory ordering or with treating include directories of upstream packages as system include dirs.

Furthermore forwarding include directories of dependencies like this is not nice and can also break relocation. Instead, KDLConfig.cmake should find Boost and Eigen again with find_package(), and not hard-code the include directories found at compile-time.

Tested in Ubuntu 18.04 with CMake 3.10.2 and also in Ubuntu 12.04 with CMake 2.8.7 (with Eigen 3.0.5-1). In both cases downstream packages find orocos_kdl in relocated installation directories with both, CMake and pkg-config.

meyerj added 2 commits June 6, 2020 13:26
fix #251)

${pcfiledir} refers to the installed location of the .pc file.
Added @LIB_SUFFIX@ to libdir to match install destination in src/CMakeLists.txt.
CMake variable KDL_INCLUDE_DIRS was unused.
- Avoid relative paths (../../..) in exported CMake variables
- Find dependencies in downstream packages and do not export build-time include
  directories
- Use find_package(Eigen3) CMake config shipped with newer Eigen versions and
  install custom FindEigen3.cmake to find older versions
- Rename CMake templates to match the installed filenames
@MatthijsBurgh
Copy link
Copy Markdown
Collaborator

@meyerj PyKDL fails to build because of a issue finding boost. Which tracebacks to /usr/local/share/orocos_kdl/cmake/orocos_kdl-config.cmake

… config

... if KDL_USE_NEW_TREE_INTERFACE is true.
@meyerj meyerj force-pushed the fix/relocatable-pc-and-refactor-cmake-config branch from 6a0de1f to b2cf207 Compare June 6, 2020 20:42
@meyerj
Copy link
Copy Markdown
Member Author

meyerj commented Jun 6, 2020

@meyerj PyKDL fails to build because of a issue finding boost. Which tracebacks to /usr/local/share/orocos_kdl/cmake/orocos_kdl-config.cmake

Should be fixed by b2cf207. Boost is only required in downstream packages if KDL_USE_NEW_TREE_INTERFACE was enabled at build-time. Before, @Boost_INCLUDE_DIRS@ was just empty in this case.

Copy link
Copy Markdown
Collaborator

@MatthijsBurgh MatthijsBurgh left a comment

Choose a reason for hiding this comment

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

@meyerj go ahead and merge.

@meyerj meyerj merged commit 12c414b into master Jun 7, 2020
@meyerj meyerj deleted the fix/relocatable-pc-and-refactor-cmake-config branch June 7, 2020 10:38
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.

make .pc file relocatable

2 participants