cmake:找不到_包()
我正试图为我的cmake文件找到所需的库,但找不到它 这是我的cmake代码:cmake:找不到_包(),cmake,Cmake,我正试图为我的cmake文件找到所需的库,但找不到它 这是我的cmake代码: find_package(myLib REQUIRED) 这是显示的错误消息: CMake Error at CMakeLists.txt:10 (find_package): By not providing "FindmyLib.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration
find_package(myLib REQUIRED)
这是显示的错误消息:
CMake Error at CMakeLists.txt:10 (find_package):
By not providing "FindmyLib.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "myLib", but
CMake did not find one.
Could not find a package configuration file provided by "myLib" with any
of the following names:
myLibConfig.cmake
mylib-config.cmake
Add the installation prefix of "myLib" to CMAKE_PREFIX_PATH or set
"myLib_DIR" to a directory containing one of the above files. If
"myLib" provides a separate development package or SDK, be sure it has
been installed.
-- Configuring incomplete, errors occurred!
我可以知道如何修复此问题。可能您尚未将放置自定义
FindmyLib.cmake
的文件夹添加到cmake\u模块路径中。
例如,如果您已将FindmyLib.cmake
放置在相对于您正在使用的CMakeList.txt
的文件夹cmake/modules
中,请添加
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules
)
在CMakeList.txt
中,可能您没有将放置自定义FindmyLib.cmake
的文件夹添加到cmake\u模块路径中。
例如,如果您已将FindmyLib.cmake
放置在相对于您正在使用的CMakeList.txt
的文件夹cmake/modules
中,请添加
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules
)
在CMakeList.txt
中,如果没有更多信息,很难回答这个问题。首先看一下这里:请先阅读文档,然后再次提问,如果没有更多信息,很难回答这个问题。首先看一下这里:请先阅读文档,然后再询问