title: How do I tell CMake where to find libusb?
body: <p>I'm trying to build <a href="https://github.com/mp3guy/logger1" rel="nofollow noreferrer">logger1</a>, which collects data from a Kinect for off-line SLAM by <a href="https://github.com/mp3guy/ElasticFusion" rel="nofollow noreferrer">ElasticFusion</a>.  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.</p>
  
  <p>I have ironed out most of the dependencies, but libusb is giving me trouble.</p>
  
  <p>I get the following output from CMake:</p>
  
  <pre><code>...
  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)
  </code></pre>
  
  <p>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 <code>ZLIB_INCLUDE_DIR-NOTFOUND</code> which I would then have to change to the actual paths and re-run the Configure.</p>
  
  <p>However, in the case of <code>libusb-1.0</code>, 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.</p>
  
  <p>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.</p>
  
  <p>In poking around a bit, I found some references in Logger1's <code>CMakeLists.txt</code>, as follows:</p>
  
  <pre><code>find_package(PkgConfig)
  pkg_check_modules(libusb-1.0 REQUIRED libusb-1.0)
  
  ...
  
  target_link_libraries(Logger
                        ...other libraries...
                        ${libusb-1.0_LIBRARIES})
  </code></pre>
  
  <p>So, it mentions that it needs libusb, but not how to find it.</p>
  
  <p>There is also mention of libusb in the <code>CMakeCache.txt</code> file which CMake created.  That file shows a number of config variables that look relevant but which are marked <code>INTERNAL</code>, explaining why I didn't see them in the GUI.  The values of all of these were empty except for <code>__pkg_config_checked_libusb-1.0</code>.</p>
  
  <p>I tried to set these where it was reasonably obvious, as follows:</p>
  
  <pre><code>__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=
  </code></pre>
  
  <p>I then got back into CMake and pressed Configure, only to have it delete everything I put in <code>CMakeCache.txt</code> and then complain that it can't find the library (duh.)</p>
  
  <p>I don't and have never used CMake in my own projects, so whatever is wrong is way outside my limited familiarity.</p>
  
  <p>How can I get CMake to recognize the libusb files I have?</p>