I'm trying to build logger1, which collects data from a Kinect for off-line SLAM by ElasticFusion. I'm building on Windows. I'm trying to build for x64 with VS10 (I have VS12 as well but some of the dependencies come pre-configured to VS10 so to keep it simple I'm using that.) I'm using CMake 3.9.0.
I have ironed out most of the dependencies, but libusb is giving me trouble.
I get the following output from CMake:
...
Checking for module 'libusb-1.0'
No package 'libusb-1.0' found
CMake Error at C:/Program Files/CMake/share/cmake-3.9/Modules/FindPkgConfig.cmake:412 (message):
A required package was not found
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.9/Modules/FindPkgConfig.cmake:588 (_pkg_check_modules_internal)
CMakeLists.txt:12 (pkg_check_modules)
Normally at this point the CMake GUI would show some new config variables in red for include and library paths, with some non-functional default value such as ZLIB_INCLUDE_DIR-NOTFOUND
which I would then have to change to the actual paths and re-run the Configure.
However, in the case of libusb-1.0
, I am not given any new config variables in the GUI. I have the Advanced checkbox ticked and the needed variables still don't show.
I have downloaded a pre-built libusb-1.0.21, but CMake inevitably can't find it; this is not *nix where library paths are well-defined. I have my own directory structure on a file server for these sorts of things, so CMake absolutely won't be able to find things unless it asks me where they are, which it is not doing in this case.
In poking around a bit, I found some references in Logger1's CMakeLists.txt
, as follows:
find_package(PkgConfig)
pkg_check_modules(libusb-1.0 REQUIRED libusb-1.0)
...
target_link_libraries(Logger
...other libraries...
${libusb-1.0_LIBRARIES})
So, it mentions that it needs libusb, but not how to find it.
There is also mention of libusb in the CMakeCache.txt
file which CMake created. That file shows a number of config variables that look relevant but which are marked INTERNAL
, explaining why I didn't see them in the GUI. The values of all of these were empty except for __pkg_config_checked_libusb-1.0
.
I tried to set these where it was reasonably obvious, as follows:
__pkg_config_checked_libusb-1.0:INTERNAL=1
libusb-1.0_CFLAGS:INTERNAL=
libusb-1.0_CFLAGS_I:INTERNAL=
libusb-1.0_CFLAGS_OTHER:INTERNAL=
libusb-1.0_FOUND:INTERNAL=
libusb-1.0_INCLUDEDIR:INTERNAL=N:/3p-build/libusb/1.0.21/prebuilt/include/libusb-1.0
libusb-1.0_LIBDIR:INTERNAL=N:/3p-build/libusb/1.0.21/prebuilt/MS64/dll
libusb-1.0_LIBS:INTERNAL=N:/3p-build/libusb/1.0.21/prebuilt/MS64/dll/libusb-1.0.lib
libusb-1.0_LIBS_L:INTERNAL=
libusb-1.0_LIBS_OTHER:INTERNAL=
libusb-1.0_LIBS_PATHS:INTERNAL=N:/3p-build/libusb/1.0.21/prebuilt/MS64/dll
libusb-1.0_PREFIX:INTERNAL=
libusb-1.0_STATIC_CFLAGS:INTERNAL=
libusb-1.0_STATIC_CFLAGS_I:INTERNAL=
libusb-1.0_STATIC_CFLAGS_OTHER:INTERNAL=
libusb-1.0_STATIC_LIBDIR:INTERNAL=N:/3p-build/libusb/1.0.21/prebuilt/MS64/static
libusb-1.0_STATIC_LIBS:INTERNAL=N:/3p-build/libusb/1.0.21/prebuilt/MS64/static/libusb-1.0.lib
libusb-1.0_STATIC_LIBS_L:INTERNAL=
libusb-1.0_STATIC_LIBS_OTHER:INTERNAL=
libusb-1.0_STATIC_LIBS_PATHS:INTERNAL=N:/3p-build/libusb/1.0.21/prebuilt/MS64/static
libusb-1.0_VERSION:INTERNAL=
libusb-1.0_libusb-1.0_INCLUDEDIR:INTERNAL=N:/3p-build/libusb/1.0.21/prebuilt/include/libusb-1.0
libusb-1.0_libusb-1.0_LIBDIR:INTERNAL=N:/3p-build/libusb/1.0.21/prebuilt/MS64/static
libusb-1.0_libusb-1.0_PREFIX:INTERNAL=
libusb-1.0_libusb-1.0_VERSION:INTERNAL=
I then got back into CMake and pressed Configure, only to have it delete everything I put in CMakeCache.txt
and then complain that it can't find the library (duh.)
I don't and have never used CMake in my own projects, so whatever is wrong is way outside my limited familiarity.
How can I get CMake to recognize the libusb files I have?