CMake can't find “FindLibUSB.cmake” in CMAKE_MODULE_PATH despite it being there

风流意气都作罢 提交于 2020-01-24 20:15:49

问题


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)

来源:https://stackoverflow.com/questions/38598631/cmake-cant-find-findlibusb-cmake-in-cmake-module-path-despite-it-being-there

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!