-
Notifications
You must be signed in to change notification settings - Fork 34
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
Fix hardcoded pkg-config library in examples to fix tests on non-Debian Linux systems #163
Conversation
Unfortunately the value of |
Signed-off-by: Silvio Traversaro <silvio.traversaro@iit.it>
# On Debian and if the install prefix is /usr, the default CMAKE_INSTALL_LIBDIR of this project | ||
# as set by GNUInstallDirs will be different from the one of the example project, | ||
# so let's hardcode it in that case | ||
if(EXISTS "/etc/debian_version" AND "${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want to check that the prefix is /usr
, should we remove the ?
?
According to the CMake Regex Specification, ?
is defined as Matches preceding pattern zero or once only
. So, couldn't this mean that there would be zero matches, resulting in the if
being true
when it should really be false
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that the ?
is meant to match both ^/usr$
and ^/usr/$
. Just as a reference, this logic was taken from the relevant code in CMake itself: https://gitlab.kitware.com/cmake/cmake/-/blob/v3.20.0/Modules/GNUInstallDirs.cmake#L242 .
Changes look okay to me. @j-rivero, mind taking a quick look? |
There was a problem hiding this 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. Thanks @traversaro
🦟 Bug fix
Fixes test failures on platforms (such as non-Debian Linux) in which
CMAKE_INSTALL_LIBDIR
is not equal tolib
.Summary
ignition-cmake by default installs the pkg-config files in
${CMAKE_INSTALL_LIBDIR}\pkgconfig
(see https://github.com/ignitionrobotics/ign-cmake/blob/b03ca34191e538d334f8d9bb285711a4b487e2a4/cmake/IgnPackaging.cmake#L201). Later, in the tests before this PR it is assumed that they are installed by default inlib\pkgconfig
. However, there are several platforms (such as a any non-Debian Linux system) in which${CMAKE_INSTALL_LIBDIR}
is notlib
, so in those platforms the test would fail.This PR fixes this by using
${CMAKE_INSTALL_LIBDIR}
also in the tests.Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge