-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 version detection in Findhidapi.cmake #4215
Conversation
Co-authored-by: Be-ing <be@mixxx.org>
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.
This doesn't fix the incorrect #include path which was fixed already in #4200.
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.
This has a misleading error message in case hidapi is too old:
-- Found hidapi: /usr/lib/x86_64-linux-gnu/libhidapi-libusb.so
-- Found libhidapi version < 0.10.0
-- Linking internal libhidapi 0.10.1 statically
Found libhidapi version < 0.10.0
is misleading. While it is technically correct, we require 0.10.1 and this is what the user should be told. find_package(hidapi 0.10.1)
as in #4200 does this.
CMakeLists.txt
Outdated
message(STATUS "Found libhidapi version < 0.10.0") | ||
endif() | ||
endif() | ||
message(STATUS "Linking internal libhidapi 0.10.1 statically") |
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.
This is error prone. I do not anticipate that anyone would remember to update this line when updating the vendored library.
No, the Mixxx code has been wrong. #4200 fixes it. |
…ion number literaly
Please explain how it has worked since than. |
It worked because the build system fudged the include paths by treating |
This is the way it is used in the examples on https://github.com/libusb/hidapi and in many other Findhidapi.cmke implementations.
We should use the library in the recommended way. This is by the way an extra topic not related to the bug fix in this PR. |
OK, all findings are resolved, merge? |
I don't care which of this or #4200 gets merged. They both do the same thing. It was frustrating to have to review this. |
I'm slightly in favor of merging #4200, because it is simpler and the error message is comprehensible for me. The special case handling is restricted to Findhidapi.cmake and does not creep into CMakeLists.txt. |
OK, here the full fix as discussed as second option. Now a it utilizes PC_hidapi_VERSION and falls back reading the header if the PC file is not available. In case of Ubuntu Bionic it prints now:
|
I was not aware of the VERSION_VAR parameter of FindPackageHandleStandardArgs. That is the best solution. |
The first commit is the bug fix, taken from #4200, the second commit is for the improved messages.