You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Linux/CMake: INTERFACE_INCLUDE_DIRECTORIES property of target hidapi::hidapi not correctly set in libhidapi.cmake (v0.12.0) #483
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:
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::hidapi target from another project:
CMake Error in CMakeLists.txt:
Imported target "hidapi::hidapi" includes non-existent path
"/hidapi"
in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:
* The path was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and references files it does not
provide.
Reason found: src/CMakeLists.txt uses CMAKE_INSTALL_INCLUDEDIR for definition of target include directories of hidapi_include before it is defined by GNUInstallDirs:
Interesting fact: CMAKE_INSTALL_INCLUDEDIR is empty only during the initial CMake run.
That's probably why I didn't catch it myself - I usually run cmake many times while I test anything locally.
Definitely need a good CI check for that.
Activity
stsichler commentedon Nov 16, 2022
Reason found:
src/CMakeLists.txtusesCMAKE_INSTALL_INCLUDEDIRfor definition of target include directories ofhidapi_includebefore it is defined byGNUInstallDirs:hidapi/src/CMakeLists.txt
Line 77 in 2b70208
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.Youw commentedon Nov 22, 2022
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.
Fix CMake export files (#484)