我正在尝试为我的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!
我可以知道如何解决这个问题。
答案 0 :(得分:0)
也许您尚未添加将自定义FindmyLib.cmake
放置到CMAKE_MODULE_PATH
的文件夹。
例如,如果您将FindmyLib.cmake
放在相对于您使用的cmake/modules
的{{1}}文件夹中,请添加
CMakeList.txt
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules
)
中的