Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
cmake:找不到_包()_Cmake - Fatal编程技术网

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

我正试图为我的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 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

中,如果没有更多信息,很难回答这个问题。首先看一下这里:请先阅读文档,然后再次提问,如果没有更多信息,很难回答这个问题。首先看一下这里:请先阅读文档,然后再询问