CMake can't find “FindLibUSB.cmake” in CMAKE_M

2019-07-30 12:51发布

问题:

In my CMakelists.txt file, I specify:

set (CMAKE_MODULE_PATH “${<ProjectName>_SOURCE_DIR}/cmake_modules”)

And in my project root directory, there's a subdirectory called cmake_modules with a file called FindLibUSB.cmake, but when I run cmake, I get the following error:

By not providing "FindLibUSB.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "LibUSB", but CMake did not find one.

Why can't it find the file? It seems to me it's named correctly, it's in the right spot, and cmake knows where to look.

Here's CMakeLists.txt:

cmake_minimum_required (VERSION 2.8.12.1)

project (Connected-Room)

set (Connected-Room_VERSION_MAJOR 0)
set (Connected-Room_VERSION_MINOR 1)

set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

list (APPEND CMAKE_PREFIX_PATH "/Users/<username>/kinect2/libfreenect2/build/")
list (APPEND CMAKE_MODULE_PATH “${Connected-Room_SOURCE_DIR}/cmake_modules”)

Message ("CMAKE_MODULE_PATH: " ${CMAKE_MODULE_PATH})

find_package (LibUSB REQUIRED)
find_package (OpenCV REQUIRED)
find_package (Boost COMPONENTS system REQUIRED)
find_package (libfreenect2 REQUIRED)