Linux/CMake: INTERFACE_INCLUDE_DIRECTORIES property of target hidapi::hidapi not correctly set in libhidapi.cmake (v0.12.0) #483
Labels
No labels
3rdparty
Android
API
Author does not respond
bsd
bug
build system/CI
ci-virtual-device
CMake
Contributions Welcome
Core
dependencies
device-specific
documentation
don't_merge
duplicate
enhancement
Example
Haiku
hidraw
hotplug
info required
invalid
libusb
macOS
Misc
Not an issue
question
Release
Test
Test GUI
Windows
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-libusb/hidapi#483
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I have built hidapi (0.12.0) from source and installed it into a local directory (/home/xxxx/.lib/hidapi-0.12.0/x86_64-linux-gnu) using following commands:
hidapiproperly installes into the correct location, but the resulting contents of the generatedlibhidapi.cmakefile includes these lines:Note that installation prefix is missing here from the INTERFACE_INCLUDE_DIRECTORIES path.
In consequence, CMake outputs the following error when I try to consume the
hidapi::hidapitarget from another project:Reason found:
src/CMakeLists.txtusesCMAKE_INSTALL_INCLUDEDIRfor definition of target include directories ofhidapi_includebefore it is defined byGNUInstallDirs:github.com/libusb/hidapi@2b70208fea/src/CMakeLists.txt (L77)See this patch moving
GNUInstallDirsto an earlier position solving the problem.Btw. Note that this problem only occurs at the first cmake configure call, because the
CMAKE_INSTALL_INCLUDEDIRwill be written into the cmake cache.Interesting fact:
CMAKE_INSTALL_INCLUDEDIRis empty only during the initial CMake run.That's probably why I didn't catch it myself - I usually run
cmakemany times while I test anything locally.Definitely need a good CI check for that.